babylon.quarks 0.17.4 → 0.17.7
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 +103 -0
- package/LICENSE +21 -21
- package/README.md +169 -33
- 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 +2 -0
- package/dist/babylon.quarks.umd.min.js.map +1 -0
- package/dist/types/index.d.ts +2829 -19
- package/package.json +62 -60
- package/src/BatchedParticleRenderer.ts +3 -3
- package/src/BatchedRenderer.ts +228 -227
- package/src/MeshSurfaceEmitter.ts +137 -137
- package/src/ParticleEmitter.ts +86 -86
- package/src/ParticleSystem.ts +1322 -1285
- package/src/QuarksLoader.ts +529 -510
- package/src/QuarksPrefab.ts +307 -307
- package/src/QuarksUtil.ts +66 -66
- package/src/SpriteBatch.ts +403 -404
- package/src/TrailBatch.ts +420 -419
- package/src/VFXBatch.ts +108 -108
- package/src/geometryUtil.ts +15 -15
- package/src/index.ts +59 -52
- package/src/materials/ParticleMaterials.ts +23 -23
- package/src/materials/index.ts +1 -1
- package/src/shaders/chunks/index.ts +1 -1
- package/src/shaders/chunks/register-shader-chunks.ts +32 -32
- package/src/shaders/chunks/soft_fragment.glsl.ts +13 -13
- package/src/shaders/chunks/soft_pars_fragment.glsl.ts +20 -20
- package/src/shaders/chunks/soft_pars_vertex.glsl.ts +6 -6
- package/src/shaders/chunks/soft_vertex.glsl.ts +6 -6
- package/src/shaders/chunks/tile_fragment.glsl.ts +9 -9
- package/src/shaders/chunks/tile_pars_fragment.glsl.ts +9 -9
- package/src/shaders/chunks/tile_pars_vertex.glsl.ts +28 -28
- package/src/shaders/chunks/tile_vertex.glsl.ts +18 -18
- package/src/shaders/index.ts +9 -9
- package/src/shaders/local_particle_physics_vert.glsl.ts +79 -79
- package/src/shaders/local_particle_vert.glsl.ts +50 -50
- package/src/shaders/particle_frag.glsl.ts +61 -61
- package/src/shaders/particle_physics_frag.glsl.ts +67 -67
- package/src/shaders/particle_vert.glsl.ts +85 -85
- package/src/shaders/stretched_bb_particle_vert.glsl.ts +76 -74
- package/src/shaders/trail_frag.glsl.ts +21 -21
- package/src/shaders/trail_vert.glsl.ts +58 -58
- package/dist/types/BatchedParticleRenderer.d.ts +0 -2
- package/dist/types/BatchedRenderer.d.ts +0 -59
- package/dist/types/MeshSurfaceEmitter.d.ts +0 -19
- package/dist/types/ParticleEmitter.d.ts +0 -16
- package/dist/types/ParticleSystem.d.ts +0 -234
- package/dist/types/QuarksLoader.d.ts +0 -28
- package/dist/types/QuarksPrefab.d.ts +0 -48
- package/dist/types/QuarksUtil.d.ts +0 -14
- package/dist/types/SpriteBatch.d.ts +0 -33
- package/dist/types/TrailBatch.d.ts +0 -28
- package/dist/types/VFXBatch.d.ts +0 -51
- package/dist/types/geometryUtil.d.ts +0 -2
- package/dist/types/materials/ParticleMaterials.d.ts +0 -12
- package/dist/types/materials/index.d.ts +0 -1
- package/dist/types/shaders/chunks/index.d.ts +0 -1
- package/dist/types/shaders/chunks/register-shader-chunks.d.ts +0 -3
- package/dist/types/shaders/chunks/soft_fragment.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/soft_pars_fragment.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/soft_pars_vertex.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/soft_vertex.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/tile_fragment.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/tile_pars_fragment.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/tile_pars_vertex.glsl.d.ts +0 -2
- package/dist/types/shaders/chunks/tile_vertex.glsl.d.ts +0 -2
- package/dist/types/shaders/index.d.ts +0 -9
- package/dist/types/shaders/local_particle_physics_vert.glsl.d.ts +0 -2
- package/dist/types/shaders/local_particle_vert.glsl.d.ts +0 -2
- package/dist/types/shaders/particle_frag.glsl.d.ts +0 -2
- package/dist/types/shaders/particle_physics_frag.glsl.d.ts +0 -2
- package/dist/types/shaders/particle_vert.glsl.d.ts +0 -2
- package/dist/types/shaders/stretched_bb_particle_vert.glsl.d.ts +0 -2
- package/dist/types/shaders/trail_frag.glsl.d.ts +0 -2
- package/dist/types/shaders/trail_vert.glsl.d.ts +0 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `babylon.quarks` package are documented here.
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
|
+
and the project follows the `quarks.core` 0.x version line.
|
|
6
|
+
|
|
7
|
+
## [0.17.7] — 2026-07-09
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Docs reframed around the in-house `babylon.quarks-editor` effect editor and the Unity
|
|
12
|
+
exporter as the primary authoring workflows, instead of the external quarks.art editor
|
|
13
|
+
(quarks.art-exported JSON still loads fine — same format).
|
|
14
|
+
- `babylon.quarks-editor`'s README now documents the `resolveTexture`/`resolveGeometry` host
|
|
15
|
+
callbacks: their per-entry-point signatures (`EffectEditorHost`/`Show()` pass a `Scene` second
|
|
16
|
+
argument, the bare `EffectEditor` component does not) and what happens when they're omitted.
|
|
17
|
+
|
|
18
|
+
## [0.17.5] — 2026-07-02
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- UMD/CDN bundle `dist/babylon.quarks.umd.min.js` exposing the `BabylonQuarks` global —
|
|
23
|
+
usable in the Babylon.js Playground and plain `<script>` setups. `quarks.core` is bundled in;
|
|
24
|
+
`@babylonjs/core` maps to the `BABYLON` global. `unpkg`/`jsdelivr` fields point to it.
|
|
25
|
+
- WebGPU support validated: all render modes (billboard, stretched billboard, mesh, trail)
|
|
26
|
+
create pipelines under `WebGPUEngine` with zero validation errors (GLSL is transpiled to WGSL
|
|
27
|
+
by Babylon automatically). Documented in the README.
|
|
28
|
+
- Exported types that the public API referenced but did not export:
|
|
29
|
+
`AdaptivePerformanceOptions`, `AdaptivePerformanceState`, `ParticleSystemJSONParameters`,
|
|
30
|
+
`BabylonMetaData`, `AnimationData`, `QuarksTimelineClip`, `BurstParametersJSON`.
|
|
31
|
+
- API documentation generated with TypeDoc, published at
|
|
32
|
+
<https://soullnik.github.io/babylon.quarks-standalone/docs/>.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- `SpriteBatch` and `QuarksLoader` pass typed arrays to Babylon `VertexData` directly instead
|
|
37
|
+
of copying them through `Array.from`.
|
|
38
|
+
- `BatchedRenderer` internals use typed `ParticleSystem` narrowing instead of `as any` casts
|
|
39
|
+
(public signatures unchanged).
|
|
40
|
+
|
|
41
|
+
### CI
|
|
42
|
+
|
|
43
|
+
- npm publishing switched to trusted publishing (OIDC) with provenance.
|
|
44
|
+
|
|
45
|
+
## [0.17.4] — 2026-05-15
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
|
|
49
|
+
- `QuarksLoader` test coverage reworked; demo application restructured (new demos, hero
|
|
50
|
+
background). No functional changes to the package runtime.
|
|
51
|
+
|
|
52
|
+
## [0.17.3] — 2026-05-13
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- Adaptive performance budget controls on `BatchedRenderer`
|
|
57
|
+
(`configureAdaptivePerformance` / `disableAdaptivePerformance` / `getAdaptivePerformanceState`)
|
|
58
|
+
with per-system quality scaling.
|
|
59
|
+
|
|
60
|
+
### Performance
|
|
61
|
+
|
|
62
|
+
- Tightened particle system update and spawn loops.
|
|
63
|
+
- Reduced hot-path allocations in renderer batches.
|
|
64
|
+
- Fast trail history ring buffers for trail rendering.
|
|
65
|
+
|
|
66
|
+
### Tests
|
|
67
|
+
|
|
68
|
+
- Extensive coverage expansion (sprite/trail batch integration, particle system, loader,
|
|
69
|
+
prefab and utility paths) with enforced coverage thresholds.
|
|
70
|
+
|
|
71
|
+
## [0.17.2] — 2026-05-11
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
- `QuarksLoader` marks sub-emitter systems as `onlyUsedByOther` after UUID resolution.
|
|
76
|
+
- Custom blending mode handling refined.
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- Tile blending support in shaders (additional UV calculations).
|
|
81
|
+
|
|
82
|
+
## [0.17.1] — 2026-05-11
|
|
83
|
+
|
|
84
|
+
### Changed
|
|
85
|
+
|
|
86
|
+
- Packaging setup for the standalone monorepo (README shipped with the package,
|
|
87
|
+
tarball content checks).
|
|
88
|
+
|
|
89
|
+
## [0.17.0] — 2026-05-11
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
|
|
93
|
+
- Initial public release: a high-performance batched particle system for Babylon.js built on
|
|
94
|
+
`quarks.core` — batched sprite/trail rendering, billboard/stretched/mesh/trail render modes,
|
|
95
|
+
soft particles, texture tile animation, sub-emitters, mesh surface emitter plugin,
|
|
96
|
+
`QuarksLoader` for quarks.art / Unity-exported JSON, `QuarksUtil` helpers.
|
|
97
|
+
|
|
98
|
+
[0.17.5]: https://github.com/Soullnik/babylon.quarks-standalone/releases/tag/v0.17.5
|
|
99
|
+
[0.17.4]: https://www.npmjs.com/package/babylon.quarks/v/0.17.4
|
|
100
|
+
[0.17.3]: https://www.npmjs.com/package/babylon.quarks/v/0.17.3
|
|
101
|
+
[0.17.2]: https://www.npmjs.com/package/babylon.quarks/v/0.17.2
|
|
102
|
+
[0.17.1]: https://www.npmjs.com/package/babylon.quarks/v/0.17.1
|
|
103
|
+
[0.17.0]: https://www.npmjs.com/package/babylon.quarks/v/0.17.0
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 soullnik
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 soullnik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,33 +1,169 @@
|
|
|
1
|
-
# babylon.quarks
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
# babylon.quarks
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/babylon.quarks)
|
|
4
|
+
[](https://github.com/Soullnik/babylon.quarks-standalone/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/Soullnik/babylon.quarks-standalone/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
High-performance particle system for [Babylon.js](https://www.babylonjs.com/). Built on `quarks.core` (historically derived from [quarks.art](https://quarks.art/) / three.quarks).
|
|
8
|
+
|
|
9
|
+
[**Live demos**](https://soullnik.github.io/babylon.quarks-standalone/)
|
|
10
|
+
|
|
11
|
+
| | | | |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#MuzzleFlashDemo) | [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#ExplosionDemo) | [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#TrailDemo) | [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#SubEmitterDemo) |
|
|
14
|
+
| [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#ElectricBallDemo) | [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#BlackHoleDemo) | [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#SoftParticleDemo) | [](https://soullnik.github.io/babylon.quarks-standalone/babylonDemo.html#LevelUpDemo) |
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Batched rendering** — heterogeneous particle systems share draw calls via `BatchedRenderer`.
|
|
19
|
+
- **Render modes** — billboard, vertical/horizontal billboard, stretched billboard, mesh particles, and **trails** (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, and more from `quarks.core`).
|
|
21
|
+
- **Soft particles**, texture tile animation with blending, custom blend functions.
|
|
22
|
+
- **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
|
+
- **Cross-engine format** — the same effect JSON runs in three.js (three.quarks) and Babylon.js.
|
|
24
|
+
- **Adaptive performance** — optional frame-budget quality scaling built into `BatchedRenderer`.
|
|
25
|
+
- **WebGL and WebGPU** — runs on both Babylon engines; shaders are transpiled to WGSL automatically.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install babylon.quarks @babylonjs/core
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Peer dependency: `@babylonjs/core` >= 9.
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import {Constants} from "@babylonjs/core/Engines/constants";
|
|
39
|
+
import {
|
|
40
|
+
BatchedRenderer,
|
|
41
|
+
ParticleSystem,
|
|
42
|
+
PointEmitter,
|
|
43
|
+
RenderMode,
|
|
44
|
+
ConstantValue,
|
|
45
|
+
IntervalValue,
|
|
46
|
+
ConstantColor,
|
|
47
|
+
Vector4,
|
|
48
|
+
} from "babylon.quarks";
|
|
49
|
+
|
|
50
|
+
// One renderer per scene; it batches all systems added to it.
|
|
51
|
+
const batchRenderer = new BatchedRenderer("particles", scene);
|
|
52
|
+
|
|
53
|
+
const system = new ParticleSystem({
|
|
54
|
+
scene,
|
|
55
|
+
duration: 5,
|
|
56
|
+
looping: true,
|
|
57
|
+
startLife: new IntervalValue(4, 5),
|
|
58
|
+
startSpeed: new ConstantValue(1),
|
|
59
|
+
startSize: new IntervalValue(1, 2),
|
|
60
|
+
startColor: new ConstantColor(new Vector4(1, 1, 1, 1)),
|
|
61
|
+
emissionOverTime: new ConstantValue(20),
|
|
62
|
+
shape: new PointEmitter(),
|
|
63
|
+
renderMode: RenderMode.BillBoard,
|
|
64
|
+
texture: myParticleTexture,
|
|
65
|
+
transparent: true,
|
|
66
|
+
blendMode: Constants.ALPHA_COMBINE,
|
|
67
|
+
});
|
|
68
|
+
batchRenderer.addSystem(system);
|
|
69
|
+
|
|
70
|
+
// Advance the simulation every frame:
|
|
71
|
+
scene.onBeforeRenderObservable.add(() => {
|
|
72
|
+
batchRenderer.update(scene.getEngine().getDeltaTime() / 1000);
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Use in the Babylon.js Playground
|
|
77
|
+
|
|
78
|
+
The package ships a UMD bundle (`dist/babylon.quarks.umd.min.js`, exposed as the `BabylonQuarks` global) that can be loaded straight from a CDN — no build step needed. Paste this into the [Playground](https://playground.babylonjs.com/):
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
var createScene = async function () {
|
|
82
|
+
var scene = new BABYLON.Scene(engine);
|
|
83
|
+
var camera = new BABYLON.ArcRotateCamera("cam", -Math.PI / 2, 1.2, 10, BABYLON.Vector3.Zero(), scene);
|
|
84
|
+
camera.attachControl(canvas, true);
|
|
85
|
+
|
|
86
|
+
await BABYLON.Tools.LoadScriptAsync("https://cdn.jsdelivr.net/npm/babylon.quarks/dist/babylon.quarks.umd.min.js");
|
|
87
|
+
const Q = BabylonQuarks;
|
|
88
|
+
|
|
89
|
+
const batchRenderer = new Q.BatchedRenderer("particles", scene);
|
|
90
|
+
const system = new Q.ParticleSystem({
|
|
91
|
+
scene,
|
|
92
|
+
duration: 5,
|
|
93
|
+
looping: true,
|
|
94
|
+
startLife: new Q.IntervalValue(2, 3),
|
|
95
|
+
startSpeed: new Q.ConstantValue(2),
|
|
96
|
+
startSize: new Q.IntervalValue(0.5, 1),
|
|
97
|
+
startColor: new Q.ConstantColor(new Q.Vector4(1, 0.6, 0.2, 1)),
|
|
98
|
+
emissionOverTime: new Q.ConstantValue(60),
|
|
99
|
+
shape: new Q.ConeEmitter({radius: 0.3, angle: 0.4}),
|
|
100
|
+
renderMode: Q.RenderMode.BillBoard,
|
|
101
|
+
texture: new BABYLON.Texture("textures/flare.png", scene),
|
|
102
|
+
transparent: true,
|
|
103
|
+
blendMode: BABYLON.Constants.ALPHA_ADD,
|
|
104
|
+
});
|
|
105
|
+
batchRenderer.addSystem(system);
|
|
106
|
+
|
|
107
|
+
scene.onBeforeRenderObservable.add(() => {
|
|
108
|
+
batchRenderer.update(engine.getDeltaTime() / 1000);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return scene;
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The same bundle works in any plain `<script>` setup alongside the global `babylon.js` build:
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<script src="https://cdn.babylonjs.com/babylon.js"></script>
|
|
119
|
+
<script src="https://cdn.jsdelivr.net/npm/babylon.quarks/dist/babylon.quarks.umd.min.js"></script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## WebGPU
|
|
123
|
+
|
|
124
|
+
The library runs on Babylon's `WebGPUEngine` — its GLSL shaders are transpiled to WGSL automatically by Babylon (glslang/twgsl are fetched by Babylon on engine init). Everything except engine creation stays the same:
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import {WebGPUEngine} from "@babylonjs/core/Engines/webgpuEngine";
|
|
128
|
+
import "@babylonjs/core/Engines/WebGPU/Extensions/index";
|
|
129
|
+
|
|
130
|
+
const engine = new WebGPUEngine(canvas, {antialias: true});
|
|
131
|
+
await engine.initAsync();
|
|
132
|
+
// Scene + BatchedRenderer setup is identical to WebGL.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
All render modes (billboard, stretched billboard, mesh, trail) are validated to create WebGPU pipelines with zero validation errors. 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
|
+
|
|
137
|
+
## Author & load effects
|
|
138
|
+
|
|
139
|
+
Design an effect with one of these tools, then load the exported JSON with `QuarksLoader`:
|
|
140
|
+
|
|
141
|
+
- **[Effect editor](https://soullnik.github.io/babylon.quarks-standalone/editor.html)** — our in-house Shuriken-style editor ([`babylon.quarks-editor`](https://www.npmjs.com/package/babylon.quarks-editor), embeddable in your own app).
|
|
142
|
+
- **[Unity exporter](https://github.com/Soullnik/babylon.quarks-standalone/tree/main/tools/unity-quarks-exporter)** — a Unity Editor tool that exports Shuriken Particle Systems to the same JSON format.
|
|
143
|
+
- **quarks.art** — effects exported from the [quarks.art](https://quarks.art/) editor also load fine, since it's the same JSON envelope.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import {BatchedRenderer, QuarksLoader, QuarksUtil} from "babylon.quarks";
|
|
147
|
+
|
|
148
|
+
const batchRenderer = new BatchedRenderer("particles", scene);
|
|
149
|
+
const loader = new QuarksLoader(scene);
|
|
150
|
+
const effect = await loader.load("effects/explosion.json");
|
|
151
|
+
QuarksUtil.addToBatchRenderer(effect, batchRenderer);
|
|
152
|
+
QuarksUtil.play(effect);
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
See the [examples app](https://github.com/Soullnik/babylon.quarks-standalone/tree/main/examples) in the monorepo for 18 interactive demos and usage patterns.
|
|
156
|
+
|
|
157
|
+
## Links
|
|
158
|
+
|
|
159
|
+
- [API documentation](https://soullnik.github.io/babylon.quarks-standalone/docs/)
|
|
160
|
+
- [Changelog](https://github.com/Soullnik/babylon.quarks-standalone/blob/main/packages/babylon.quarks/CHANGELOG.md)
|
|
161
|
+
- [Contributing](https://github.com/Soullnik/babylon.quarks-standalone/blob/main/CONTRIBUTING.md)
|
|
162
|
+
- [npm package](https://www.npmjs.com/package/babylon.quarks)
|
|
163
|
+
- [Source (monorepo)](https://github.com/Soullnik/babylon.quarks-standalone/tree/main/packages/babylon.quarks)
|
|
164
|
+
- [Roadmap](https://github.com/Soullnik/babylon.quarks-standalone/blob/main/ROADMAP.md)
|
|
165
|
+
- [Issues](https://github.com/Soullnik/babylon.quarks-standalone/issues)
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
MIT
|