gaussian-splat-lite 1.3.2 → 1.4.1

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +36 -2
  2. package/CONTRIBUTING.md +14 -2
  3. package/NOTICE +11 -3
  4. package/README.md +5 -7
  5. package/THIRD_PARTY_LICENSES.md +64 -6
  6. package/bin/build-lod.js +241 -0
  7. package/bin/decoder/decoder.js +340 -0
  8. package/bin/decoder/decoder_bg.wasm +0 -0
  9. package/bin/rad/grid.js +620 -0
  10. package/bin/rad/heap.js +270 -0
  11. package/bin/rad/input.js +87 -0
  12. package/bin/rad/lod.js +657 -0
  13. package/bin/rad/math.js +166 -0
  14. package/bin/rad/parallel.js +578 -0
  15. package/bin/rad/progress.js +50 -0
  16. package/bin/rad/rad.js +612 -0
  17. package/bin/rad/splats.js +432 -0
  18. package/bin/rad/storage.js +776 -0
  19. package/dist/gaussian-splat-lite.cjs +392 -794
  20. package/dist/gaussian-splat-lite.cjs.map +1 -1
  21. package/dist/gaussian-splat-lite.min.cjs +246 -308
  22. package/dist/gaussian-splat-lite.min.cjs.map +1 -1
  23. package/dist/gaussian-splat-lite.module.js +394 -796
  24. package/dist/gaussian-splat-lite.module.js.map +1 -1
  25. package/dist/gaussian-splat-lite.module.min.js +2518 -2802
  26. package/dist/gaussian-splat-lite.module.min.js.map +1 -1
  27. package/dist/types/addons/NeuralDenoiseNode.d.cts +1 -2
  28. package/dist/types/addons/NeuralDenoiseNode.d.ts +1 -2
  29. package/dist/types/addons/NeuralDenoiseXR.d.cts +31 -0
  30. package/dist/types/addons/NeuralDenoiseXR.d.ts +31 -0
  31. package/dist/types/addons/neuralDenoiseState.d.cts +22 -0
  32. package/dist/types/addons/neuralDenoiseState.d.ts +22 -0
  33. package/dist/types/addons/neuralDenoiseWeights.d.cts +41 -2
  34. package/dist/types/addons/neuralDenoiseWeights.d.ts +41 -2
  35. package/dist/types/data/RadPagedSplats.d.cts +1 -1
  36. package/dist/types/data/RadPagedSplats.d.ts +1 -1
  37. package/dist/types/index.d.cts +1 -2
  38. package/dist/types/index.d.ts +1 -2
  39. package/dist/types/loaders/rad/radFormat.d.cts +2 -2
  40. package/dist/types/loaders/rad/radFormat.d.ts +2 -2
  41. package/docs/BuildRad.md +91 -0
  42. package/docs/GaussianSplatRenderer.md +2 -2
  43. package/docs/NeuralDenoiseNode.md +32 -13
  44. package/docs/RadStreamScheduler.md +3 -1
  45. package/docs/StochasticRendering.md +20 -42
  46. package/package.json +9 -3
  47. package/dist/types/addons/TAANode.d.cts +0 -49
  48. package/dist/types/addons/TAANode.d.ts +0 -49
  49. package/dist/types/addons/TAAPass.d.cts +0 -57
  50. package/dist/types/addons/TAAPass.d.ts +0 -57
  51. package/dist/types/addons/taaShared.d.cts +0 -74
  52. package/dist/types/addons/taaShared.d.ts +0 -74
  53. package/docs/TAAPass.md +0 -184
