gaussian-splat-lite 1.2.0 → 1.2.2
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 +44 -2
- package/README.md +22 -13
- package/dist/gaussian-splat-lite.cjs +819 -88
- package/dist/gaussian-splat-lite.cjs.map +1 -1
- package/dist/gaussian-splat-lite.min.cjs +81 -20
- package/dist/gaussian-splat-lite.min.cjs.map +1 -1
- package/dist/gaussian-splat-lite.module.js +821 -90
- package/dist/gaussian-splat-lite.module.js.map +1 -1
- package/dist/gaussian-splat-lite.module.min.js +2984 -2427
- package/dist/gaussian-splat-lite.module.min.js.map +1 -1
- package/dist/types/addons/TAANode.d.cts +4 -2
- package/dist/types/addons/TAANode.d.ts +4 -2
- package/dist/types/addons/TAAPass.d.cts +6 -15
- package/dist/types/addons/TAAPass.d.ts +6 -15
- package/dist/types/addons/taaShared.d.cts +4 -2
- package/dist/types/addons/taaShared.d.ts +4 -2
- package/dist/types/capture/SplatCapture.d.cts +66 -0
- package/dist/types/capture/SplatCapture.d.ts +66 -0
- package/dist/types/capture/WebGLCapture.d.cts +13 -0
- package/dist/types/capture/WebGLCapture.d.ts +13 -0
- package/dist/types/capture/WebGPUCapture.d.cts +17 -0
- package/dist/types/capture/WebGPUCapture.d.ts +17 -0
- package/dist/types/capture/pixels.d.cts +5 -0
- package/dist/types/capture/pixels.d.ts +5 -0
- package/dist/types/capture/rendererState.d.cts +3 -0
- package/dist/types/capture/rendererState.d.ts +3 -0
- package/dist/types/capture/sceneView.d.cts +3 -0
- package/dist/types/capture/sceneView.d.ts +3 -0
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/rendering/GaussianSplatRenderer.d.cts +17 -11
- package/dist/types/rendering/GaussianSplatRenderer.d.ts +17 -11
- package/dist/types/rendering/SplatAccumulator.d.cts +2 -1
- package/dist/types/rendering/SplatAccumulator.d.ts +2 -1
- package/dist/types/rendering/backend.d.cts +1 -1
- package/dist/types/rendering/backend.d.ts +1 -1
- package/dist/types/rendering/rendererUtils.d.cts +1 -5
- package/dist/types/rendering/rendererUtils.d.ts +1 -5
- package/dist/types/rendering/tsl/ProjectionProgram.d.cts +2 -0
- package/dist/types/rendering/tsl/ProjectionProgram.d.ts +2 -0
- package/dist/types/rendering/tsl/SplatMaterial.d.cts +1 -0
- package/dist/types/rendering/tsl/SplatMaterial.d.ts +1 -0
- package/dist/types/rendering/tsl/tslCompat.d.cts +1 -0
- package/dist/types/rendering/tsl/tslCompat.d.ts +1 -0
- package/dist/types/rendering/uniforms.d.cts +3 -3
- package/dist/types/rendering/uniforms.d.ts +3 -3
- package/dist/types/scene/SplatMesh.d.cts +1 -1
- package/dist/types/scene/SplatMesh.d.ts +1 -1
- package/docs/Architecture.md +54 -3
- package/docs/GaussianSplatRenderer.md +71 -55
- package/docs/PostDecode.md +52 -36
- package/docs/RadStreamScheduler.md +53 -41
- package/docs/SogStreamScheduler.md +49 -39
- package/docs/SplatCapture.md +147 -0
- package/docs/SplatEdit.md +33 -26
- package/docs/SplatFileType.md +11 -13
- package/docs/SplatLoader.md +19 -14
- package/docs/SplatMesh.md +69 -49
- package/docs/Splats.md +33 -26
- package/docs/StochasticRendering.md +27 -30
- package/docs/TAAPass.md +98 -73
- package/package.json +1 -1
- package/docs/SplatAccumulator.md +0 -37
package/docs/TAAPass.md
CHANGED
|
@@ -1,105 +1,104 @@
|
|
|
1
|
-
# TAAPass
|
|
1
|
+
# TAAPass and TAANode
|
|
2
2
|
|
|
3
3
|
[Back to documentation](../README.md#documentation)
|
|
4
4
|
|
|
5
|
-
Temporal anti-aliasing
|
|
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
6
|
|
|
7
|
-
|
|
7
|
+
| Renderer | Use |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `WebGLRenderer` | [`TAAPass`](#taapass-webglrenderer) with `EffectComposer` |
|
|
10
|
+
| `WebGPURenderer`, on WebGPU or its WebGL2 fallback | [`TAANode`](#taanode-webgpurenderer) with `RenderPipeline` |
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Both render the scene themselves and need no velocity buffer or other scene setup.
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
import { TAAPass } from "gaussian-splat-lite";
|
|
14
|
+
## Before you start
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
- **One camera.** A `PerspectiveCamera` or `OrthographicCamera`, including custom projections, scaled camera rigs, reversed depth, and logarithmic depth. WebXR is not supported.
|
|
17
|
+
- **Camera movement only.** Moving objects and changes to individual Splats are not tracked, and may leave a faint trail.
|
|
18
|
+
- **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`.
|
|
19
|
+
- **Reset after a jump.** Call `taa.reset()` after a camera cut or after replacing the scene. Resizing resets automatically.
|
|
20
|
+
- **Keep rendering while the image settles.** With on-demand rendering, render several more frames after each change. The viewer renders 32.
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
## TAAPass (WebGLRenderer)
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
This example assumes an existing `renderer`, `scene`, and `camera`. If smoothing [stochastic rendering](StochasticRendering.md), also set `splatRenderer.stochastic = true`. The repository's `examples/viewer/viewerTAA.js` uses this same setup.
|
|
24
|
+
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.
|
|
22
25
|
|
|
23
26
|
```js
|
|
24
27
|
import { TAAPass } from "gaussian-splat-lite";
|
|
28
|
+
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
|
29
|
+
import { OutputPass } from "three/addons/postprocessing/OutputPass.js";
|
|
25
30
|
|
|
26
31
|
const taa = new TAAPass(scene, camera);
|
|
32
|
+
const output = new OutputPass();
|
|
33
|
+
const composer = new EffectComposer(renderer);
|
|
34
|
+
composer.addPass(taa);
|
|
35
|
+
composer.addPass(output);
|
|
27
36
|
|
|
28
37
|
renderer.setAnimationLoop(() => {
|
|
29
38
|
// Update controls / animation here.
|
|
30
|
-
|
|
39
|
+
composer.render();
|
|
31
40
|
});
|
|
32
41
|
|
|
33
|
-
// On resize: update the renderer size and camera projection
|
|
42
|
+
// On resize: update the renderer size and camera projection,
|
|
43
|
+
// then call composer.setSize(width, height) in CSS pixels.
|
|
34
44
|
// On a camera cut or scene replacement: taa.reset().
|
|
35
45
|
// On cleanup:
|
|
36
46
|
// renderer.setAnimationLoop(null);
|
|
47
|
+
// composer.dispose();
|
|
48
|
+
// output.dispose();
|
|
37
49
|
// taa.dispose();
|
|
38
50
|
```
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
The pass follows the canvas size. Call `reset()` after a camera cut or scene replacement; resizing clears history automatically. For on-demand rendering, keep rendering for several frames after each change; the viewer uses 32.
|
|
43
|
-
|
|
44
|
-
### EffectComposer and offscreen rendering
|
|
45
|
-
|
|
46
|
-
For a postprocessing chain, add the pass to an `EffectComposer`:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
|
52
|
+
Dispose the passes as well as the composer when you are done. The repository's `examples/viewer/viewerTAA.js` uses this setup.
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
composer.addPass(taa);
|
|
53
|
-
// Render with composer.render(); update composer.setSize() on resize.
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
`TAAPass` replaces `RenderPass` and follows the composer's size. Its result is ready for display, so do not add `OutputPass` unless using linear effects as described below. Dispose both `taa` and `composer` when finished.
|
|
54
|
+
### Add effects
|
|
57
55
|
|
|
58
|
-
|
|
56
|
+
Insert Bloom and similar effects between `TAAPass` and `OutputPass`:
|
|
59
57
|
|
|
60
58
|
```js
|
|
61
|
-
|
|
59
|
+
import { Vector2 } from "three";
|
|
60
|
+
import { UnrealBloomPass } from "three/addons/postprocessing/UnrealBloomPass.js";
|
|
61
|
+
|
|
62
|
+
const bloom = new UnrealBloomPass(
|
|
63
|
+
renderer.getSize(new Vector2()), 0.6, 0.4, 0.8,
|
|
64
|
+
);
|
|
65
|
+
composer.insertPass(bloom, 1);
|
|
66
|
+
// On cleanup: bloom.dispose().
|
|
62
67
|
```
|
|
63
68
|
|
|
64
|
-
|
|
69
|
+
The order is `TAAPass → effects → OutputPass`. Effects work on the smoothed image.
|
|
65
70
|
|
|
66
|
-
###
|
|
71
|
+
### Use depth in effects
|
|
67
72
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
For Bloom and other linear effects, set `accumulateInOutputSpace = false` and finish the chain with `OutputPass`:
|
|
73
|
+
`taa.depthTexture` gives later effects the scene depth of the current frame. Set it up once when building the chain:
|
|
71
74
|
|
|
72
75
|
```js
|
|
73
|
-
|
|
76
|
+
depthEffect.uniforms.tDepth.value = taa.depthTexture;
|
|
77
|
+
depthEffect.uniforms.captureProjection.value = taa.projectionMatrix;
|
|
74
78
|
|
|
75
|
-
|
|
79
|
+
const composer = new EffectComposer(renderer);
|
|
76
80
|
composer.addPass(taa);
|
|
77
|
-
|
|
81
|
+
composer.addPass(depthEffect);
|
|
78
82
|
composer.addPass(new OutputPass());
|
|
79
83
|
```
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
Here `depthEffect` is your own pass that reads those uniforms. Both objects stay the same across frames and resizes.
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
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.
|
|
84
88
|
|
|
85
|
-
|
|
89
|
+
### Render to your own target
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
depthEffect.uniforms.tDepth.value = taa.depthTexture;
|
|
89
|
-
depthEffect.uniforms.captureProjection.value = taa.projectionMatrix;
|
|
91
|
+
To get the smoothed image offscreen, pass a render target; the pass follows the target's size:
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
composer.addPass(depthEffect);
|
|
93
|
+
```js
|
|
94
|
+
taa.render(renderer, target);
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
The depth is the current frame's raw depth, rendered with camera jitter and not temporally smoothed. Use `taa.projectionMatrix` to decode it, not `camera.projectionMatrix`, which no longer includes the jitter. Treat both as read-only.
|
|
97
|
+
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.
|
|
99
98
|
|
|
100
|
-
## WebGPURenderer
|
|
99
|
+
## TAANode (WebGPURenderer)
|
|
101
100
|
|
|
102
|
-
|
|
101
|
+
Use this setup on both WebGPU and the WebGL2 fallback, after `await renderer.init()`:
|
|
103
102
|
|
|
104
103
|
```js
|
|
105
104
|
import { TAANode } from "gaussian-splat-lite";
|
|
@@ -107,36 +106,62 @@ import { RenderPipeline } from "three/webgpu";
|
|
|
107
106
|
|
|
108
107
|
const taa = new TAANode(scene, camera);
|
|
109
108
|
const pipeline = new RenderPipeline(renderer, taa);
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
|
|
110
|
+
renderer.setAnimationLoop(() => {
|
|
111
|
+
// Update controls / animation here.
|
|
112
|
+
pipeline.render();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// On a camera cut or scene replacement: taa.reset().
|
|
112
116
|
// On cleanup: pipeline.dispose(); taa.dispose();
|
|
113
117
|
```
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
The pipeline follows the renderer's size by itself.
|
|
120
|
+
|
|
121
|
+
Chain effects from the node or from `taa.getTextureNode()`. For Bloom, create the pipeline like this instead:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
import { bloom } from "three/addons/tsl/display/BloomNode.js";
|
|
125
|
+
|
|
126
|
+
const color = taa.getTextureNode();
|
|
127
|
+
const pipeline = new RenderPipeline(renderer, color.add(bloom(color, 0.6, 0.4, 0.8)));
|
|
128
|
+
```
|
|
116
129
|
|
|
117
|
-
`TAANode`
|
|
130
|
+
`TAANode` has the same `depthTexture`, `projectionMatrix`, and tuning properties as `TAAPass`.
|
|
131
|
+
|
|
132
|
+
## Color and tone mapping
|
|
133
|
+
|
|
134
|
+
**`TAAPass`** shows Splats with the same colors as `WebGLRenderer` drawing straight to the canvas.
|
|
135
|
+
|
|
136
|
+
- `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.
|
|
137
|
+
- If `TAAPass` is the last enabled pass, it shows its image as it is, without tone mapping.
|
|
138
|
+
- On a transparent canvas, tone mapping and effects are approximate where pixels are partly transparent. Opaque pixels are unaffected.
|
|
139
|
+
|
|
140
|
+
**`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`.
|
|
141
|
+
|
|
142
|
+
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.
|
|
118
143
|
|
|
119
144
|
## Properties
|
|
120
145
|
|
|
121
146
|
| Property | Default | Description |
|
|
122
147
|
| --- | --- | --- |
|
|
123
|
-
| `scene` | Constructor scene | Scene to render; call `reset()` when replacing it
|
|
124
|
-
| `camera` | Constructor camera | Camera
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
The standard Three.js `Pass` properties, including `enabled` and `renderToScreen`, also apply. `EffectComposer` sets `renderToScreen` for its last enabled pass.
|
|
148
|
+
| `scene` | Constructor scene | Scene to render; call `reset()` when replacing it |
|
|
149
|
+
| `camera` | Constructor camera | Camera to render with; call `reset()` when replacing it |
|
|
150
|
+
| `depthTexture` | Read-only | Scene depth of the current frame |
|
|
151
|
+
| `projectionMatrix` | Read-only | Projection that matches `depthTexture` |
|
|
152
|
+
| `depthThreshold` | `0.0005` | Depth change above which a pixel's earlier frames are discarded |
|
|
153
|
+
| `edgeDepthDiff` | `0.001` | Depth difference between neighboring pixels that marks an edge. Edges are exempt from `depthThreshold` |
|
|
154
|
+
| `maxMotionLength` | `128` | Camera movement, in pixels, at which earlier frames are ignored entirely |
|
|
155
|
+
| `useSubpixelCorrection` | `true` | Give the current frame more weight during very small camera movements |
|
|
156
|
+
|
|
157
|
+
The defaults suit most scenes. `TAAPass` also has the standard Three.js `Pass` properties.
|
|
134
158
|
|
|
135
159
|
## Methods
|
|
136
160
|
|
|
137
161
|
| Method | Description |
|
|
138
162
|
| --- | --- |
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
163
|
+
| `reset()` | Discard earlier frames and start smoothing again |
|
|
164
|
+
| `dispose()` | Release the resources it holds. The scene is not disposed |
|
|
165
|
+
| `setSize(width, height)` | Resize in physical pixels. Called for you; a size change resets |
|
|
166
|
+
| `render(renderer, target)` | `TAAPass` only. Called for you by `EffectComposer` |
|
|
167
|
+
| `getTextureNode()` | `TAANode` only. The smoothed image, for chaining effects |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaussian-splat-lite",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Three.js Gaussian Splatting renderer with WebGPU/WebGL2, GPU sorting, streaming LOD, and high-precision GIS/ECEF support. Supports PLY, SPZ, SOG and RAD.",
|
|
5
5
|
"author": "William Liu <lyz15972107087@gmail.com>",
|
|
6
6
|
"type": "module",
|
package/docs/SplatAccumulator.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# SplatAccumulator
|
|
2
|
-
|
|
3
|
-
[Back to documentation](../README.md#documentation)
|
|
4
|
-
|
|
5
|
-
Combines visible Splat models for rendering. `GaussianSplatRenderer` manages this automatically; most applications only need its `update()` method.
|
|
6
|
-
|
|
7
|
-
For custom integrations, the methods below expose the combined scene data. `ensureGenerate()` and `generate()` support WebGL only.
|
|
8
|
-
|
|
9
|
-
## Constructor
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
new SplatAccumulator()
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Common state
|
|
16
|
-
|
|
17
|
-
| Property | Description |
|
|
18
|
-
| --- | --- |
|
|
19
|
-
| `numSplats` | Number of Splats in the combined data |
|
|
20
|
-
| `maxSplats` | Allocated Splat capacity |
|
|
21
|
-
| `mapping` | Models and their ranges in the combined data |
|
|
22
|
-
| `version` | Combined data version |
|
|
23
|
-
| `mappingVersion` | Model mapping version |
|
|
24
|
-
| `viewOrigin` / `viewDirection` | Camera position and direction used for the current data |
|
|
25
|
-
| `time` / `deltaTime` | Timer values used for per-frame mesh updates |
|
|
26
|
-
|
|
27
|
-
## Common methods
|
|
28
|
-
|
|
29
|
-
| API | Description |
|
|
30
|
-
| --- | --- |
|
|
31
|
-
| `getTextures()` | Return the combined Splat textures |
|
|
32
|
-
| `generateMapping(splatCounts, compact?)` | Assign model ranges and return the required capacity; `compact` reduces unused space |
|
|
33
|
-
| `ensureGenerate({ maxSplats, renderer?, shrinkResources?, stochasticSeeds? })` | Prepare storage for the requested capacity; optionally shrink unused resources or reserve storage for stochastic rendering |
|
|
34
|
-
| `generate({ mesh, base, count, renderer })` | Update one model's range at its current world position |
|
|
35
|
-
| `prepareGenerate({ renderer, scene, timer, camera, layerCamera?, previous })` | Collect visible models and prepare their updates; `layerCamera` (default `camera`) decides which layers are visible |
|
|
36
|
-
| `checkVersions(mapping)` | Check whether data, model ranges, or sorting need updating |
|
|
37
|
-
| `dispose()` | Release this accumulator's resources |
|