babylon.quarks 0.26.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1194 -8
- package/README.md +13 -9
- package/dist/babylon.quarks.cjs +1 -1
- package/dist/babylon.quarks.cjs.map +1 -1
- package/dist/babylon.quarks.esm.js +1 -1
- package/dist/babylon.quarks.esm.js.map +1 -1
- package/dist/babylon.quarks.umd.min.js +1 -1
- package/dist/babylon.quarks.umd.min.js.map +1 -1
- package/dist/types/index.d.cts +10108 -0
- package/dist/types/index.d.ts +5794 -998
- package/package.json +18 -7
- package/src/BatchedRenderer.ts +274 -156
- package/src/EffectPool.ts +94 -12
- package/src/MeshSurfaceEmitter.ts +50 -14
- package/src/ParticleEmitter.ts +75 -17
- package/src/ParticleSystem.ts +981 -2066
- package/src/QuarksLoader.ts +666 -194
- package/src/QuarksPrefab.ts +367 -73
- package/src/QuarksSerializer.ts +512 -0
- package/src/QuarksUtil.ts +77 -7
- package/src/SpriteBatch.ts +127 -252
- package/src/TrailBatch.ts +545 -348
- package/src/VFXBatch.ts +238 -596
- package/src/batchKey.ts +239 -0
- package/src/batchSettings.ts +546 -0
- package/src/effectDocumentJSON.ts +261 -0
- package/src/effectResources.ts +76 -0
- package/src/envAtlas.ts +126 -18
- package/src/geometryUtil.ts +1 -1
- package/src/index.ts +69 -35
- package/src/nodeId.ts +36 -0
- package/src/shaderProgram.ts +419 -0
- package/src/shaderVariants.ts +245 -0
- package/src/shaders/chunks/blend.ts +31 -0
- package/src/shaders/chunks/fog.ts +12 -5
- package/src/shaders/chunks/sheet.ts +111 -0
- package/src/shaders/chunks/soft.ts +85 -0
- package/src/shaders/chunks/surface.ts +12 -2
- package/src/shaders/local_particle_physics_vert.glsl.ts +14 -28
- package/src/shaders/local_particle_physics_vert.wgsl.ts +16 -29
- package/src/shaders/particle_frag.glsl.ts +5 -22
- package/src/shaders/particle_frag.wgsl.ts +5 -23
- package/src/shaders/particle_physics_frag.glsl.ts +16 -26
- package/src/shaders/particle_physics_frag.wgsl.ts +14 -26
- package/src/shaders/particle_vert.glsl.ts +5 -27
- package/src/shaders/particle_vert.wgsl.ts +5 -26
- package/src/shaders/stretched_bb_particle_vert.glsl.ts +7 -33
- package/src/shaders/stretched_bb_particle_vert.wgsl.ts +7 -33
- package/src/shaders/trail_frag.glsl.ts +13 -0
- package/src/shaders/trail_frag.wgsl.ts +13 -0
- package/src/shaders/trail_vert.glsl.ts +45 -36
- package/src/shaders/trail_vert.wgsl.ts +46 -40
- package/src/softDepth.ts +136 -0
- package/src/system/BehaviorPlan.ts +85 -0
- package/src/system/BoundsTracker.ts +181 -0
- package/src/system/EmissionController.ts +358 -0
- package/src/system/EventDispatcher.ts +60 -0
- package/src/system/ParticleSpawner.ts +274 -0
- package/src/system/SimulationClock.ts +130 -0
- package/src/system/geometry.ts +104 -0
- package/src/system/integrate.ts +428 -0
- package/src/system/materialResolve.ts +165 -0
- package/src/system/normalize.ts +100 -0
- package/src/system/serialization.ts +422 -0
- package/src/system/settingsSchema.ts +339 -0
- package/src/system/types.ts +449 -0
- package/src/textureSource.ts +30 -0
- package/src/trailSettings.ts +54 -0
- package/src/BatchedParticleRenderer.ts +0 -3
- package/src/materials/ParticleMaterials.ts +0 -23
- package/src/materials/index.ts +0 -1
- package/src/shaders/chunks/index.ts +0 -1
- package/src/shaders/chunks/register-shader-chunks.ts +0 -32
- package/src/shaders/chunks/soft_fragment.glsl.ts +0 -13
- package/src/shaders/chunks/soft_pars_fragment.glsl.ts +0 -20
- package/src/shaders/chunks/soft_pars_vertex.glsl.ts +0 -6
- package/src/shaders/chunks/soft_vertex.glsl.ts +0 -6
- package/src/shaders/chunks/tile_fragment.glsl.ts +0 -9
- package/src/shaders/chunks/tile_pars_fragment.glsl.ts +0 -9
- package/src/shaders/chunks/tile_pars_vertex.glsl.ts +0 -28
- package/src/shaders/chunks/tile_vertex.glsl.ts +0 -18
- package/src/shaders/index.ts +0 -9
- package/src/shaders/local_particle_vert.glsl.ts +0 -50
package/README.md
CHANGED
|
@@ -16,13 +16,15 @@ High-performance particle system for [Babylon.js](https://www.babylonjs.com/). B
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
18
|
- **Batched rendering** — heterogeneous particle systems share draw calls via `BatchedRenderer`.
|
|
19
|
-
- **Render modes** — billboard, vertical/horizontal billboard, stretched billboard, mesh particles, and **
|
|
20
|
-
- **Sub-emitters** and a rich set of composable behaviors (color/size/speed over life, noise turbulence, forces, and more from `quarks.core`).
|
|
21
|
-
- **
|
|
19
|
+
- **Render modes** — billboard, vertical/horizontal billboard, stretched billboard, mesh particles, **trails** and **beams** (not available in Babylon's built-in particle systems).
|
|
20
|
+
- **Sub-emitters** and a rich set of composable behaviors (color/size/speed over life, noise turbulence, forces, attractors, collision, and more from `quarks.core`).
|
|
21
|
+
- **Texture effects** — per-texture UV layout (UV channel, tiling, offset, scroll), gradient maps, alpha erosion, UV distortion, flip, texture tile animation with blending, soft particles, custom blend functions, rim lighting on mesh particles, smoothed trails with curve tension.
|
|
22
|
+
- **Trails** — texture modes (stretch, tile, per segment) with a texture scale, a minimum vertex distance and a lifetime (Unity's TrailRenderer settings), swept weapon trails along an emitter axis, world-space recording behind a moving emitter, and `clearTrails()` for teleports.
|
|
23
|
+
- **Scene integration** — render order and rendering groups, layer masks, fog, bounds and frustum culling with Unity's culling modes, sort modes, screen-size limits, and an `EffectPool` that plays one-shot effects without allocating.
|
|
22
24
|
- **Visual authoring** — design effects in our own [effect editor](https://soullnik.github.io/babylon.quarks-standalone/editor.html) or export them from Unity, then load with `QuarksLoader` (quarks.art-exported JSON also works — same format).
|
|
23
25
|
- **Cross-engine format** — the same effect JSON runs in three.js (three.quarks) and Babylon.js.
|
|
24
26
|
- **Adaptive performance** — optional frame-budget quality scaling built into `BatchedRenderer`.
|
|
25
|
-
- **WebGL and WebGPU** — runs on both Babylon engines
|
|
27
|
+
- **WebGL and WebGPU** — runs on both Babylon engines with native GLSL and WGSL shaders; nothing is transpiled or downloaded at run time.
|
|
26
28
|
|
|
27
29
|
## Install
|
|
28
30
|
|
|
@@ -30,7 +32,9 @@ High-performance particle system for [Babylon.js](https://www.babylonjs.com/). B
|
|
|
30
32
|
npm install babylon.quarks @babylonjs/core
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
Peer dependency: `@babylonjs/core`
|
|
35
|
+
Peer dependency: `@babylonjs/core` 9.x. The package ships ES module and CommonJS builds;
|
|
36
|
+
`@babylonjs/core` is ES modules only, so `require('babylon.quarks')` needs a Node that can
|
|
37
|
+
`require` ES modules (20.19 or 22.12 and later). Bundlers and `import` work everywhere.
|
|
34
38
|
|
|
35
39
|
## Quick start
|
|
36
40
|
|
|
@@ -121,7 +125,7 @@ The same bundle works in any plain `<script>` setup alongside the global `babylo
|
|
|
121
125
|
|
|
122
126
|
## WebGPU
|
|
123
127
|
|
|
124
|
-
The library runs on Babylon's `WebGPUEngine`
|
|
128
|
+
The library runs on Babylon's `WebGPUEngine` with its own WGSL shaders: every GLSL shader has a WGSL twin that is picked when the engine is WebGPU, so Babylon never fetches a GLSL-to-WGSL transpiler (glslang/twgsl) for it, and a Content-Security-Policy that blocks `cdn.babylonjs.com` is no obstacle. Everything except engine creation stays the same:
|
|
125
129
|
|
|
126
130
|
```ts
|
|
127
131
|
import {WebGPUEngine} from '@babylonjs/core/Engines/webgpuEngine';
|
|
@@ -132,7 +136,7 @@ await engine.initAsync();
|
|
|
132
136
|
// Scene + BatchedRenderer setup is identical to WebGL.
|
|
133
137
|
```
|
|
134
138
|
|
|
135
|
-
|
|
139
|
+
Every render mode (billboard, stretched billboard, mesh, trail, beam) and every shader variant (`shaderVariants()`) compiles under a real GLSL and a real WGSL compiler with zero errors (`npm run validate:shaders` in the monorepo, run in CI). The [live demos](https://soullnik.github.io/babylon.quarks-standalone/) and the [benchmark page](https://soullnik.github.io/babylon.quarks-standalone/benchmark.html) accept `?engine=webgpu` in the URL to switch engines.
|
|
136
140
|
|
|
137
141
|
## Unity-style emitter options
|
|
138
142
|
|
|
@@ -140,7 +144,7 @@ A few optional settings mirror Shuriken so Unity exports look the same; all are
|
|
|
140
144
|
only written to the effect JSON when set.
|
|
141
145
|
|
|
142
146
|
```ts
|
|
143
|
-
import {ConeEmitter, Quaternion, ShapeTransform, Vector2, Vector3} from 'quarks
|
|
147
|
+
import {ConeEmitter, Quaternion, ShapeTransform, Vector2, Vector3} from 'babylon.quarks';
|
|
144
148
|
|
|
145
149
|
const system = new ParticleSystem({
|
|
146
150
|
// Shape module Position / Rotation / Scale: spawn points and start directions go through it.
|
|
@@ -176,7 +180,7 @@ QuarksUtil.addToBatchRenderer(effect, batchRenderer);
|
|
|
176
180
|
QuarksUtil.play(effect);
|
|
177
181
|
```
|
|
178
182
|
|
|
179
|
-
See the [examples app](https://github.com/Soullnik/babylon.quarks-standalone/tree/main/examples) in the monorepo for
|
|
183
|
+
See the [examples app](https://github.com/Soullnik/babylon.quarks-standalone/tree/main/examples) in the monorepo for 24 interactive demos and usage patterns.
|
|
180
184
|
|
|
181
185
|
## Links
|
|
182
186
|
|