package/docs/TAAPass.md DELETED
@@ -1,184 +0,0 @@
1
- # TAAPass and TAANode
2
-
3
- [Back to documentation](../README.md#documentation)
4
-
5
- Temporal anti-aliasing (TAA) blends each frame with the ones before it. It smooths edges and the noise of [stochastic rendering](StochasticRendering.md). Use the version that matches your renderer:
6
-
7
- | Renderer | Use |
8
- | --- | --- |
9
- | `WebGLRenderer` | [`TAAPass`](#taapass-webglrenderer) with `EffectComposer` |
10
- | `WebGPURenderer`, on WebGPU or its WebGL2 fallback | [`TAANode`](#taanode-webgpurenderer) with `RenderPipeline` |
11
-
12
- Both render the scene themselves and need no velocity buffer or other scene setup.
13
-
14
- ## MSAA
15
-
16
- The third constructor argument, `msaa`, enables 4× MSAA with `true` or disables it with `false` (default):
17
-
18
- ```js
19
- const taa = new TAANode(scene, camera, true);
20
- // With WebGLRenderer: new TAAPass(scene, camera, true).
21
- // MSAA is disabled when the argument is omitted or false.
22
- ```
23
-
24
- Four samples use the same stochastic coverage as the [experimental neural denoiser](NeuralDenoiseNode.md): one scene render into a 4× MSAA target, followed by the usual TAA accumulation. This reduces input noise with higher GPU time and memory use. History targets remain single-sampled, and moving objects are still not tracked.
25
-
26
- On WebGL2, including the WebGL fallback, MSAA requires `OES_sample_variables`. Check `renderer.getContext().getExtension("OES_sample_variables")` before enabling MSAA; leave it disabled when the extension is unavailable. Unsupported configurations throw an error. The MSAA setting is fixed for the node or pass's lifetime; dispose it and create another to change it.
27
-
28
- ## Before you start
29
-
30
- - **One camera.** A `PerspectiveCamera` or `OrthographicCamera`, including custom projections, scaled camera rigs, reversed depth, and logarithmic depth. WebXR is not supported.
31
- - **Camera movement only.** Moving objects and changes to individual Splats are not tracked, and may leave a faint trail. Try the [experimental neural denoiser](NeuralDenoiseNode.md) to help reduce these trails.
32
- - **Stencil follows your renderer.** Create the Three.js renderer with `stencil: true` and stencil masks work as they do without TAA, including the stencil settings on your Splat renderer's `material`.
33
- - **Reset after a jump.** Call `taa.reset()` after a camera cut or after replacing the scene. Resizing resets automatically.
34
- - **Keep rendering while the image settles.** With on-demand rendering, render several more frames after each change.
35
-
36
- ## TAAPass (WebGLRenderer)
37
-
38
- This example assumes an existing `renderer`, `scene`, and `camera`. `TAAPass` takes the place of `RenderPass`, and Three.js's `OutputPass` finishes the image for display.
39
-
40
- ```js
41
- import { TAAPass } from "gaussian-splat-lite";
42
- import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
43
- import { OutputPass } from "three/addons/postprocessing/OutputPass.js";
44
-
45
- const taa = new TAAPass(scene, camera);
46
- const output = new OutputPass();
47
- const composer = new EffectComposer(renderer);
48
- composer.addPass(taa);
49
- composer.addPass(output);
50
-
51
- renderer.setAnimationLoop(() => {
52
- // Update controls / animation here.
53
- composer.render();
54
- });
55
-
56
- // On resize: update the renderer size and camera projection,
57
- // then call composer.setSize(width, height) in CSS pixels.
58
- // On a camera cut or scene replacement: taa.reset().
59
- // On cleanup:
60
- // renderer.setAnimationLoop(null);
61
- // composer.dispose();
62
- // output.dispose();
63
- // taa.dispose();
64
- ```
65
-
66
- Dispose the passes as well as the composer when you are done.
67
-
68
- ### Add effects
69
-
70
- Insert Bloom and similar effects between `TAAPass` and `OutputPass`:
71
-
72
- ```js
73
- import { Vector2 } from "three";
74
- import { UnrealBloomPass } from "three/addons/postprocessing/UnrealBloomPass.js";
75
-
76
- const bloom = new UnrealBloomPass(
77
- renderer.getSize(new Vector2()), 0.6, 0.4, 0.8,
78
- );
79
- composer.insertPass(bloom, 1);
80
- // On cleanup: bloom.dispose().
81
- ```
82
-
83
- The order is `TAAPass → effects → OutputPass`. Effects work on the smoothed image.
84
-
85
- ### Use depth in effects
86
-
87
- `taa.depthTexture` gives later effects the scene depth of the current frame. Set it up once when building the chain:
88
-
89
- ```js
90
- depthEffect.uniforms.tDepth.value = taa.depthTexture;
91
- depthEffect.uniforms.captureProjection.value = taa.projectionMatrix;
92
-
93
- const composer = new EffectComposer(renderer);
94
- composer.addPass(taa);
95
- composer.addPass(depthEffect);
96
- composer.addPass(new OutputPass());
97
- ```
98
-
99
- Here `depthEffect` is your own pass that reads those uniforms. Both objects stay the same across frames and resizes.
100
-
101
- This depth is not smoothed, and it is rendered with a small per-frame camera offset. Convert it with `taa.projectionMatrix`, not `camera.projectionMatrix`. Treat both as read-only.
102
-
103
- ### Render to your own target
104
-
105
- To get the smoothed image offscreen, pass a render target; the pass follows the target's size:
106
-
107
- ```js
108
- taa.render(renderer, target);
109
- ```
110
-
111
- The result is in the working color space, without tone mapping. Calling `taa.render(renderer)` without a target is not supported; use `EffectComposer` to draw to the screen.
112
-
113
- ## TAANode (WebGPURenderer)
114
-
115
- Use this setup on both WebGPU and the WebGL2 fallback, after `await renderer.init()`:
116
-
117
- ```js
118
- import { TAANode } from "gaussian-splat-lite";
119
- import { RenderPipeline } from "three/webgpu";
120
-
121
- const taa = new TAANode(scene, camera);
122
- const pipeline = new RenderPipeline(renderer, taa);
123
-
124
- renderer.setAnimationLoop(() => {
125
- // Update controls / animation here.
126
- pipeline.render();
127
- });
128
-
129
- // On a camera cut or scene replacement: taa.reset().
130
- // On cleanup: pipeline.dispose(); taa.dispose();
131
- ```
132
-
133
- The pipeline follows the renderer's size by itself.
134
-
135
- Chain effects from the node or from `taa.getTextureNode()`. For Bloom, create the pipeline like this instead:
136
-
137
- ```js
138
- import { bloom } from "three/addons/tsl/display/BloomNode.js";
139
-
140
- const color = taa.getTextureNode();
141
- const pipeline = new RenderPipeline(renderer, color.add(bloom(color, 0.6, 0.4, 0.8)));
142
- ```
143
-
144
- `TAANode` has the same `depthTexture`, `projectionMatrix`, and tuning properties as `TAAPass`.
145
-
146
- With four samples on native WebGPU, `depthTexture` is multisampled. Read it with TSL `texture(taa.depthTexture).load(pixel)` to select sample 0, as TAA does internally; filtered depth sampling is not supported. Both WebGL paths expose resolved, single-sampled depth.
147
-
148
- ## Color and tone mapping
149
-
150
- **`TAAPass`** shows Splats with the same colors as `WebGLRenderer` drawing straight to the canvas.
151
-
152
- - `OutputPass` applies the renderer's tone mapping and exposure to the whole image, Splats included. Drawing straight to the canvas does not tone-map Splats.
153
- - If `TAAPass` is the last enabled pass, it shows its image as it is, without tone mapping.
154
- - On a transparent canvas, tone mapping and effects are approximate where pixels are partly transparent. Opaque pixels are unaffected.
155
-
156
- **`TAANode`** follows `WebGPURenderer`'s color handling: `RenderPipeline` applies tone mapping and the output color space at the end. With Three.js's default linear working color space, partly transparent Splats look slightly brighter than on `WebGLRenderer`.
157
-
158
- Both keep colors brighter than white, so effects such as Bloom work as expected. Changing the renderer's output color space with `TAAPass`, or Three.js's working color space with `TAANode`, restarts the smoothing.
159
-
160
- ## Properties
161
-
162
- | Property | Default | Description |
163
- | --- | --- | --- |
164
- | `scene` | Constructor scene | Scene to render; call `reset()` when replacing it |
165
- | `camera` | Constructor camera | Camera to render with; call `reset()` when replacing it |
166
- | `msaa` | `false` | Read-only. Whether 4× MSAA is enabled, selected in the constructor |
167
- | `depthTexture` | Read-only | Scene depth of the current frame |
168
- | `projectionMatrix` | Read-only | Projection that matches `depthTexture` |
169
- | `depthThreshold` | `0.0005` | Depth change above which a pixel's earlier frames are discarded |
170
- | `edgeDepthDiff` | `0.001` | Depth difference between neighboring pixels that marks an edge. Edges are exempt from `depthThreshold` |
171
- | `maxMotionLength` | `128` | Camera movement, in pixels, at which earlier frames are ignored entirely |
172
- | `useSubpixelCorrection` | `true` | Give the current frame more weight during very small camera movements |
173
-
174
- The defaults suit most scenes. `TAAPass` also has the standard Three.js `Pass` properties.
175
-
176
- ## Methods
177
-
178
- | Method | Description |
179
- | --- | --- |
180
- | `reset()` | Discard earlier frames and start smoothing again |
181
- | `dispose()` | Release the resources it holds. The scene is not disposed |
182
- | `setSize(width, height)` | Resize in physical pixels. Called for you; a size change resets |
183
- | `render(renderer, target)` | `TAAPass` only. Called for you by `EffectComposer` |
184
- | `getTextureNode()` | `TAANode` only. The smoothed image, for chaining effects |