gaussian-splat-lite 1.4.0 → 1.4.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 +29 -2
- package/README.md +3 -6
- package/dist/gaussian-splat-lite.cjs +391 -884
- package/dist/gaussian-splat-lite.cjs.map +1 -1
- package/dist/gaussian-splat-lite.min.cjs +196 -354
- package/dist/gaussian-splat-lite.min.cjs.map +1 -1
- package/dist/gaussian-splat-lite.module.js +393 -886
- package/dist/gaussian-splat-lite.module.js.map +1 -1
- package/dist/gaussian-splat-lite.module.min.js +2502 -2887
- package/dist/gaussian-splat-lite.module.min.js.map +1 -1
- package/dist/types/addons/NeuralDenoiseNode.d.cts +1 -2
- package/dist/types/addons/NeuralDenoiseNode.d.ts +1 -2
- package/dist/types/addons/NeuralDenoiseXR.d.cts +31 -0
- package/dist/types/addons/NeuralDenoiseXR.d.ts +31 -0
- package/dist/types/addons/neuralDenoiseState.d.cts +22 -0
- package/dist/types/addons/neuralDenoiseState.d.ts +22 -0
- package/dist/types/addons/neuralDenoiseWeights.d.cts +23 -2
- package/dist/types/addons/neuralDenoiseWeights.d.ts +23 -2
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/rendering/GaussianSplatRenderer.d.cts +1 -1
- package/dist/types/rendering/GaussianSplatRenderer.d.ts +1 -1
- package/dist/types/rendering/SplatGeometry.d.cts +2 -2
- package/dist/types/rendering/SplatGeometry.d.ts +2 -2
- package/docs/GaussianSplatRenderer.md +2 -2
- package/docs/NeuralDenoiseNode.md +32 -13
- package/docs/StochasticRendering.md +20 -42
- package/package.json +1 -1
- package/dist/types/addons/TAANode.d.cts +0 -49
- package/dist/types/addons/TAANode.d.ts +0 -49
- package/dist/types/addons/TAAPass.d.cts +0 -57
- package/dist/types/addons/TAAPass.d.ts +0 -57
- package/dist/types/addons/taaShared.d.cts +0 -74
- package/dist/types/addons/taaShared.d.ts +0 -74
- package/docs/TAAPass.md +0 -184
|
@@ -9,8 +9,7 @@ import { Node, type NodeBuilder, type NodeFrame } from "three/webgpu";
|
|
|
9
9
|
export type NeuralDenoiseMode = "performance" | "quality";
|
|
10
10
|
/**
|
|
11
11
|
* Experimental temporal neural denoiser for stochastic Splat rendering on WebGPURenderer,
|
|
12
|
-
* including its WebGL2 fallback
|
|
13
|
-
* used in place of TAANode. After Hu et al., "Ultra-fast Neural Inference for
|
|
12
|
+
* including its WebGL2 fallback. After Hu et al., "Ultra-fast Neural Inference for
|
|
14
13
|
* Stochastic Gaussian Splatting Denoising" (arXiv 2609.25604), adapted to
|
|
15
14
|
* scenes whose objects move.
|
|
16
15
|
*/
|
|
@@ -9,8 +9,7 @@ import { Node, type NodeBuilder, type NodeFrame } from "three/webgpu";
|
|
|
9
9
|
export type NeuralDenoiseMode = "performance" | "quality";
|
|
10
10
|
/**
|
|
11
11
|
* Experimental temporal neural denoiser for stochastic Splat rendering on WebGPURenderer,
|
|
12
|
-
* including its WebGL2 fallback
|
|
13
|
-
* used in place of TAANode. After Hu et al., "Ultra-fast Neural Inference for
|
|
12
|
+
* including its WebGL2 fallback. After Hu et al., "Ultra-fast Neural Inference for
|
|
14
13
|
* Stochastic Gaussian Splatting Denoising" (arXiv 2609.25604), adapted to
|
|
15
14
|
* scenes whose objects move.
|
|
16
15
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PerspectiveCamera, Scene, WebGLRenderer } from "three";
|
|
2
|
+
import type { WebGPURenderer } from "three/webgpu";
|
|
3
|
+
import type { NeuralDenoiseMode } from "./NeuralDenoiseNode.cjs";
|
|
4
|
+
|
|
5
|
+
/** Per-eye neural denoising and presentation during an active WebXR session. */
|
|
6
|
+
export declare class NeuralDenoiseXR {
|
|
7
|
+
readonly renderer: WebGLRenderer | WebGPURenderer;
|
|
8
|
+
scene: Scene;
|
|
9
|
+
camera: PerspectiveCamera;
|
|
10
|
+
readonly mode: NeuralDenoiseMode;
|
|
11
|
+
readonly msaa: boolean;
|
|
12
|
+
stabilize: boolean;
|
|
13
|
+
private views;
|
|
14
|
+
private output;
|
|
15
|
+
private readonly nodeRenderer;
|
|
16
|
+
private readonly onSessionEnd;
|
|
17
|
+
constructor(
|
|
18
|
+
renderer: WebGLRenderer | WebGPURenderer,
|
|
19
|
+
scene: Scene,
|
|
20
|
+
camera: PerspectiveCamera,
|
|
21
|
+
mode?: NeuralDenoiseMode,
|
|
22
|
+
msaa?: boolean,
|
|
23
|
+
);
|
|
24
|
+
private createViews;
|
|
25
|
+
/** Capture, denoise and present each eye during an active XR animation frame. */
|
|
26
|
+
render(): void;
|
|
27
|
+
/** Discards both eyes' history after a camera cut or scene replacement. */
|
|
28
|
+
reset(): void;
|
|
29
|
+
private disposeViews;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PerspectiveCamera, Scene, WebGLRenderer } from "three";
|
|
2
|
+
import type { WebGPURenderer } from "three/webgpu";
|
|
3
|
+
import type { NeuralDenoiseMode } from "./NeuralDenoiseNode.js";
|
|
4
|
+
|
|
5
|
+
/** Per-eye neural denoising and presentation during an active WebXR session. */
|
|
6
|
+
export declare class NeuralDenoiseXR {
|
|
7
|
+
readonly renderer: WebGLRenderer | WebGPURenderer;
|
|
8
|
+
scene: Scene;
|
|
9
|
+
camera: PerspectiveCamera;
|
|
10
|
+
readonly mode: NeuralDenoiseMode;
|
|
11
|
+
readonly msaa: boolean;
|
|
12
|
+
stabilize: boolean;
|
|
13
|
+
private views;
|
|
14
|
+
private output;
|
|
15
|
+
private readonly nodeRenderer;
|
|
16
|
+
private readonly onSessionEnd;
|
|
17
|
+
constructor(
|
|
18
|
+
renderer: WebGLRenderer | WebGPURenderer,
|
|
19
|
+
scene: Scene,
|
|
20
|
+
camera: PerspectiveCamera,
|
|
21
|
+
mode?: NeuralDenoiseMode,
|
|
22
|
+
msaa?: boolean,
|
|
23
|
+
);
|
|
24
|
+
private createViews;
|
|
25
|
+
/** Capture, denoise and present each eye during an active XR animation frame. */
|
|
26
|
+
render(): void;
|
|
27
|
+
/** Discards both eyes' history after a camera cut or scene replacement. */
|
|
28
|
+
reset(): void;
|
|
29
|
+
private disposeViews;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Camera, Matrix4, RenderTarget, Vector2 } from "three";
|
|
2
|
+
|
|
3
|
+
/** Capture sizing, projection jitter and history lifetime for neural denoising. */
|
|
4
|
+
export declare function createNeuralDenoiseState(
|
|
5
|
+
targets: RenderTarget[],
|
|
6
|
+
margin: number,
|
|
7
|
+
): {
|
|
8
|
+
size: Vector2;
|
|
9
|
+
projection: Matrix4;
|
|
10
|
+
valid: boolean;
|
|
11
|
+
historyIndex: number;
|
|
12
|
+
jitterIndex: number;
|
|
13
|
+
reset(): void;
|
|
14
|
+
setSize(width: number, height: number): void;
|
|
15
|
+
setStencil(stencil: boolean): void;
|
|
16
|
+
beginCapture(camera: Camera): void;
|
|
17
|
+
endCapture(camera: Camera): void;
|
|
18
|
+
advance(): void;
|
|
19
|
+
};
|
|
20
|
+
export declare const getUnjitteredProjection: (
|
|
21
|
+
camera: Camera,
|
|
22
|
+
) => Matrix4 | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Camera, Matrix4, RenderTarget, Vector2 } from "three";
|
|
2
|
+
|
|
3
|
+
/** Capture sizing, projection jitter and history lifetime for neural denoising. */
|
|
4
|
+
export declare function createNeuralDenoiseState(
|
|
5
|
+
targets: RenderTarget[],
|
|
6
|
+
margin: number,
|
|
7
|
+
): {
|
|
8
|
+
size: Vector2;
|
|
9
|
+
projection: Matrix4;
|
|
10
|
+
valid: boolean;
|
|
11
|
+
historyIndex: number;
|
|
12
|
+
jitterIndex: number;
|
|
13
|
+
reset(): void;
|
|
14
|
+
setSize(width: number, height: number): void;
|
|
15
|
+
setStencil(stencil: boolean): void;
|
|
16
|
+
beginCapture(camera: Camera): void;
|
|
17
|
+
endCapture(camera: Camera): void;
|
|
18
|
+
advance(): void;
|
|
19
|
+
};
|
|
20
|
+
export declare const getUnjitteredProjection: (
|
|
21
|
+
camera: Camera,
|
|
22
|
+
) => Matrix4 | undefined;
|
|
@@ -9,8 +9,22 @@ export type NeuralDenoiseLayer = {
|
|
|
9
9
|
* Trained on this renderer's stochastic frames.
|
|
10
10
|
*/
|
|
11
11
|
export type NeuralDenoiseModel = {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Use fixed local filtering without learned multiscale passes.
|
|
14
|
+
* Requires `compactMix` and `movingKnee` when true.
|
|
15
|
+
*/
|
|
13
16
|
compact?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Required with `compact`: shares of the 3x3 mean, each in [0, 1], for
|
|
19
|
+
* settled denoised history and for camera motion or short history.
|
|
20
|
+
* The transition uses `movingKnee` and `reach`.
|
|
21
|
+
*/
|
|
22
|
+
compactMix?: [settled: number, movingOrShort: number];
|
|
23
|
+
/**
|
|
24
|
+
* Required with `compact`: positive camera-induced screen motion, in
|
|
25
|
+
* pixels per frame, at which the motion response is 0.5.
|
|
26
|
+
*/
|
|
27
|
+
movingKnee?: number;
|
|
14
28
|
/** Strengthen display stabilization for single-sample stochastic noise. */
|
|
15
29
|
stabilizeNoise?: boolean;
|
|
16
30
|
/** Gain of the variance gate between the two history paths. */
|
|
@@ -111,7 +125,14 @@ export type NeuralDenoiseModel = {
|
|
|
111
125
|
pointwise3: NeuralDenoiseLayer;
|
|
112
126
|
head: NeuralDenoiseLayer;
|
|
113
127
|
};
|
|
114
|
-
}
|
|
128
|
+
} & (
|
|
129
|
+
| { compact?: false }
|
|
130
|
+
| {
|
|
131
|
+
compact: true;
|
|
132
|
+
compactMix: [settled: number, movingOrShort: number];
|
|
133
|
+
movingKnee: number;
|
|
134
|
+
}
|
|
135
|
+
);
|
|
115
136
|
export declare const neuralDenoiseModels: {
|
|
116
137
|
quality: NeuralDenoiseModel;
|
|
117
138
|
performance: NeuralDenoiseModel;
|
|
@@ -9,8 +9,22 @@ export type NeuralDenoiseLayer = {
|
|
|
9
9
|
* Trained on this renderer's stochastic frames.
|
|
10
10
|
*/
|
|
11
11
|
export type NeuralDenoiseModel = {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Use fixed local filtering without learned multiscale passes.
|
|
14
|
+
* Requires `compactMix` and `movingKnee` when true.
|
|
15
|
+
*/
|
|
13
16
|
compact?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Required with `compact`: shares of the 3x3 mean, each in [0, 1], for
|
|
19
|
+
* settled denoised history and for camera motion or short history.
|
|
20
|
+
* The transition uses `movingKnee` and `reach`.
|
|
21
|
+
*/
|
|
22
|
+
compactMix?: [settled: number, movingOrShort: number];
|
|
23
|
+
/**
|
|
24
|
+
* Required with `compact`: positive camera-induced screen motion, in
|
|
25
|
+
* pixels per frame, at which the motion response is 0.5.
|
|
26
|
+
*/
|
|
27
|
+
movingKnee?: number;
|
|
14
28
|
/** Strengthen display stabilization for single-sample stochastic noise. */
|
|
15
29
|
stabilizeNoise?: boolean;
|
|
16
30
|
/** Gain of the variance gate between the two history paths. */
|
|
@@ -111,7 +125,14 @@ export type NeuralDenoiseModel = {
|
|
|
111
125
|
pointwise3: NeuralDenoiseLayer;
|
|
112
126
|
head: NeuralDenoiseLayer;
|
|
113
127
|
};
|
|
114
|
-
}
|
|
128
|
+
} & (
|
|
129
|
+
| { compact?: false }
|
|
130
|
+
| {
|
|
131
|
+
compact: true;
|
|
132
|
+
compactMix: [settled: number, movingOrShort: number];
|
|
133
|
+
movingKnee: number;
|
|
134
|
+
}
|
|
135
|
+
);
|
|
115
136
|
export declare const neuralDenoiseModels: {
|
|
116
137
|
quality: NeuralDenoiseModel;
|
|
117
138
|
performance: NeuralDenoiseModel;
|
package/dist/types/index.d.cts
CHANGED
|
@@ -2,11 +2,10 @@ export {
|
|
|
2
2
|
GaussianSplatRenderer,
|
|
3
3
|
type GaussianSplatRendererOptions,
|
|
4
4
|
} from "./rendering/GaussianSplatRenderer.cjs";
|
|
5
|
-
export { TAAPass } from "./addons/TAAPass.cjs";
|
|
6
|
-
export { TAANode } from "./addons/TAANode.cjs";
|
|
7
5
|
export type { NeuralDenoiseMode } from "./addons/NeuralDenoiseNode.cjs";
|
|
8
6
|
export { NeuralDenoiseNode } from "./addons/NeuralDenoiseNode.cjs";
|
|
9
7
|
export { NeuralDenoisePass } from "./addons/NeuralDenoisePass.cjs";
|
|
8
|
+
export { NeuralDenoiseXR } from "./addons/NeuralDenoiseXR.cjs";
|
|
10
9
|
export {
|
|
11
10
|
SplatCapture,
|
|
12
11
|
type SplatCaptureOptions,
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ export {
|
|
|
2
2
|
GaussianSplatRenderer,
|
|
3
3
|
type GaussianSplatRendererOptions,
|
|
4
4
|
} from "./rendering/GaussianSplatRenderer.js";
|
|
5
|
-
export { TAAPass } from "./addons/TAAPass.js";
|
|
6
|
-
export { TAANode } from "./addons/TAANode.js";
|
|
7
5
|
export type { NeuralDenoiseMode } from "./addons/NeuralDenoiseNode.js";
|
|
8
6
|
export { NeuralDenoiseNode } from "./addons/NeuralDenoiseNode.js";
|
|
9
7
|
export { NeuralDenoisePass } from "./addons/NeuralDenoisePass.js";
|
|
8
|
+
export { NeuralDenoiseXR } from "./addons/NeuralDenoiseXR.js";
|
|
10
9
|
export {
|
|
11
10
|
SplatCapture,
|
|
12
11
|
type SplatCaptureOptions,
|
|
@@ -200,6 +200,7 @@ export declare class GaussianSplatRenderer extends THREE.Mesh<
|
|
|
200
200
|
onDirty?: () => void;
|
|
201
201
|
dirty: boolean;
|
|
202
202
|
private readonly backend;
|
|
203
|
+
private readonly geometries;
|
|
203
204
|
private readonly materialState;
|
|
204
205
|
private orderingBuffer;
|
|
205
206
|
private orderingReady;
|
|
@@ -333,7 +334,6 @@ export declare class GaussianSplatRenderer extends THREE.Mesh<
|
|
|
333
334
|
* the update boundary too, keeping mode changes outside an active draw.
|
|
334
335
|
*/
|
|
335
336
|
private syncStochasticFrame;
|
|
336
|
-
private selectMaterial;
|
|
337
337
|
private applyMaterialState;
|
|
338
338
|
private reportedRenderError;
|
|
339
339
|
private runAutomaticUpdate;
|
|
@@ -200,6 +200,7 @@ export declare class GaussianSplatRenderer extends THREE.Mesh<
|
|
|
200
200
|
onDirty?: () => void;
|
|
201
201
|
dirty: boolean;
|
|
202
202
|
private readonly backend;
|
|
203
|
+
private readonly geometries;
|
|
203
204
|
private readonly materialState;
|
|
204
205
|
private orderingBuffer;
|
|
205
206
|
private orderingReady;
|
|
@@ -333,7 +334,6 @@ export declare class GaussianSplatRenderer extends THREE.Mesh<
|
|
|
333
334
|
* the update boundary too, keeping mode changes outside an active draw.
|
|
334
335
|
*/
|
|
335
336
|
private syncStochasticFrame;
|
|
336
|
-
private selectMaterial;
|
|
337
337
|
private applyMaterialState;
|
|
338
338
|
private reportedRenderError;
|
|
339
339
|
private runAutomaticUpdate;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
export declare const SPLATS_PER_INSTANCE = 128;
|
|
3
|
-
/** Repeated quads; position.z identifies the Splat
|
|
3
|
+
/** Repeated triangles or quads; position.z identifies the Splat in each instance. */
|
|
4
4
|
export declare class SplatGeometry extends THREE.InstancedBufferGeometry {
|
|
5
|
-
constructor();
|
|
5
|
+
constructor(triangle?: boolean);
|
|
6
6
|
setSplatCount(count: number): void;
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as THREE from "three";
|
|
2
2
|
export declare const SPLATS_PER_INSTANCE = 128;
|
|
3
|
-
/** Repeated quads; position.z identifies the Splat
|
|
3
|
+
/** Repeated triangles or quads; position.z identifies the Splat in each instance. */
|
|
4
4
|
export declare class SplatGeometry extends THREE.InstancedBufferGeometry {
|
|
5
|
-
constructor();
|
|
5
|
+
constructor(triangle?: boolean);
|
|
6
6
|
setSplatCount(count: number): void;
|
|
7
7
|
}
|
|
@@ -58,7 +58,7 @@ On native WebGPU, Splats are sorted before every draw. On WebGL, sorting finishe
|
|
|
58
58
|
|
|
59
59
|
| Option | Type | Default | Description |
|
|
60
60
|
| --- | --- | --- | --- |
|
|
61
|
-
| `stochastic` | `boolean` | `false` | Use stochastic rendering; smooth its noise with
|
|
61
|
+
| `stochastic` | `boolean` | `false` | Use stochastic rendering; smooth its noise with neural denoising |
|
|
62
62
|
| `stochasticSort` | `boolean` | `true` | Sort Splats from front to back in stochastic rendering; `false` skips sorting |
|
|
63
63
|
| `autoAdvanceStochasticSample` | `boolean` | `true` | Change the noise pattern on every render, including in WebXR |
|
|
64
64
|
|
|
@@ -100,7 +100,7 @@ Model colors are converted for you. Control the final image with your Three.js r
|
|
|
100
100
|
|
|
101
101
|
Set `encodeLinear` to choose the conversion yourself. For example, to blend Splats in sRGB next to a linear scene, render them into their own target with `encodeLinear: false`, then unpremultiply that layer, convert it to linear, and premultiply it again before compositing.
|
|
102
102
|
|
|
103
|
-
For
|
|
103
|
+
For neural denoising and effects such as Bloom, see [Neural denoising](NeuralDenoiseNode.md). To render offscreen, read pixels back, or build cube and environment maps, use [SplatCapture](SplatCapture.md).
|
|
104
104
|
|
|
105
105
|
## On-demand rendering
|
|
106
106
|
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Neural denoising (Experimental)
|
|
2
2
|
|
|
3
3
|
[Back to documentation](../README.md#documentation)
|
|
4
4
|
|
|
5
|
-
The experimental neural denoiser smooths [stochastic rendering](StochasticRendering.md). Use `NeuralDenoiseNode` with `WebGPURenderer`, including its WebGL2 fallback, or `NeuralDenoisePass` with `WebGLRenderer`. The trained models are included; no extra downloads are needed.
|
|
5
|
+
The experimental neural denoiser smooths [stochastic rendering](StochasticRendering.md). Use `NeuralDenoiseNode` with `WebGPURenderer`, including its WebGL2 fallback, or `NeuralDenoisePass` with `WebGLRenderer`. For immersive rendering, use [NeuralDenoiseXR](#webxr) with either renderer. The trained models are included; no extra downloads are needed.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| | `TAANode` / `TAAPass` | `NeuralDenoiseNode` / `NeuralDenoisePass` |
|
|
10
|
-
| --- | --- | --- |
|
|
11
|
-
| Moving objects | May leave a faint trail | Helps reduce trails; moving detail can still look soft or grainy |
|
|
12
|
-
| Camera movement | Some grain returns | Smooths noise during movement; fast turns can look softer |
|
|
13
|
-
| Cost | Lower | Depends on mode; Quality uses more GPU time and memory |
|
|
14
|
-
|
|
15
|
-
With neural denoising, newly exposed backgrounds need time to settle. Results vary by scene and motion.
|
|
7
|
+
Neural denoising smooths noise during movement and helps reduce trails behind moving objects. Moving detail can still look soft or grainy, and newly exposed backgrounds need time to settle. Results vary by scene and motion.
|
|
16
8
|
|
|
17
9
|
## Choose a mode
|
|
18
10
|
|
|
@@ -48,7 +40,7 @@ With MSAA off, stabilization is stronger to reduce flicker, which can add some t
|
|
|
48
40
|
## Before you start
|
|
49
41
|
|
|
50
42
|
- **WebGL2 requirements.** Both WebGL2 paths require `EXT_color_buffer_float`. MSAA also requires `OES_sample_variables`; check `renderer.getContext().getExtension("OES_sample_variables")` before enabling MSAA. If it is unavailable, leave MSAA disabled. Unsupported configurations throw an error.
|
|
51
|
-
- **
|
|
43
|
+
- **Camera.** Use a `PerspectiveCamera` or `OrthographicCamera` for the node/pass. For WebXR, use `NeuralDenoiseXR` with your application's `PerspectiveCamera` as shown below.
|
|
52
44
|
- **Stencil masks.** Create the Three.js renderer with `stencil: true` to use them.
|
|
53
45
|
- **Reset after a jump.** Call `denoise.reset()` after a camera cut or scene replacement. Resizing resets automatically; normal object movement needs no reset.
|
|
54
46
|
- **On-demand rendering.** Keep rendering after each change so the image can settle.
|
|
@@ -88,7 +80,7 @@ const pipeline = new RenderPipeline(renderer, color.add(bloom(color, 0.6, 0.4, 0
|
|
|
88
80
|
|
|
89
81
|
## WebGLRenderer: NeuralDenoisePass
|
|
90
82
|
|
|
91
|
-
Use the pass in place of `RenderPass
|
|
83
|
+
Use the pass in place of `RenderPass`:
|
|
92
84
|
|
|
93
85
|
```js
|
|
94
86
|
import { NeuralDenoisePass } from "gaussian-splat-lite";
|
|
@@ -114,6 +106,33 @@ renderer.setAnimationLoop(() => {
|
|
|
114
106
|
// On cleanup: stop the animation loop, then dispose the composer and each pass.
|
|
115
107
|
```
|
|
116
108
|
|
|
109
|
+
## WebXR
|
|
110
|
+
|
|
111
|
+
Use `NeuralDenoiseXR` during XR frames. It supports `WebGLRenderer` and initialized `WebGPURenderer`, including its WebGL2 fallback. Each eye uses its own image history and resolution; both modes and optional MSAA are available.
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
import { NeuralDenoiseXR } from "gaussian-splat-lite";
|
|
115
|
+
|
|
116
|
+
renderer.xr.enabled = true;
|
|
117
|
+
splatRenderer.stochastic = true;
|
|
118
|
+
const xrDenoise = new NeuralDenoiseXR(renderer, scene, camera, "performance");
|
|
119
|
+
|
|
120
|
+
renderer.setAnimationLoop(() => {
|
|
121
|
+
// Update animation here. Start the XR session using your normal XR button.
|
|
122
|
+
if (renderer.xr.isPresenting) xrDenoise.render();
|
|
123
|
+
else renderer.render(scene, camera); // Or your desktop denoising pipeline.
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// After a teleport or scene replacement: xrDenoise.reset().
|
|
127
|
+
// On cleanup: xrDenoise.dispose().
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Call `render()` directly during an active XR animation frame. It presents the final image, including tone mapping and output color conversion; do not put it in an `EffectComposer` or `RenderPipeline`. Those desktop pipelines do not automatically become stereo pipelines. When using a desktop denoiser too, reset its history when leaving XR.
|
|
131
|
+
|
|
132
|
+
The constructor takes `(renderer, scene, camera, mode = "quality", msaa = false)`. `scene`, `camera`, and `stabilize` can be changed; call `reset()` after replacing the scene or camera. If `renderer.xr.cameraAutoUpdate` is `false`, update the XR camera yourself before rendering. Eye resizing resets history automatically, and ending the session releases the eye resources.
|
|
133
|
+
|
|
134
|
+
Stereo rendering increases GPU and memory use. Start with `"performance"` and MSAA off, and check image quality and frame timing on the target headset. Native WebGPU also requires the browser's [WebXR WebGPU binding](https://immersive-web.github.io/webxr-webgpu-binding/) and a session requested with the `"webgpu"` feature. The XR path presents color only; it does not provide scene depth to the XR compositor or a stereo postprocessing chain.
|
|
135
|
+
|
|
117
136
|
## Color
|
|
118
137
|
|
|
119
138
|
`RenderPipeline`, or the composer's `OutputPass`, applies tone mapping and the output color space at the end.
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[Back to documentation](../README.md#documentation)
|
|
4
4
|
|
|
5
|
-
Stochastic rendering is an optional way for `GaussianSplatRenderer` to draw transparency. It produces visible noise, so pair it with
|
|
5
|
+
Stochastic rendering is an optional way for `GaussianSplatRenderer` to draw transparency. It produces visible noise, so pair it with the experimental neural denoiser to get a smooth image. Sorted alpha blending remains the default.
|
|
6
6
|
|
|
7
|
-
Stochastic rendering works on WebGPU, WebGL2, and `WebGPURenderer`'s WebGL2 fallback, including WebXR.
|
|
7
|
+
Stochastic rendering works on WebGPU, WebGL2, and `WebGPURenderer`'s WebGL2 fallback, including WebXR. For immersive rendering, use [NeuralDenoiseXR](NeuralDenoiseNode.md#webxr).
|
|
8
8
|
|
|
9
9
|
## Turn it on
|
|
10
10
|
|
|
@@ -24,21 +24,21 @@ Both can be changed at any time. While stochastic rendering is active, Splats ar
|
|
|
24
24
|
|
|
25
25
|
## Smooth the noise
|
|
26
26
|
|
|
27
|
-
Use [`
|
|
27
|
+
Use [`NeuralDenoiseNode`](NeuralDenoiseNode.md#webgpurenderer-neuraldenoisenode) with `WebGPURenderer`, or [`NeuralDenoisePass`](NeuralDenoiseNode.md#webglrenderer-neuraldenoisepass) with `WebGLRenderer`. The library does not turn denoising on for you. The examples assume an existing `renderer`, `scene`, `camera`, and `splatRenderer`, with one camera outside WebXR.
|
|
28
28
|
|
|
29
|
-
### WebGPURenderer:
|
|
29
|
+
### WebGPURenderer: NeuralDenoiseNode
|
|
30
30
|
|
|
31
31
|
Use this on both WebGPU and the WebGL2 fallback, after `await renderer.init()`:
|
|
32
32
|
|
|
33
33
|
```js
|
|
34
|
-
import {
|
|
34
|
+
import { NeuralDenoiseNode } from "gaussian-splat-lite";
|
|
35
35
|
import { RenderPipeline } from "three/webgpu";
|
|
36
36
|
|
|
37
37
|
splatRenderer.stochastic = true;
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
// Chain Bloom or other effects from
|
|
41
|
-
const pipeline = new RenderPipeline(renderer,
|
|
39
|
+
const denoise = new NeuralDenoiseNode(scene, camera);
|
|
40
|
+
// Chain Bloom or other effects from denoise here.
|
|
41
|
+
const pipeline = new RenderPipeline(renderer, denoise);
|
|
42
42
|
|
|
43
43
|
renderer.setAnimationLoop(() => {
|
|
44
44
|
// Update controls / animation here.
|
|
@@ -46,31 +46,20 @@ renderer.setAnimationLoop(() => {
|
|
|
46
46
|
});
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
To help reduce trails behind moving objects, replace `TAANode` in the setup above with `NeuralDenoiseNode`:
|
|
52
|
-
|
|
53
|
-
```js
|
|
54
|
-
import { NeuralDenoiseNode } from "gaussian-splat-lite";
|
|
55
|
-
|
|
56
|
-
const denoise = new NeuralDenoiseNode(scene, camera);
|
|
57
|
-
const pipeline = new RenderPipeline(renderer, denoise);
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
It also supports the WebGL2 fallback. See [Neural denoising](NeuralDenoiseNode.md) for modes, MSAA and WebGL2 requirements.
|
|
49
|
+
See [Neural denoising](NeuralDenoiseNode.md) for modes, MSAA and WebGL2 requirements.
|
|
61
50
|
|
|
62
|
-
### WebGLRenderer:
|
|
51
|
+
### WebGLRenderer: NeuralDenoisePass
|
|
63
52
|
|
|
64
53
|
```js
|
|
65
|
-
import {
|
|
54
|
+
import { NeuralDenoisePass } from "gaussian-splat-lite";
|
|
66
55
|
import { EffectComposer } from "three/addons/postprocessing/EffectComposer.js";
|
|
67
56
|
import { OutputPass } from "three/addons/postprocessing/OutputPass.js";
|
|
68
57
|
|
|
69
58
|
splatRenderer.stochastic = true;
|
|
70
59
|
|
|
71
|
-
const
|
|
60
|
+
const denoise = new NeuralDenoisePass(scene, camera);
|
|
72
61
|
const composer = new EffectComposer(renderer);
|
|
73
|
-
composer.addPass(
|
|
62
|
+
composer.addPass(denoise);
|
|
74
63
|
// Insert Bloom or other effects here.
|
|
75
64
|
composer.addPass(new OutputPass());
|
|
76
65
|
|
|
@@ -80,31 +69,20 @@ renderer.setAnimationLoop(() => {
|
|
|
80
69
|
});
|
|
81
70
|
```
|
|
82
71
|
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
### WebGLRenderer: NeuralDenoisePass
|
|
86
|
-
|
|
87
|
-
Replace `TAAPass` in the composer setup above with `NeuralDenoisePass`, keeping `OutputPass` after it:
|
|
88
|
-
|
|
89
|
-
```js
|
|
90
|
-
import { NeuralDenoisePass } from "gaussian-splat-lite";
|
|
91
|
-
|
|
92
|
-
const denoise = new NeuralDenoisePass(scene, camera);
|
|
93
|
-
composer.addPass(denoise);
|
|
94
|
-
```
|
|
72
|
+
`NeuralDenoisePass` takes the place of `RenderPass`. On resize, call `composer.setSize(width, height)` along with the renderer.
|
|
95
73
|
|
|
96
74
|
It has the same options and requirements as `NeuralDenoiseNode` on WebGL2.
|
|
97
75
|
|
|
98
|
-
###
|
|
76
|
+
### History and on-demand rendering
|
|
99
77
|
|
|
100
|
-
- Call `reset()` after a camera cut or a scene replacement.
|
|
78
|
+
- Call `reset()` after a camera cut or a scene replacement.
|
|
101
79
|
- With on-demand rendering, keep rendering for several frames after the camera, a model, or streamed content changes, and after the Splat renderer's `onDirty` callback, so the noise can settle.
|
|
102
80
|
|
|
103
|
-
See [
|
|
81
|
+
See [Neural denoising](NeuralDenoiseNode.md) for effects, depth, color, and cleanup.
|
|
104
82
|
|
|
105
83
|
## Control the noise pattern
|
|
106
84
|
|
|
107
|
-
The noise pattern changes on every render so
|
|
85
|
+
The noise pattern changes on every render so neural denoising can smooth it over time. To keep it fixed, or to control it from your own render loop:
|
|
108
86
|
|
|
109
87
|
```js
|
|
110
88
|
splatRenderer.autoAdvanceStochasticSample = false;
|
|
@@ -119,11 +97,11 @@ When you advance it yourself, increase it by one for each render of the scene. T
|
|
|
119
97
|
splatRenderer.stochastic = false;
|
|
120
98
|
```
|
|
121
99
|
|
|
122
|
-
The switch, in either direction, takes effect on a later frame rather than immediately. `stochasticActive` tells you which mode is being drawn; keep your
|
|
100
|
+
The switch, in either direction, takes effect on a later frame rather than immediately. `stochasticActive` tells you which mode is being drawn; keep your neural denoiser running until it is `false`. With `autoUpdate = false`, update before drawing:
|
|
123
101
|
|
|
124
102
|
```js
|
|
125
103
|
await splatRenderer.update({ scene, camera });
|
|
126
104
|
renderer.render(scene, camera);
|
|
127
105
|
```
|
|
128
106
|
|
|
129
|
-
If you keep
|
|
107
|
+
If you keep neural denoising running with sorted rendering, set `splatRenderer.depthWrite = true` so it can use the Splats' depth.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaussian-splat-lite",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.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",
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DepthTexture,
|
|
3
|
-
Matrix4,
|
|
4
|
-
OrthographicCamera,
|
|
5
|
-
PerspectiveCamera,
|
|
6
|
-
Scene,
|
|
7
|
-
} from "three";
|
|
8
|
-
import { Node, type NodeBuilder, type NodeFrame } from "three/webgpu";
|
|
9
|
-
/** Camera/depth TAA for WebGPURenderer, including its WebGL2 fallback. */
|
|
10
|
-
export declare class TAANode extends Node<"vec4"> {
|
|
11
|
-
scene: Scene;
|
|
12
|
-
camera: PerspectiveCamera | OrthographicCamera;
|
|
13
|
-
readonly msaa: boolean;
|
|
14
|
-
private readonly coverage;
|
|
15
|
-
static get type(): string;
|
|
16
|
-
depthThreshold: number;
|
|
17
|
-
edgeDepthDiff: number;
|
|
18
|
-
maxMotionLength: number;
|
|
19
|
-
useSubpixelCorrection: boolean;
|
|
20
|
-
private readonly source;
|
|
21
|
-
private readonly history;
|
|
22
|
-
private readonly historyColor;
|
|
23
|
-
private readonly historyDepth;
|
|
24
|
-
private readonly textureNode;
|
|
25
|
-
private readonly material;
|
|
26
|
-
private readonly quad;
|
|
27
|
-
private readonly state;
|
|
28
|
-
private readonly zeroToOne;
|
|
29
|
-
private readonly drawingSize;
|
|
30
|
-
private workingColorSpace;
|
|
31
|
-
private readonly pipelineStates;
|
|
32
|
-
private pipelineRendering;
|
|
33
|
-
private capturePending;
|
|
34
|
-
/** @param msaa Enable 4× MSAA (default false). Fixed for the node's lifetime. */
|
|
35
|
-
constructor(
|
|
36
|
-
scene: Scene,
|
|
37
|
-
camera: PerspectiveCamera | OrthographicCamera,
|
|
38
|
-
msaa?: boolean,
|
|
39
|
-
);
|
|
40
|
-
private makeTarget;
|
|
41
|
-
get depthTexture(): DepthTexture;
|
|
42
|
-
get projectionMatrix(): Matrix4;
|
|
43
|
-
getTextureNode(): import("three/webgpu").TextureNode;
|
|
44
|
-
setSize(width: number, height: number): void;
|
|
45
|
-
reset(): void;
|
|
46
|
-
updateBefore(frame: NodeFrame): undefined;
|
|
47
|
-
setup(builder: NodeBuilder): import("three/webgpu").TextureNode;
|
|
48
|
-
dispose(): void;
|
|
49
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DepthTexture,
|
|
3
|
-
Matrix4,
|
|
4
|
-
OrthographicCamera,
|
|
5
|
-
PerspectiveCamera,
|
|
6
|
-
Scene,
|
|
7
|
-
} from "three";
|
|
8
|
-
import { Node, type NodeBuilder, type NodeFrame } from "three/webgpu";
|
|
9
|
-
/** Camera/depth TAA for WebGPURenderer, including its WebGL2 fallback. */
|
|
10
|
-
export declare class TAANode extends Node<"vec4"> {
|
|
11
|
-
scene: Scene;
|
|
12
|
-
camera: PerspectiveCamera | OrthographicCamera;
|
|
13
|
-
readonly msaa: boolean;
|
|
14
|
-
private readonly coverage;
|
|
15
|
-
static get type(): string;
|
|
16
|
-
depthThreshold: number;
|
|
17
|
-
edgeDepthDiff: number;
|
|
18
|
-
maxMotionLength: number;
|
|
19
|
-
useSubpixelCorrection: boolean;
|
|
20
|
-
private readonly source;
|
|
21
|
-
private readonly history;
|
|
22
|
-
private readonly historyColor;
|
|
23
|
-
private readonly historyDepth;
|
|
24
|
-
private readonly textureNode;
|
|
25
|
-
private readonly material;
|
|
26
|
-
private readonly quad;
|
|
27
|
-
private readonly state;
|
|
28
|
-
private readonly zeroToOne;
|
|
29
|
-
private readonly drawingSize;
|
|
30
|
-
private workingColorSpace;
|
|
31
|
-
private readonly pipelineStates;
|
|
32
|
-
private pipelineRendering;
|
|
33
|
-
private capturePending;
|
|
34
|
-
/** @param msaa Enable 4× MSAA (default false). Fixed for the node's lifetime. */
|
|
35
|
-
constructor(
|
|
36
|
-
scene: Scene,
|
|
37
|
-
camera: PerspectiveCamera | OrthographicCamera,
|
|
38
|
-
msaa?: boolean,
|
|
39
|
-
);
|
|
40
|
-
private makeTarget;
|
|
41
|
-
get depthTexture(): DepthTexture;
|
|
42
|
-
get projectionMatrix(): Matrix4;
|
|
43
|
-
getTextureNode(): import("three/webgpu").TextureNode;
|
|
44
|
-
setSize(width: number, height: number): void;
|
|
45
|
-
reset(): void;
|
|
46
|
-
updateBefore(frame: NodeFrame): undefined;
|
|
47
|
-
setup(builder: NodeBuilder): import("three/webgpu").TextureNode;
|
|
48
|
-
dispose(): void;
|
|
49
|
-
}
|