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.
- package/CHANGELOG.md +36 -2
- package/CONTRIBUTING.md +14 -2
- package/NOTICE +11 -3
- package/README.md +5 -7
- package/THIRD_PARTY_LICENSES.md +64 -6
- package/bin/build-lod.js +241 -0
- package/bin/decoder/decoder.js +340 -0
- package/bin/decoder/decoder_bg.wasm +0 -0
- package/bin/rad/grid.js +620 -0
- package/bin/rad/heap.js +270 -0
- package/bin/rad/input.js +87 -0
- package/bin/rad/lod.js +657 -0
- package/bin/rad/math.js +166 -0
- package/bin/rad/parallel.js +578 -0
- package/bin/rad/progress.js +50 -0
- package/bin/rad/rad.js +612 -0
- package/bin/rad/splats.js +432 -0
- package/bin/rad/storage.js +776 -0
- package/dist/gaussian-splat-lite.cjs +392 -794
- package/dist/gaussian-splat-lite.cjs.map +1 -1
- package/dist/gaussian-splat-lite.min.cjs +246 -308
- package/dist/gaussian-splat-lite.min.cjs.map +1 -1
- package/dist/gaussian-splat-lite.module.js +394 -796
- package/dist/gaussian-splat-lite.module.js.map +1 -1
- package/dist/gaussian-splat-lite.module.min.js +2518 -2802
- 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 +41 -2
- package/dist/types/addons/neuralDenoiseWeights.d.ts +41 -2
- package/dist/types/data/RadPagedSplats.d.cts +1 -1
- package/dist/types/data/RadPagedSplats.d.ts +1 -1
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/loaders/rad/radFormat.d.cts +2 -2
- package/dist/types/loaders/rad/radFormat.d.ts +2 -2
- package/docs/BuildRad.md +91 -0
- package/docs/GaussianSplatRenderer.md +2 -2
- package/docs/NeuralDenoiseNode.md +32 -13
- package/docs/RadStreamScheduler.md +3 -1
- package/docs/StochasticRendering.md +20 -42
- package/package.json +9 -3
- 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
|
@@ -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.
|
|
3
|
+
"version": "1.4.1",
|
|
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",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"main": "./dist/gaussian-splat-lite.cjs",
|
|
9
9
|
"module": "./dist/gaussian-splat-lite.module.js",
|
|
10
10
|
"types": "./dist/types/index.d.mts",
|
|
11
|
+
"bin": {
|
|
12
|
+
"gsl-build-lod": "./bin/build-lod.js"
|
|
13
|
+
},
|
|
11
14
|
"exports": {
|
|
12
15
|
".": {
|
|
13
16
|
"import": {
|
|
@@ -27,9 +30,11 @@
|
|
|
27
30
|
"build:site": "vite build --config vite.site.config.js",
|
|
28
31
|
"build:types": "node scripts/check-declarations.js && node scripts/build-types.js",
|
|
29
32
|
"build:wasm": "node rust/build_wasm.js",
|
|
33
|
+
"build:wasm:lod": "node rust/build_wasm.js --lod",
|
|
34
|
+
"build-lod": "node bin/build-lod.js",
|
|
30
35
|
"check": "node scripts/check-js.js && tsc --noEmit && node scripts/check-declarations.js",
|
|
31
36
|
"check:rust": "cargo fmt --manifest-path rust/Cargo.toml --all -- --check",
|
|
32
|
-
"clean": "rm -rf dist/ node_modules/ rust/target/ rust/gaussian-splat-rs/pkg/",
|
|
37
|
+
"clean": "rm -rf dist/ bin/decoder/ node_modules/ rust/target/ rust/gaussian-splat-rs/pkg/",
|
|
33
38
|
"dev": "vite --config vite.site.config.js --host",
|
|
34
39
|
"format": "biome format .",
|
|
35
40
|
"format:fix": "biome format . --fix",
|
|
@@ -44,6 +49,7 @@
|
|
|
44
49
|
"test:rust": "cargo test --manifest-path rust/Cargo.toml --workspace --locked"
|
|
45
50
|
},
|
|
46
51
|
"files": [
|
|
52
|
+
"bin",
|
|
47
53
|
"dist",
|
|
48
54
|
"docs",
|
|
49
55
|
"CHANGELOG.md",
|
|
@@ -76,7 +82,7 @@
|
|
|
76
82
|
"publint": "0.3.24",
|
|
77
83
|
"three": "0.186.0",
|
|
78
84
|
"typescript": "^5.7.3",
|
|
79
|
-
"vite": "^6.
|
|
85
|
+
"vite": "^6.4.4",
|
|
80
86
|
"vite-plugin-arraybuffer": "^0.1.4",
|
|
81
87
|
"vite-plugin-glsl": "^1.3.1"
|
|
82
88
|
},
|
|
@@ -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
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DepthTexture,
|
|
3
|
-
Matrix4,
|
|
4
|
-
OrthographicCamera,
|
|
5
|
-
PerspectiveCamera,
|
|
6
|
-
Scene,
|
|
7
|
-
WebGLRenderTarget,
|
|
8
|
-
WebGLRenderer,
|
|
9
|
-
} from "three";
|
|
10
|
-
import { Pass } from "three/addons/postprocessing/Pass.js";
|
|
11
|
-
/**
|
|
12
|
-
* Temporal reprojection for WebGLRenderer, using depth and camera motion.
|
|
13
|
-
* Object motion is not tracked; no velocity texture is required.
|
|
14
|
-
* Owns scene capture, camera jitter, and history. It blends and accumulates
|
|
15
|
-
* in the output color space, like direct canvas rendering, then hands the
|
|
16
|
-
* composer a working-space result. Use EffectComposer with OutputPass for
|
|
17
|
-
* output.
|
|
18
|
-
*/
|
|
19
|
-
export declare class TAAPass extends Pass {
|
|
20
|
-
scene: Scene;
|
|
21
|
-
camera: PerspectiveCamera | OrthographicCamera;
|
|
22
|
-
readonly msaa: boolean;
|
|
23
|
-
private readonly _coverage;
|
|
24
|
-
/** Depth difference above which non-edge history is rejected. */
|
|
25
|
-
depthThreshold: number;
|
|
26
|
-
/** Depth range within the 3x3 neighborhood that identifies an edge. */
|
|
27
|
-
edgeDepthDiff: number;
|
|
28
|
-
/** Camera motion in pixels at which history loses all weight. */
|
|
29
|
-
maxMotionLength: number;
|
|
30
|
-
/** Increase current-frame weight for subpixel camera motion. */
|
|
31
|
-
useSubpixelCorrection: boolean;
|
|
32
|
-
private readonly _source;
|
|
33
|
-
private readonly _history;
|
|
34
|
-
private readonly _clearColor;
|
|
35
|
-
private readonly _state;
|
|
36
|
-
private readonly _uniforms;
|
|
37
|
-
private readonly _resolveMaterial;
|
|
38
|
-
private readonly _copyMaterial;
|
|
39
|
-
private readonly _quad;
|
|
40
|
-
/** @param msaa Enable 4× MSAA (default false). Fixed for the pass's lifetime. */
|
|
41
|
-
constructor(
|
|
42
|
-
scene: Scene,
|
|
43
|
-
camera: PerspectiveCamera | OrthographicCamera,
|
|
44
|
-
msaa?: boolean,
|
|
45
|
-
);
|
|
46
|
-
/** Current scene depth, before temporal accumulation. Owned by this pass. */
|
|
47
|
-
get depthTexture(): DepthTexture;
|
|
48
|
-
/** Jittered projection used to capture depthTexture. Treat as read-only. */
|
|
49
|
-
get projectionMatrix(): Matrix4;
|
|
50
|
-
/** Resize all internal targets in physical pixels; a size change clears history. */
|
|
51
|
-
setSize(width: number, height: number): void;
|
|
52
|
-
/** Discard history after a camera cut, scene replacement, or color-space change. */
|
|
53
|
-
reset(): void;
|
|
54
|
-
/** Render the scene and resolve TAA into the composer's working-space buffer. */
|
|
55
|
-
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void;
|
|
56
|
-
dispose(): void;
|
|
57
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DepthTexture,
|
|
3
|
-
Matrix4,
|
|
4
|
-
OrthographicCamera,
|
|
5
|
-
PerspectiveCamera,
|
|
6
|
-
Scene,
|
|
7
|
-
WebGLRenderTarget,
|
|
8
|
-
WebGLRenderer,
|
|
9
|
-
} from "three";
|
|
10
|
-
import { Pass } from "three/addons/postprocessing/Pass.js";
|
|
11
|
-
/**
|
|
12
|
-
* Temporal reprojection for WebGLRenderer, using depth and camera motion.
|
|
13
|
-
* Object motion is not tracked; no velocity texture is required.
|
|
14
|
-
* Owns scene capture, camera jitter, and history. It blends and accumulates
|
|
15
|
-
* in the output color space, like direct canvas rendering, then hands the
|
|
16
|
-
* composer a working-space result. Use EffectComposer with OutputPass for
|
|
17
|
-
* output.
|
|
18
|
-
*/
|
|
19
|
-
export declare class TAAPass extends Pass {
|
|
20
|
-
scene: Scene;
|
|
21
|
-
camera: PerspectiveCamera | OrthographicCamera;
|
|
22
|
-
readonly msaa: boolean;
|
|
23
|
-
private readonly _coverage;
|
|
24
|
-
/** Depth difference above which non-edge history is rejected. */
|
|
25
|
-
depthThreshold: number;
|
|
26
|
-
/** Depth range within the 3x3 neighborhood that identifies an edge. */
|
|
27
|
-
edgeDepthDiff: number;
|
|
28
|
-
/** Camera motion in pixels at which history loses all weight. */
|
|
29
|
-
maxMotionLength: number;
|
|
30
|
-
/** Increase current-frame weight for subpixel camera motion. */
|
|
31
|
-
useSubpixelCorrection: boolean;
|
|
32
|
-
private readonly _source;
|
|
33
|
-
private readonly _history;
|
|
34
|
-
private readonly _clearColor;
|
|
35
|
-
private readonly _state;
|
|
36
|
-
private readonly _uniforms;
|
|
37
|
-
private readonly _resolveMaterial;
|
|
38
|
-
private readonly _copyMaterial;
|
|
39
|
-
private readonly _quad;
|
|
40
|
-
/** @param msaa Enable 4× MSAA (default false). Fixed for the pass's lifetime. */
|
|
41
|
-
constructor(
|
|
42
|
-
scene: Scene,
|
|
43
|
-
camera: PerspectiveCamera | OrthographicCamera,
|
|
44
|
-
msaa?: boolean,
|
|
45
|
-
);
|
|
46
|
-
/** Current scene depth, before temporal accumulation. Owned by this pass. */
|
|
47
|
-
get depthTexture(): DepthTexture;
|
|
48
|
-
/** Jittered projection used to capture depthTexture. Treat as read-only. */
|
|
49
|
-
get projectionMatrix(): Matrix4;
|
|
50
|
-
/** Resize all internal targets in physical pixels; a size change clears history. */
|
|
51
|
-
setSize(width: number, height: number): void;
|
|
52
|
-
/** Discard history after a camera cut, scene replacement, or color-space change. */
|
|
53
|
-
reset(): void;
|
|
54
|
-
/** Render the scene and resolve TAA into the composer's working-space buffer. */
|
|
55
|
-
render(renderer: WebGLRenderer, writeBuffer: WebGLRenderTarget): void;
|
|
56
|
-
dispose(): void;
|
|
57
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Camera,
|
|
3
|
-
Matrix4,
|
|
4
|
-
OrthographicCamera,
|
|
5
|
-
PerspectiveCamera,
|
|
6
|
-
RenderTarget,
|
|
7
|
-
Vector2,
|
|
8
|
-
Vector3,
|
|
9
|
-
} from "three";
|
|
10
|
-
type TAACamera = PerspectiveCamera | OrthographicCamera;
|
|
11
|
-
type TAAParameters = {
|
|
12
|
-
depthThreshold: number;
|
|
13
|
-
edgeDepthDiff: number;
|
|
14
|
-
maxMotionLength: number;
|
|
15
|
-
useSubpixelCorrection: boolean;
|
|
16
|
-
};
|
|
17
|
-
export declare function createTAAState<
|
|
18
|
-
FloatUniform extends {
|
|
19
|
-
value: number;
|
|
20
|
-
},
|
|
21
|
-
BoolUniform extends {
|
|
22
|
-
value: boolean;
|
|
23
|
-
},
|
|
24
|
-
Vec2Uniform extends {
|
|
25
|
-
value: Vector2;
|
|
26
|
-
},
|
|
27
|
-
Vec3Uniform extends {
|
|
28
|
-
value: Vector3;
|
|
29
|
-
},
|
|
30
|
-
Mat4Uniform extends {
|
|
31
|
-
value: Matrix4;
|
|
32
|
-
},
|
|
33
|
-
>(
|
|
34
|
-
makeUniform: {
|
|
35
|
-
(value: number): FloatUniform;
|
|
36
|
-
(value: boolean): BoolUniform;
|
|
37
|
-
(value: Vector2): Vec2Uniform;
|
|
38
|
-
(value: Vector3): Vec3Uniform;
|
|
39
|
-
(value: Matrix4): Mat4Uniform;
|
|
40
|
-
},
|
|
41
|
-
targets: RenderTarget[],
|
|
42
|
-
nodeLogDepth?: boolean,
|
|
43
|
-
margin?: number,
|
|
44
|
-
): {
|
|
45
|
-
uniforms: {
|
|
46
|
-
renderSize: Vec2Uniform;
|
|
47
|
-
projection: Mat4Uniform;
|
|
48
|
-
unjitteredProjection: Mat4Uniform;
|
|
49
|
-
previousProjection: Mat4Uniform;
|
|
50
|
-
viewToPreviousClip: Mat4Uniform;
|
|
51
|
-
previousViewToView: Mat4Uniform;
|
|
52
|
-
valid: BoolUniform;
|
|
53
|
-
reversed: BoolUniform;
|
|
54
|
-
logarithmic: BoolUniform;
|
|
55
|
-
logFar: Vec2Uniform;
|
|
56
|
-
logNear: Vec2Uniform;
|
|
57
|
-
depthThreshold: FloatUniform;
|
|
58
|
-
edgeDepthDiff: FloatUniform;
|
|
59
|
-
maxMotionLength: FloatUniform;
|
|
60
|
-
useSubpixelCorrection: BoolUniform;
|
|
61
|
-
luminanceCoefficients: Vec3Uniform;
|
|
62
|
-
};
|
|
63
|
-
historyIndex: number;
|
|
64
|
-
jitterIndex: number;
|
|
65
|
-
reset(): void;
|
|
66
|
-
setSize(width: number, height: number): void;
|
|
67
|
-
setStencil(stencil: boolean): void;
|
|
68
|
-
beginCapture(camera: TAACamera): void;
|
|
69
|
-
endCapture(camera: TAACamera): void;
|
|
70
|
-
prepareResolve(camera: TAACamera, parameters: TAAParameters): 0 | 1;
|
|
71
|
-
advance(camera: TAACamera): void;
|
|
72
|
-
};
|
|
73
|
-
export declare const getTAAProjection: (camera: Camera) => Matrix4 | undefined;
|
|
74
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Camera,
|
|
3
|
-
Matrix4,
|
|
4
|
-
OrthographicCamera,
|
|
5
|
-
PerspectiveCamera,
|
|
6
|
-
RenderTarget,
|
|
7
|
-
Vector2,
|
|
8
|
-
Vector3,
|
|
9
|
-
} from "three";
|
|
10
|
-
type TAACamera = PerspectiveCamera | OrthographicCamera;
|
|
11
|
-
type TAAParameters = {
|
|
12
|
-
depthThreshold: number;
|
|
13
|
-
edgeDepthDiff: number;
|
|
14
|
-
maxMotionLength: number;
|
|
15
|
-
useSubpixelCorrection: boolean;
|
|
16
|
-
};
|
|
17
|
-
export declare function createTAAState<
|
|
18
|
-
FloatUniform extends {
|
|
19
|
-
value: number;
|
|
20
|
-
},
|
|
21
|
-
BoolUniform extends {
|
|
22
|
-
value: boolean;
|
|
23
|
-
},
|
|
24
|
-
Vec2Uniform extends {
|
|
25
|
-
value: Vector2;
|
|
26
|
-
},
|
|
27
|
-
Vec3Uniform extends {
|
|
28
|
-
value: Vector3;
|
|
29
|
-
},
|
|
30
|
-
Mat4Uniform extends {
|
|
31
|
-
value: Matrix4;
|
|
32
|
-
},
|
|
33
|
-
>(
|
|
34
|
-
makeUniform: {
|
|
35
|
-
(value: number): FloatUniform;
|
|
36
|
-
(value: boolean): BoolUniform;
|
|
37
|
-
(value: Vector2): Vec2Uniform;
|
|
38
|
-
(value: Vector3): Vec3Uniform;
|
|
39
|
-
(value: Matrix4): Mat4Uniform;
|
|
40
|
-
},
|
|
41
|
-
targets: RenderTarget[],
|
|
42
|
-
nodeLogDepth?: boolean,
|
|
43
|
-
margin?: number,
|
|
44
|
-
): {
|
|
45
|
-
uniforms: {
|
|
46
|
-
renderSize: Vec2Uniform;
|
|
47
|
-
projection: Mat4Uniform;
|
|
48
|
-
unjitteredProjection: Mat4Uniform;
|
|
49
|
-
previousProjection: Mat4Uniform;
|
|
50
|
-
viewToPreviousClip: Mat4Uniform;
|
|
51
|
-
previousViewToView: Mat4Uniform;
|
|
52
|
-
valid: BoolUniform;
|
|
53
|
-
reversed: BoolUniform;
|
|
54
|
-
logarithmic: BoolUniform;
|
|
55
|
-
logFar: Vec2Uniform;
|
|
56
|
-
logNear: Vec2Uniform;
|
|
57
|
-
depthThreshold: FloatUniform;
|
|
58
|
-
edgeDepthDiff: FloatUniform;
|
|
59
|
-
maxMotionLength: FloatUniform;
|
|
60
|
-
useSubpixelCorrection: BoolUniform;
|
|
61
|
-
luminanceCoefficients: Vec3Uniform;
|
|
62
|
-
};
|
|
63
|
-
historyIndex: number;
|
|
64
|
-
jitterIndex: number;
|
|
65
|
-
reset(): void;
|
|
66
|
-
setSize(width: number, height: number): void;
|
|
67
|
-
setStencil(stencil: boolean): void;
|
|
68
|
-
beginCapture(camera: TAACamera): void;
|
|
69
|
-
endCapture(camera: TAACamera): void;
|
|
70
|
-
prepareResolve(camera: TAACamera, parameters: TAAParameters): 0 | 1;
|
|
71
|
-
advance(camera: TAACamera): void;
|
|
72
|
-
};
|
|
73
|
-
export declare const getTAAProjection: (camera: Camera) => Matrix4 | undefined;
|
|
74
|
-
export {};
|