gaussian-splat-lite 1.2.2 → 1.3.0

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 (248) hide show
  1. package/CHANGELOG.md +32 -2
  2. package/CONTRIBUTING.md +4 -2
  3. package/README.md +4 -3
  4. package/dist/gaussian-splat-lite.cjs +6379 -1441
  5. package/dist/gaussian-splat-lite.cjs.map +1 -1
  6. package/dist/gaussian-splat-lite.min.cjs +978 -11
  7. package/dist/gaussian-splat-lite.min.cjs.map +1 -1
  8. package/dist/gaussian-splat-lite.module.js +5920 -982
  9. package/dist/gaussian-splat-lite.module.js.map +1 -1
  10. package/dist/gaussian-splat-lite.module.min.js +7882 -3373
  11. package/dist/gaussian-splat-lite.module.min.js.map +1 -1
  12. package/dist/types/addons/NeuralDenoiseNode.d.cts +72 -0
  13. package/dist/types/addons/NeuralDenoiseNode.d.ts +72 -0
  14. package/dist/types/addons/NeuralDenoisePass.d.cts +34 -0
  15. package/dist/types/addons/NeuralDenoisePass.d.ts +34 -0
  16. package/dist/types/addons/TAANode.d.cts +46 -33
  17. package/dist/types/addons/TAANode.d.ts +46 -33
  18. package/dist/types/addons/TAAPass.d.cts +47 -32
  19. package/dist/types/addons/TAAPass.d.ts +47 -32
  20. package/dist/types/addons/neuralDenoiseGL.d.cts +25 -0
  21. package/dist/types/addons/neuralDenoiseGL.d.ts +25 -0
  22. package/dist/types/addons/neuralDenoiseGLSL.d.cts +8 -0
  23. package/dist/types/addons/neuralDenoiseGLSL.d.ts +8 -0
  24. package/dist/types/addons/neuralDenoisePasses.d.cts +26 -0
  25. package/dist/types/addons/neuralDenoisePasses.d.ts +26 -0
  26. package/dist/types/addons/neuralDenoiseShaders.d.cts +38 -0
  27. package/dist/types/addons/neuralDenoiseShaders.d.ts +38 -0
  28. package/dist/types/addons/neuralDenoiseWeights.d.cts +118 -0
  29. package/dist/types/addons/neuralDenoiseWeights.d.ts +118 -0
  30. package/dist/types/addons/stochasticCoverage.d.cts +14 -0
  31. package/dist/types/addons/stochasticCoverage.d.ts +14 -0
  32. package/dist/types/addons/taaShared.d.cts +58 -39
  33. package/dist/types/addons/taaShared.d.ts +58 -39
  34. package/dist/types/capture/SplatCapture.d.cts +54 -53
  35. package/dist/types/capture/SplatCapture.d.ts +54 -53
  36. package/dist/types/capture/WebGLCapture.d.cts +10 -10
  37. package/dist/types/capture/WebGLCapture.d.ts +10 -10
  38. package/dist/types/capture/WebGPUCapture.d.cts +14 -14
  39. package/dist/types/capture/WebGPUCapture.d.ts +14 -14
  40. package/dist/types/capture/pixels.d.cts +15 -4
  41. package/dist/types/capture/pixels.d.ts +15 -4
  42. package/dist/types/capture/rendererState.d.cts +5 -2
  43. package/dist/types/capture/rendererState.d.ts +5 -2
  44. package/dist/types/data/IndexedSplats.d.cts +76 -58
  45. package/dist/types/data/IndexedSplats.d.ts +76 -58
  46. package/dist/types/data/RadPagedSplats.d.cts +65 -61
  47. package/dist/types/data/RadPagedSplats.d.ts +65 -61
  48. package/dist/types/data/SogRegionSplats.d.cts +25 -19
  49. package/dist/types/data/SogRegionSplats.d.ts +25 -19
  50. package/dist/types/data/SplatOpacityTable.d.cts +29 -29
  51. package/dist/types/data/SplatOpacityTable.d.ts +29 -29
  52. package/dist/types/data/Splats.d.cts +99 -69
  53. package/dist/types/data/Splats.d.ts +99 -69
  54. package/dist/types/data/defines.d.cts +24 -24
  55. package/dist/types/data/defines.d.ts +24 -24
  56. package/dist/types/data/raycast.d.cts +13 -9
  57. package/dist/types/data/raycast.d.ts +13 -9
  58. package/dist/types/data/splatCodec.d.cts +29 -5
  59. package/dist/types/data/splatCodec.d.ts +29 -5
  60. package/dist/types/data/splatData.d.cts +18 -11
  61. package/dist/types/data/splatData.d.ts +18 -11
  62. package/dist/types/data/splatRange.d.cts +6 -2
  63. package/dist/types/data/splatRange.d.ts +6 -2
  64. package/dist/types/data/textureLayout.d.cts +9 -6
  65. package/dist/types/data/textureLayout.d.ts +9 -6
  66. package/dist/types/data/unpack.d.cts +16 -9
  67. package/dist/types/data/unpack.d.ts +16 -9
  68. package/dist/types/index.d.cts +65 -19
  69. package/dist/types/index.d.ts +65 -19
  70. package/dist/types/loaders/SplatLoader.d.cts +27 -14
  71. package/dist/types/loaders/SplatLoader.d.ts +27 -14
  72. package/dist/types/loaders/loadSplatData.d.cts +35 -17
  73. package/dist/types/loaders/loadSplatData.d.ts +35 -17
  74. package/dist/types/loaders/loadTypes.d.cts +46 -40
  75. package/dist/types/loaders/loadTypes.d.ts +46 -40
  76. package/dist/types/loaders/morton.d.cts +9 -3
  77. package/dist/types/loaders/morton.d.ts +9 -3
  78. package/dist/types/loaders/postDecode/builder.d.cts +222 -127
  79. package/dist/types/loaders/postDecode/builder.d.ts +222 -127
  80. package/dist/types/loaders/postDecode/compiler.d.cts +25 -11
  81. package/dist/types/loaders/postDecode/compiler.d.ts +25 -11
  82. package/dist/types/loaders/postDecode/operations.d.cts +22 -3
  83. package/dist/types/loaders/postDecode/operations.d.ts +22 -3
  84. package/dist/types/loaders/postDecode/optimizer.d.cts +5 -2
  85. package/dist/types/loaders/postDecode/optimizer.d.ts +5 -2
  86. package/dist/types/loaders/postDecode/program.d.cts +13 -6
  87. package/dist/types/loaders/postDecode/program.d.ts +13 -6
  88. package/dist/types/loaders/postDecode/protocol.d.cts +136 -111
  89. package/dist/types/loaders/postDecode/protocol.d.ts +136 -111
  90. package/dist/types/loaders/postDecode/registers.d.cts +12 -7
  91. package/dist/types/loaders/postDecode/registers.d.ts +12 -7
  92. package/dist/types/loaders/postDecode/runtime.d.cts +9 -2
  93. package/dist/types/loaders/postDecode/runtime.d.ts +9 -2
  94. package/dist/types/loaders/rad/RadSource.d.cts +81 -66
  95. package/dist/types/loaders/rad/RadSource.d.ts +81 -66
  96. package/dist/types/loaders/rad/radFormat.d.cts +41 -36
  97. package/dist/types/loaders/rad/radFormat.d.ts +41 -36
  98. package/dist/types/loaders/rad.d.cts +4 -4
  99. package/dist/types/loaders/rad.d.ts +4 -4
  100. package/dist/types/loaders/sog/SogSource.d.cts +14 -4
  101. package/dist/types/loaders/sog/SogSource.d.ts +14 -4
  102. package/dist/types/loaders/sog/sogZip.d.cts +12 -12
  103. package/dist/types/loaders/sog/sogZip.d.ts +12 -12
  104. package/dist/types/loaders/sog.d.cts +3 -3
  105. package/dist/types/loaders/sog.d.ts +3 -3
  106. package/dist/types/loaders/source.d.cts +43 -15
  107. package/dist/types/loaders/source.d.ts +43 -15
  108. package/dist/types/loaders/stream/StreamByteBudget.d.cts +4 -4
  109. package/dist/types/loaders/stream/StreamByteBudget.d.ts +4 -4
  110. package/dist/types/loaders/stream/StreamCameras.d.cts +27 -18
  111. package/dist/types/loaders/stream/StreamCameras.d.ts +27 -18
  112. package/dist/types/loaders/stream/StreamWorkerPool.d.cts +37 -34
  113. package/dist/types/loaders/stream/StreamWorkerPool.d.ts +37 -34
  114. package/dist/types/loaders/stream/rad-stream/RadSelectionState.d.cts +15 -11
  115. package/dist/types/loaders/stream/rad-stream/RadSelectionState.d.ts +15 -11
  116. package/dist/types/loaders/stream/rad-stream/RadStreamBatch.d.cts +13 -9
  117. package/dist/types/loaders/stream/rad-stream/RadStreamBatch.d.ts +13 -9
  118. package/dist/types/loaders/stream/rad-stream/RadStreamLoader.d.cts +64 -49
  119. package/dist/types/loaders/stream/rad-stream/RadStreamLoader.d.ts +64 -49
  120. package/dist/types/loaders/stream/rad-stream/RadStreamScheduler.d.cts +110 -102
  121. package/dist/types/loaders/stream/rad-stream/RadStreamScheduler.d.ts +110 -102
  122. package/dist/types/loaders/stream/rad-stream/RadStreamWorker.d.cts +3 -3
  123. package/dist/types/loaders/stream/rad-stream/RadStreamWorker.d.ts +3 -3
  124. package/dist/types/loaders/stream/rad-stream/prepareRadSelection.d.cts +27 -15
  125. package/dist/types/loaders/stream/rad-stream/prepareRadSelection.d.ts +27 -15
  126. package/dist/types/loaders/stream/rad-stream/radFade.d.cts +13 -8
  127. package/dist/types/loaders/stream/rad-stream/radFade.d.ts +13 -8
  128. package/dist/types/loaders/stream/rad-stream/radLod.d.cts +26 -26
  129. package/dist/types/loaders/stream/rad-stream/radLod.d.ts +26 -26
  130. package/dist/types/loaders/stream/rad-stream/worker.d.cts +3 -59
  131. package/dist/types/loaders/stream/rad-stream/worker.d.ts +3 -59
  132. package/dist/types/loaders/stream/rad-stream/workerHandlers.d.cts +85 -59
  133. package/dist/types/loaders/stream/rad-stream/workerHandlers.d.ts +85 -59
  134. package/dist/types/loaders/stream/sog-stream/SogStreamBatch.d.cts +17 -12
  135. package/dist/types/loaders/stream/sog-stream/SogStreamBatch.d.ts +17 -12
  136. package/dist/types/loaders/stream/sog-stream/SogStreamLoader.d.cts +56 -41
  137. package/dist/types/loaders/stream/sog-stream/SogStreamLoader.d.ts +56 -41
  138. package/dist/types/loaders/stream/sog-stream/SogStreamScheduler.d.cts +82 -81
  139. package/dist/types/loaders/stream/sog-stream/SogStreamScheduler.d.ts +82 -81
  140. package/dist/types/loaders/stream/sog-stream/SogStreamWorker.d.cts +3 -3
  141. package/dist/types/loaders/stream/sog-stream/SogStreamWorker.d.ts +3 -3
  142. package/dist/types/loaders/stream/sog-stream/sogLod.d.cts +59 -44
  143. package/dist/types/loaders/stream/sog-stream/sogLod.d.ts +59 -44
  144. package/dist/types/loaders/stream/sog-stream/sogVisibility.d.cts +30 -22
  145. package/dist/types/loaders/stream/sog-stream/sogVisibility.d.ts +30 -22
  146. package/dist/types/loaders/stream/sog-stream/worker.d.cts +7 -40
  147. package/dist/types/loaders/stream/sog-stream/worker.d.ts +7 -40
  148. package/dist/types/loaders/stream/sog-stream/workerHandlers.d.cts +69 -44
  149. package/dist/types/loaders/stream/sog-stream/workerHandlers.d.ts +69 -44
  150. package/dist/types/loaders/stream/streamOptions.d.cts +41 -32
  151. package/dist/types/loaders/stream/streamOptions.d.ts +41 -32
  152. package/dist/types/loaders/workerDecode.d.cts +30 -12
  153. package/dist/types/loaders/workerDecode.d.ts +30 -12
  154. package/dist/types/patches/threeR186.d.cts +3 -0
  155. package/dist/types/patches/threeR186.d.ts +3 -0
  156. package/dist/types/rendering/GaussianSplatRenderer.d.cts +393 -376
  157. package/dist/types/rendering/GaussianSplatRenderer.d.ts +393 -376
  158. package/dist/types/rendering/MaterialState.d.cts +9 -0
  159. package/dist/types/rendering/MaterialState.d.ts +9 -0
  160. package/dist/types/rendering/SortCenterCache.d.cts +17 -17
  161. package/dist/types/rendering/SortCenterCache.d.ts +17 -17
  162. package/dist/types/rendering/SplatAccumulator.d.cts +93 -77
  163. package/dist/types/rendering/SplatAccumulator.d.ts +93 -77
  164. package/dist/types/rendering/SplatGeometry.d.cts +2 -2
  165. package/dist/types/rendering/SplatGeometry.d.ts +2 -2
  166. package/dist/types/rendering/StochasticSplatMaterial.d.cts +14 -0
  167. package/dist/types/rendering/StochasticSplatMaterial.d.ts +14 -0
  168. package/dist/types/rendering/backend.d.cts +30 -18
  169. package/dist/types/rendering/backend.d.ts +30 -18
  170. package/dist/types/rendering/blueNoise.d.cts +1 -1
  171. package/dist/types/rendering/blueNoise.d.ts +1 -1
  172. package/dist/types/rendering/rendererUtils.d.cts +25 -10
  173. package/dist/types/rendering/rendererUtils.d.ts +25 -10
  174. package/dist/types/rendering/tsl/GenerateProgram.d.cts +19 -17
  175. package/dist/types/rendering/tsl/GenerateProgram.d.ts +19 -17
  176. package/dist/types/rendering/tsl/ProjectionProgram.d.cts +38 -33
  177. package/dist/types/rendering/tsl/ProjectionProgram.d.ts +38 -33
  178. package/dist/types/rendering/tsl/SplatBackend.d.cts +22 -10
  179. package/dist/types/rendering/tsl/SplatBackend.d.ts +22 -10
  180. package/dist/types/rendering/tsl/SplatMaterial.d.cts +38 -25
  181. package/dist/types/rendering/tsl/SplatMaterial.d.ts +38 -25
  182. package/dist/types/rendering/tsl/shaderUtils.d.cts +55 -17
  183. package/dist/types/rendering/tsl/shaderUtils.d.ts +55 -17
  184. package/dist/types/rendering/tsl/stochasticCoverage.d.cts +7 -0
  185. package/dist/types/rendering/tsl/stochasticCoverage.d.ts +7 -0
  186. package/dist/types/rendering/tsl/viewUniforms.d.cts +19 -9
  187. package/dist/types/rendering/tsl/viewUniforms.d.ts +19 -9
  188. package/dist/types/rendering/uniforms.d.cts +83 -83
  189. package/dist/types/rendering/uniforms.d.ts +83 -83
  190. package/dist/types/rendering/webgl/AccumulatorGenerator.d.cts +28 -12
  191. package/dist/types/rendering/webgl/AccumulatorGenerator.d.ts +28 -12
  192. package/dist/types/rendering/webgl/OrderingTexture.d.cts +10 -7
  193. package/dist/types/rendering/webgl/OrderingTexture.d.ts +10 -7
  194. package/dist/types/rendering/webgl/SplatBackend.d.cts +20 -15
  195. package/dist/types/rendering/webgl/SplatBackend.d.ts +20 -15
  196. package/dist/types/rendering/webgl/SplatMaterial.d.cts +9 -4
  197. package/dist/types/rendering/webgl/SplatMaterial.d.ts +9 -4
  198. package/dist/types/rendering/webgl/textureUtils.d.cts +10 -3
  199. package/dist/types/rendering/webgl/textureUtils.d.ts +10 -3
  200. package/dist/types/rendering/webgl-fallback/AccumulatorGenerator.d.cts +8 -10
  201. package/dist/types/rendering/webgl-fallback/AccumulatorGenerator.d.ts +8 -10
  202. package/dist/types/rendering/webgl-fallback/SplatBackend.d.cts +18 -14
  203. package/dist/types/rendering/webgl-fallback/SplatBackend.d.ts +18 -14
  204. package/dist/types/rendering/webgpu/ProjectedSplats.d.cts +76 -66
  205. package/dist/types/rendering/webgpu/ProjectedSplats.d.ts +76 -66
  206. package/dist/types/rendering/webgpu/ProjectionCache.d.cts +43 -28
  207. package/dist/types/rendering/webgpu/ProjectionCache.d.ts +43 -28
  208. package/dist/types/rendering/webgpu/ProjectionKernel.d.cts +22 -0
  209. package/dist/types/rendering/webgpu/ProjectionKernel.d.ts +22 -0
  210. package/dist/types/rendering/webgpu/RadixSort.d.cts +44 -40
  211. package/dist/types/rendering/webgpu/RadixSort.d.ts +44 -40
  212. package/dist/types/rendering/webgpu/SplatBackend.d.cts +14 -12
  213. package/dist/types/rendering/webgpu/SplatBackend.d.ts +14 -12
  214. package/dist/types/runtime/SplatWorker.d.cts +17 -13
  215. package/dist/types/runtime/SplatWorker.d.ts +17 -13
  216. package/dist/types/runtime/WorkerRpc.d.cts +26 -20
  217. package/dist/types/runtime/WorkerRpc.d.ts +26 -20
  218. package/dist/types/runtime/abort.d.cts +10 -5
  219. package/dist/types/runtime/abort.d.ts +10 -5
  220. package/dist/types/runtime/retry.d.cts +6 -6
  221. package/dist/types/runtime/retry.d.ts +6 -6
  222. package/dist/types/runtime/wasmCall.d.cts +3 -3
  223. package/dist/types/runtime/wasmCall.d.ts +3 -3
  224. package/dist/types/runtime/worker.d.cts +44 -24
  225. package/dist/types/runtime/worker.d.ts +44 -24
  226. package/dist/types/runtime/workerServer.d.cts +3 -1
  227. package/dist/types/runtime/workerServer.d.ts +3 -1
  228. package/dist/types/scene/SplatEdit.d.cts +74 -67
  229. package/dist/types/scene/SplatEdit.d.ts +74 -67
  230. package/dist/types/scene/SplatMesh.d.cts +92 -70
  231. package/dist/types/scene/SplatMesh.d.ts +92 -70
  232. package/dist/types/utils/index.d.cts +15 -7
  233. package/dist/types/utils/index.d.ts +15 -7
  234. package/dist/types/utils/three.d.cts +3 -3
  235. package/dist/types/utils/three.d.ts +3 -3
  236. package/dist/types/utils/transforms.d.cts +10 -3
  237. package/dist/types/utils/transforms.d.ts +10 -3
  238. package/docs/GaussianSplatRenderer.md +3 -1
  239. package/docs/NeuralDenoiseNode.md +148 -0
  240. package/docs/SplatMesh.md +1 -1
  241. package/docs/StochasticRendering.md +36 -10
  242. package/docs/TAAPass.md +20 -3
  243. package/package.json +9 -11
  244. package/dist/types/capture/sceneView.d.cts +0 -3
  245. package/dist/types/capture/sceneView.d.ts +0 -3
  246. package/dist/types/rendering/tsl/tslCompat.d.cts +0 -68
  247. package/dist/types/rendering/tsl/tslCompat.d.ts +0 -68
  248. package/docs/Architecture.md +0 -200
@@ -1,381 +1,398 @@
1
- import { SplatWorker } from '../runtime/SplatWorker';
2
- import { SplatAccumulator } from './SplatAccumulator';
3
- import { SplatGeometry } from './SplatGeometry';
4
- import { SplatMaterial } from './backend';
5
- import { GaussianSplatCompatibleRenderer } from './rendererUtils';
6
1
  import * as THREE from "three";
2
+ import type { SplatWorker } from "../runtime/SplatWorker.js";
3
+ import type { SplatAccumulator } from "./SplatAccumulator.js";
4
+ import type { SplatGeometry } from "./SplatGeometry.js";
5
+ import type { SplatMaterial } from "./backend.js";
6
+ import type { GaussianSplatCompatibleRenderer } from "./rendererUtils.js";
7
7
  export interface GaussianSplatRendererOptions {
8
- /**
9
- * Pass in a THREE.WebGLRenderer or an initialized THREE.WebGPURenderer so
10
- * Gaussian Splat Lite can perform work outside the usual render loop. Both
11
- * native WebGPU and the WebGL2 fallback are supported. The renderer
12
- * should be created with antialias: false (the default) because MSAA does not
13
- * improve Gaussian Splatting and significantly reduces performance.
14
- */
15
- renderer: GaussianSplatCompatibleRenderer;
16
- /**
17
- * Callback function to be called when GaussianSplatRenderer needs to re-render,
18
- * for example when a splat sort completes.
19
- */
20
- onDirty?: () => void;
21
- /**
22
- * Whether to use premultiplied alpha when accumulating splat RGB
23
- * @default true
24
- */
25
- premultipliedAlpha?: boolean;
26
- /**
27
- * Decode stored sRGB Splat colors to linear before blending. When omitted,
28
- * conversion follows the active blend space automatically.
29
- * @default undefined
30
- */
31
- encodeLinear?: boolean;
32
- /**
33
- * Pass in a THREE.Timer to synchronize time-based effects across different
34
- * systems. A supplied timer remains owned and updated by the caller.
35
- * @default new THREE.Timer()
36
- */
37
- timer?: THREE.Timer;
38
- /**
39
- * Controls whether to check and automatically update Gsplat collection
40
- * each frame render.
41
- * @default true
42
- */
43
- autoUpdate?: boolean;
44
- /**
45
- * Controls whether to update the Gsplats before or after rendering. For WebXR
46
- * this is set to false in order to complete rendering as soon as possible.
47
- * @default true (if not WebXR)
48
- */
49
- preUpdate?: boolean;
50
- /**
51
- * Maximum standard deviations from the center to render Gaussians. Values
52
- * Math.sqrt(4)..Math.sqrt(9) produce acceptable results and can be tweaked for
53
- * performance. A Gaussian still above minAlpha at this distance fades to
54
- * minAlpha there instead of ending in a step.
55
- * @default Math.sqrt(8)
56
- */
57
- maxStdDev?: number;
58
- /**
59
- * Minimum screen-pixel radius for splat rendering, independent of the
60
- * internal projection scale used by focalAdjustment.
61
- * @default 1.0
62
- */
63
- minPixelRadius?: number;
64
- /**
65
- * Minimum alpha value for splat rendering.
66
- * @default 0.5 / 255
67
- */
68
- minAlpha?: number;
69
- /**
70
- * Scalar value to add to 2D splat covariance diagonal, effectively blurring +
71
- * enlarging splats. In scenes trained without the Gsplat anti-aliasing tweak
72
- * this value was typically 0.3, but with anti-aliasing it is 0.0
73
- * @default 0.3
74
- */
75
- preBlurAmount?: number;
76
- /**
77
- * Scalar value to add to the projected 2D splat covariance diagonal, with
78
- * opacity adjustment for anti-aliasing. Set to 0.3 with preBlurAmount = 0
79
- * to enable compensated blur. Its screen-space scale depends on focalAdjustment.
80
- * @default 0.0
81
- */
82
- blurAmount?: number;
83
- /**
84
- * X/Y clipping boundary factor for Gsplat centers against view frustum.
85
- * 1.0 clips any centers that are exactly out of bounds, while 1.25 clips
86
- * centers that are 25% beyond the bounds.
87
- * @default 1.25
88
- */
89
- clipXY?: number;
90
- /**
91
- * Parameter to adjust projected splat scale calculation to match other renderers,
92
- * similar to the same parameter in the MKellogg 3DGS renderer. Higher values will
93
- * tend to sharpen the splats. A value 2.0 can be used to match the behavior of
94
- * the PlayCanvas renderer.
95
- * @default 2.0
96
- */
97
- focalAdjustment?: number;
98
- /**
99
- * Whether to sort splats radially (geometric distance) from the viewpoint (true)
100
- * or by Z-depth (false). Most scenes are trained with the Z-depth sort metric
101
- * and will render more accurately at certain viewpoints. However, radial sorting
102
- * is more stable under viewpoint rotations.
103
- * @default false
104
- */
105
- sortRadial?: boolean;
106
- /**
107
- * Lower-precision sorting for faster sorted rendering.
108
- * Has no effect on stochastic rendering.
109
- * @default true
110
- */
111
- fastSort?: boolean;
112
- /**
113
- * Minimum interval between WebGL sort calls in milliseconds. Native WebGPU
114
- * projects and sorts each draw without CPU throttling.
115
- * @default 0
116
- */
117
- minSortIntervalMs?: number;
118
- /**
119
- * Enables stochastic transparency. Also applies to WebXR.
120
- * @default false
121
- */
122
- stochastic?: boolean;
123
- /**
124
- * Increment stochasticSample once per scene render while stochastic
125
- * coverage is active, including WebXR. All views in that render share the
126
- * same sample.
127
- * @default true
128
- */
129
- autoAdvanceStochasticSample?: boolean;
130
- /**
131
- * 16-bit front-to-back ordering for stochastic frames.
132
- * WebXR eyes share one order based on their mean position and direction.
133
- * WebGL and WebGL fallback sort asynchronously; native WebGPU sorts on the GPU.
134
- * Disable to draw in source/compacted order.
135
- * @default true
136
- */
137
- stochasticSort?: boolean;
138
- /**
139
- * Set the splat shader material to be transparent which determines if the
140
- * splats are rendered during the first opaque THREE.js render pass or the
141
- * second transparent render pass. Stochastic rendering keeps the
142
- * material in the opaque list, with depth testing and writing enabled.
143
- * @default undefined = true
144
- */
145
- transparent?: boolean;
146
- /**
147
- * Set the splat shader material to enable depth testing which determines if the
148
- * splats respect the Z depth buffer and blend with other opaque objects in the scene.
149
- * @default undefined = true
150
- */
151
- depthTest?: boolean;
152
- /**
153
- * Set the splat shader material to enable depth writing which determines if the
154
- * splats write to the Z depth buffer. Note that enabling this may produce
155
- * undesirable results because most of the Gsplat is transparent.
156
- * @default undefined = false
157
- */
158
- depthWrite?: boolean;
8
+ /**
9
+ * Pass in a THREE.WebGLRenderer or an initialized THREE.WebGPURenderer so
10
+ * Gaussian Splat Lite can perform work outside the usual render loop. Both
11
+ * native WebGPU and the WebGL2 fallback are supported. The renderer
12
+ * should be created with antialias: false (the default) because MSAA does not
13
+ * improve Gaussian Splatting and significantly reduces performance.
14
+ */
15
+ renderer: GaussianSplatCompatibleRenderer;
16
+ /**
17
+ * Callback function to be called when GaussianSplatRenderer needs to re-render,
18
+ * for example when a splat sort completes.
19
+ */
20
+ onDirty?: () => void;
21
+ /**
22
+ * Whether to use premultiplied alpha when accumulating splat RGB
23
+ * @default true
24
+ */
25
+ premultipliedAlpha?: boolean;
26
+ /**
27
+ * Decode stored sRGB Splat colors to linear before blending. When omitted,
28
+ * conversion follows the active blend space automatically.
29
+ * @default undefined
30
+ */
31
+ encodeLinear?: boolean;
32
+ /**
33
+ * Pass in a THREE.Timer to synchronize time-based effects across different
34
+ * systems. A supplied timer remains owned and updated by the caller.
35
+ * @default new THREE.Timer()
36
+ */
37
+ timer?: THREE.Timer;
38
+ /**
39
+ * Controls whether to check and automatically update Gsplat collection
40
+ * each frame render.
41
+ * @default true
42
+ */
43
+ autoUpdate?: boolean;
44
+ /**
45
+ * Controls whether to update the Gsplats before or after rendering. For WebXR
46
+ * this is set to false in order to complete rendering as soon as possible.
47
+ * @default true (if not WebXR)
48
+ */
49
+ preUpdate?: boolean;
50
+ /**
51
+ * Maximum standard deviations from the center to render Gaussians. Values
52
+ * Math.sqrt(4)..Math.sqrt(9) produce acceptable results and can be tweaked for
53
+ * performance. A Gaussian still above minAlpha at this distance fades to
54
+ * minAlpha there instead of ending in a step.
55
+ * @default Math.sqrt(8)
56
+ */
57
+ maxStdDev?: number;
58
+ /**
59
+ * Minimum screen-pixel radius for splat rendering, independent of the
60
+ * internal projection scale used by focalAdjustment.
61
+ * @default 1.0
62
+ */
63
+ minPixelRadius?: number;
64
+ /**
65
+ * Minimum alpha value for splat rendering.
66
+ * @default 0.5 / 255
67
+ */
68
+ minAlpha?: number;
69
+ /**
70
+ * Scalar value to add to 2D splat covariance diagonal, effectively blurring +
71
+ * enlarging splats. In scenes trained without the Gsplat anti-aliasing tweak
72
+ * this value was typically 0.3, but with anti-aliasing it is 0.0
73
+ * @default 0.3
74
+ */
75
+ preBlurAmount?: number;
76
+ /**
77
+ * Scalar value to add to the projected 2D splat covariance diagonal, with
78
+ * opacity adjustment for anti-aliasing. Set to 0.3 with preBlurAmount = 0
79
+ * to enable compensated blur. Its screen-space scale depends on focalAdjustment.
80
+ * @default 0.0
81
+ */
82
+ blurAmount?: number;
83
+ /**
84
+ * X/Y clipping boundary factor for Gsplat centers against view frustum.
85
+ * 1.0 clips any centers that are exactly out of bounds, while 1.25 clips
86
+ * centers that are 25% beyond the bounds.
87
+ * @default 1.25
88
+ */
89
+ clipXY?: number;
90
+ /**
91
+ * Parameter to adjust projected splat scale calculation to match other renderers,
92
+ * similar to the same parameter in the MKellogg 3DGS renderer. Higher values will
93
+ * tend to sharpen the splats. A value 2.0 can be used to match the behavior of
94
+ * the PlayCanvas renderer.
95
+ * @default 2.0
96
+ */
97
+ focalAdjustment?: number;
98
+ /**
99
+ * Whether to sort splats radially (geometric distance) from the viewpoint (true)
100
+ * or by Z-depth (false). Most scenes are trained with the Z-depth sort metric
101
+ * and will render more accurately at certain viewpoints. However, radial sorting
102
+ * is more stable under viewpoint rotations.
103
+ * @default false
104
+ */
105
+ sortRadial?: boolean;
106
+ /**
107
+ * Lower-precision sorting for faster sorted rendering.
108
+ * Has no effect on stochastic rendering.
109
+ * @default true
110
+ */
111
+ fastSort?: boolean;
112
+ /**
113
+ * Minimum interval between WebGL sort calls in milliseconds. Native WebGPU
114
+ * projects and sorts each draw without CPU throttling.
115
+ * @default 0
116
+ */
117
+ minSortIntervalMs?: number;
118
+ /**
119
+ * Enables stochastic transparency. Also applies to WebXR.
120
+ * @default false
121
+ */
122
+ stochastic?: boolean;
123
+ /**
124
+ * Increment stochasticSample once per scene render while stochastic
125
+ * coverage is active, including WebXR. All views in that render share the
126
+ * same sample.
127
+ * @default true
128
+ */
129
+ autoAdvanceStochasticSample?: boolean;
130
+ /**
131
+ * 16-bit front-to-back ordering for stochastic frames.
132
+ * WebXR eyes share one order based on their mean position and direction.
133
+ * WebGL and WebGL fallback sort asynchronously; native WebGPU sorts on the GPU.
134
+ * Disable to draw in source/compacted order.
135
+ * @default true
136
+ */
137
+ stochasticSort?: boolean;
138
+ /**
139
+ * Set the splat shader material to be transparent which determines if the
140
+ * splats are rendered during the first opaque THREE.js render pass or the
141
+ * second transparent render pass. Stochastic rendering keeps the
142
+ * material in the opaque list, with depth testing and writing enabled.
143
+ * @default undefined = true
144
+ */
145
+ transparent?: boolean;
146
+ /**
147
+ * Set the splat shader material to enable depth testing which determines if the
148
+ * splats respect the Z depth buffer and blend with other opaque objects in the scene.
149
+ * @default undefined = true
150
+ */
151
+ depthTest?: boolean;
152
+ /**
153
+ * Set the splat shader material to enable depth writing which determines if the
154
+ * splats write to the Z depth buffer. Note that enabling this may produce
155
+ * undesirable results because most of the Gsplat is transparent.
156
+ * @default undefined = false
157
+ */
158
+ depthWrite?: boolean;
159
159
  }
160
- export declare class GaussianSplatRenderer extends THREE.Mesh<SplatGeometry, SplatMaterial> {
161
- readonly renderer: GaussianSplatCompatibleRenderer;
162
- readonly uniforms: ReturnType<typeof GaussianSplatRenderer.makeUniforms>;
163
- autoUpdate: boolean;
164
- preUpdate: boolean;
165
- /** @internal False for a second renderer on the same scene, so each `onFrame` runs once per frame. */
166
- frameCallbacks: boolean;
167
- renderSize: THREE.Vector2;
168
- maxStdDev: number;
169
- minPixelRadius: number;
170
- minAlpha: number;
171
- preBlurAmount: number;
172
- blurAmount: number;
173
- clipXY: number;
174
- focalAdjustment: number;
175
- sortRadial: boolean;
176
- private _fastSort;
177
- minSortIntervalMs: number;
178
- /**
179
- * Noise pattern index, wrapped to uint32. Each value selects an independent
180
- * pattern. Disable autoAdvanceStochasticSample for manual control.
181
- */
182
- stochasticSample: number;
183
- autoAdvanceStochasticSample: boolean;
184
- private _stochastic;
185
- private stochasticFrame;
186
- private _stochasticSort;
187
- private _premultipliedAlpha;
188
- private _encodeLinear;
189
- private _transparent;
190
- private readonly sortedBlending;
191
- private _depthTest;
192
- private _depthWrite;
193
- readonly timer: THREE.Timer;
194
- private readonly ownsTimer;
195
- lastFrame: number;
196
- updateTimeoutId: number;
197
- onDirty?: () => void;
198
- dirty: boolean;
199
- private readonly backend;
200
- private orderingBuffer;
201
- private orderingReady;
202
- private readonly headCamera;
203
- maxSplats: number;
204
- activeSplats: number;
205
- display: SplatAccumulator;
206
- current: SplatAccumulator;
207
- accumulators: SplatAccumulator[];
208
- sorting: boolean;
209
- sortDirty: boolean;
210
- lastSortTime: number;
211
- sortWorker: SplatWorker | null;
212
- sortedCenter: THREE.Vector3;
213
- sortedDir: THREE.Vector3;
214
- private sortedRadial;
215
- private sortedFastSort;
216
- private sortedMode;
217
- private sortCenterCache;
218
- private sortStateRevision;
219
- private uploadedSortStateRevision;
220
- private updateRunning;
221
- private updatePromise;
222
- private queuedUpdate;
223
- private disposed;
224
- private pendingProjectionShrink;
225
- private unsupportedCameraReported;
226
- constructor(options: GaussianSplatRendererOptions);
227
- raycast(_raycaster: THREE.Raycaster, _intersects: THREE.Intersection[]): void;
228
- static makeUniforms(): {
229
- renderSize: {
230
- value: THREE.Vector2;
231
- };
232
- viewportOrigin: {
233
- value: THREE.Vector2;
234
- };
235
- renderOrigin: {
236
- value: THREE.Vector3;
237
- };
238
- near: {
239
- value: number;
240
- };
241
- far: {
242
- value: number;
243
- };
244
- renderToViewQuat: {
245
- value: THREE.Quaternion;
246
- };
247
- renderToViewPos: {
248
- value: THREE.Vector3;
249
- };
250
- renderToViewScale: {
251
- value: number;
252
- };
253
- maxStdDev: {
254
- value: number;
255
- };
256
- minPixelRadius: {
257
- value: number;
258
- };
259
- minAlpha: {
260
- value: number;
261
- };
262
- edgeFade: {
263
- value: THREE.Vector2;
264
- };
265
- preBlurAmount: {
266
- value: number;
267
- };
268
- blurAmount: {
269
- value: number;
270
- };
271
- clipXY: {
272
- value: number;
273
- };
274
- focalAdjustment: {
275
- value: number;
276
- };
277
- encodeLinear: {
278
- value: boolean;
279
- };
280
- splatCount: {
281
- value: number;
282
- };
283
- ordering: {
284
- type: string;
285
- value: THREE.DataTexture;
286
- };
287
- splats: {
288
- type: string;
289
- value: THREE.Texture<unknown, THREE.TextureEventMap>;
290
- };
291
- splats2: {
292
- type: string;
293
- value: THREE.Texture<unknown, THREE.TextureEventMap>;
294
- };
295
- stochasticSeeds: {
296
- type: string;
297
- value: THREE.Texture<unknown, THREE.TextureEventMap>;
298
- };
299
- stochasticNoise: {
300
- value: THREE.DataTexture;
301
- };
302
- stochasticSample: {
303
- value: number;
304
- };
305
- stochastic: {
306
- value: boolean;
307
- };
308
- stochasticOrdering: {
309
- value: boolean;
310
- };
160
+ export declare class GaussianSplatRenderer extends THREE.Mesh<
161
+ SplatGeometry,
162
+ SplatMaterial
163
+ > {
164
+ readonly renderer: GaussianSplatCompatibleRenderer;
165
+ readonly uniforms: ReturnType<typeof GaussianSplatRenderer.makeUniforms>;
166
+ autoUpdate: boolean;
167
+ preUpdate: boolean;
168
+ /** @internal False for a second renderer on the same scene, so each `onFrame` runs once per frame. */
169
+ frameCallbacks: boolean;
170
+ renderSize: THREE.Vector2;
171
+ maxStdDev: number;
172
+ minPixelRadius: number;
173
+ minAlpha: number;
174
+ preBlurAmount: number;
175
+ blurAmount: number;
176
+ clipXY: number;
177
+ focalAdjustment: number;
178
+ sortRadial: boolean;
179
+ private _fastSort;
180
+ minSortIntervalMs: number;
181
+ /**
182
+ * Noise pattern index, wrapped to uint32. Each value selects an independent
183
+ * pattern. Disable autoAdvanceStochasticSample for manual control.
184
+ */
185
+ stochasticSample: number;
186
+ autoAdvanceStochasticSample: boolean;
187
+ private _stochastic;
188
+ private stochasticFrame;
189
+ private _stochasticSort;
190
+ private _premultipliedAlpha;
191
+ private _encodeLinear;
192
+ private _transparent;
193
+ private readonly sortedBlending;
194
+ private _depthTest;
195
+ private _depthWrite;
196
+ readonly timer: THREE.Timer;
197
+ private readonly ownsTimer;
198
+ lastFrame: number;
199
+ updateTimeoutId: number;
200
+ onDirty?: () => void;
201
+ dirty: boolean;
202
+ private readonly backend;
203
+ private readonly materialState;
204
+ private orderingBuffer;
205
+ private orderingReady;
206
+ private readonly headCamera;
207
+ maxSplats: number;
208
+ activeSplats: number;
209
+ display: SplatAccumulator;
210
+ current: SplatAccumulator;
211
+ accumulators: SplatAccumulator[];
212
+ sorting: boolean;
213
+ sortDirty: boolean;
214
+ lastSortTime: number;
215
+ sortWorker: SplatWorker | null;
216
+ sortedCenter: THREE.Vector3;
217
+ sortedDir: THREE.Vector3;
218
+ private sortedRadial;
219
+ private sortedFastSort;
220
+ private sortedMode;
221
+ private sortCenterCache;
222
+ private sortStateRevision;
223
+ private uploadedSortStateRevision;
224
+ private updateRunning;
225
+ private updatePromise;
226
+ private queuedUpdate;
227
+ private disposed;
228
+ private unsupportedCameraReported;
229
+ constructor(options: GaussianSplatRendererOptions);
230
+ raycast(_raycaster: THREE.Raycaster, _intersects: THREE.Intersection[]): void;
231
+ static makeUniforms(): {
232
+ renderSize: {
233
+ value: THREE.Vector2;
311
234
  };
312
- dispose(): void;
313
- /** Native WebGPU sorts on the GPU before drawing; WebGL sorts in a worker. */
314
- get synchronousSort(): boolean;
315
- setDirty(): void;
316
- private resetSortWorker;
317
- /**
318
- * Frees the worker, its sort state and the ordering, which unsorted draws
319
- * never read. Re-enabling sorting reallocates them and uploads centers.
320
- */
321
- private releaseOrdering;
322
- private takeAccumulator;
323
- private releaseAccumulator;
324
- private disposeOversizedAccumulators;
325
- /**
326
- * Draw stochastically exactly while the displayed accumulator was generated
327
- * for it: only stochastic accumulators carry sampling seeds, and only
328
- * sorted ones a back-to-front order. WebGL backends therefore switch modes
329
- * once an update for the new mode is displayed. Native WebGPU switches at
330
- * the update boundary too, keeping mode changes outside an active draw.
331
- */
332
- private syncStochasticFrame;
333
- private applyMaterialState;
334
- private reportedRenderError;
335
- private runAutomaticUpdate;
336
- private readonly viewportSize;
337
- private reportRenderError;
338
- onBeforeRender(renderer: GaussianSplatCompatibleRenderer, scene: THREE.Scene, camera: THREE.Camera): void;
339
- private prepareDraw;
340
- clearSplats(): void;
341
- update({ scene, camera, }: {
342
- scene: THREE.Scene;
343
- camera: THREE.Camera;
344
- }): Promise<void>;
345
- /** Updates the current scene and shrinks renderer work resources to their current allocation tiers. */
346
- shrinkResources({ scene, camera, }: {
347
- scene: THREE.Scene;
348
- camera: THREE.Camera;
349
- }): Promise<void>;
350
- private updateInternal;
351
- private drainUpdates;
352
- private performUpdate;
353
- /**
354
- * Viewpoint for generation, spherical harmonics, the render origin and
355
- * sorting: the camera, or for WebXR eyes their mean pose, the shared head.
356
- */
357
- private getGenerationCamera;
358
- private driveSort;
359
- /** Decode sRGB before blending; undefined follows the active blend space. */
360
- get encodeLinear(): boolean | undefined;
361
- set encodeLinear(value: boolean | undefined);
362
- get premultipliedAlpha(): boolean;
363
- set premultipliedAlpha(value: boolean);
364
- get transparent(): boolean;
365
- set transparent(value: boolean);
366
- get fastSort(): boolean;
367
- set fastSort(value: boolean);
368
- get stochasticSort(): boolean;
369
- set stochasticSort(value: boolean);
370
- get stochastic(): boolean;
371
- /**
372
- * Whether Splats currently draw stochastically. It follows `stochastic`
373
- * once an update for the new mode is displayed.
374
- */
375
- get stochasticActive(): boolean;
376
- set stochastic(value: boolean);
377
- get depthTest(): boolean;
378
- set depthTest(value: boolean);
379
- get depthWrite(): boolean;
380
- set depthWrite(value: boolean);
235
+ viewportOrigin: {
236
+ value: THREE.Vector2;
237
+ };
238
+ renderOrigin: {
239
+ value: THREE.Vector3;
240
+ };
241
+ near: {
242
+ value: number;
243
+ };
244
+ far: {
245
+ value: number;
246
+ };
247
+ renderToViewQuat: {
248
+ value: THREE.Quaternion;
249
+ };
250
+ renderToViewPos: {
251
+ value: THREE.Vector3;
252
+ };
253
+ renderToViewScale: {
254
+ value: number;
255
+ };
256
+ maxStdDev: {
257
+ value: number;
258
+ };
259
+ minPixelRadius: {
260
+ value: number;
261
+ };
262
+ minAlpha: {
263
+ value: number;
264
+ };
265
+ edgeFade: {
266
+ value: THREE.Vector2;
267
+ };
268
+ preBlurAmount: {
269
+ value: number;
270
+ };
271
+ blurAmount: {
272
+ value: number;
273
+ };
274
+ clipXY: {
275
+ value: number;
276
+ };
277
+ focalAdjustment: {
278
+ value: number;
279
+ };
280
+ encodeLinear: {
281
+ value: boolean;
282
+ };
283
+ splatCount: {
284
+ value: number;
285
+ };
286
+ ordering: {
287
+ type: string;
288
+ value: THREE.DataTexture;
289
+ };
290
+ splats: {
291
+ type: string;
292
+ value: THREE.Texture<unknown, THREE.TextureEventMap>;
293
+ };
294
+ splats2: {
295
+ type: string;
296
+ value: THREE.Texture<unknown, THREE.TextureEventMap>;
297
+ };
298
+ stochasticSeeds: {
299
+ type: string;
300
+ value: THREE.Texture<unknown, THREE.TextureEventMap>;
301
+ };
302
+ stochasticNoise: {
303
+ value: THREE.DataTexture;
304
+ };
305
+ stochasticSample: {
306
+ value: number;
307
+ };
308
+ stochastic: {
309
+ value: boolean;
310
+ };
311
+ stochasticOrdering: {
312
+ value: boolean;
313
+ };
314
+ };
315
+ dispose(): void;
316
+ /** Native WebGPU sorts on the GPU before drawing; WebGL sorts in a worker. */
317
+ get synchronousSort(): boolean;
318
+ setDirty(): void;
319
+ private resetSortWorker;
320
+ /**
321
+ * Frees the worker, its sort state and the ordering, which unsorted draws
322
+ * never read. Re-enabling sorting reallocates them and uploads centers.
323
+ */
324
+ private releaseOrdering;
325
+ private takeAccumulator;
326
+ private releaseAccumulator;
327
+ private disposeOversizedAccumulators;
328
+ /**
329
+ * Draw stochastically exactly while the displayed accumulator was generated
330
+ * for it: only stochastic accumulators carry sampling seeds, and only
331
+ * sorted ones a back-to-front order. WebGL backends therefore switch modes
332
+ * once an update for the new mode is displayed. Native WebGPU switches at
333
+ * the update boundary too, keeping mode changes outside an active draw.
334
+ */
335
+ private syncStochasticFrame;
336
+ private selectMaterial;
337
+ private applyMaterialState;
338
+ private reportedRenderError;
339
+ private runAutomaticUpdate;
340
+ private readonly viewportSize;
341
+ private reportRenderError;
342
+ onBeforeRender(
343
+ renderer: GaussianSplatCompatibleRenderer,
344
+ scene: THREE.Scene,
345
+ camera: THREE.Camera,
346
+ ): void;
347
+ private prepareDraw;
348
+ clearSplats(): void;
349
+ update({
350
+ scene,
351
+ camera,
352
+ excludedObjects,
353
+ }: {
354
+ scene: THREE.Scene;
355
+ camera: THREE.Camera;
356
+ /** @internal Models excluded during capture preparation, including descendants. */
357
+ excludedObjects?: ReadonlySet<THREE.Object3D>;
358
+ }): Promise<void>;
359
+ /** Updates the scene and compacts work and edit storage while retaining compiled kernels. */
360
+ shrinkResources({
361
+ scene,
362
+ camera,
363
+ }: {
364
+ scene: THREE.Scene;
365
+ camera: THREE.Camera;
366
+ }): Promise<void>;
367
+ private updateInternal;
368
+ private drainUpdates;
369
+ private performUpdate;
370
+ /**
371
+ * Viewpoint for generation, spherical harmonics, the render origin and
372
+ * sorting: the camera, or for WebXR eyes their mean pose, the shared head.
373
+ */
374
+ private getGenerationCamera;
375
+ private driveSort;
376
+ /** Decode sRGB before blending; undefined follows the active blend space. */
377
+ get encodeLinear(): boolean | undefined;
378
+ set encodeLinear(value: boolean | undefined);
379
+ get premultipliedAlpha(): boolean;
380
+ set premultipliedAlpha(value: boolean);
381
+ get transparent(): boolean;
382
+ set transparent(value: boolean);
383
+ get fastSort(): boolean;
384
+ set fastSort(value: boolean);
385
+ get stochasticSort(): boolean;
386
+ set stochasticSort(value: boolean);
387
+ get stochastic(): boolean;
388
+ /**
389
+ * Whether Splats currently draw stochastically. It follows `stochastic`
390
+ * once an update for the new mode is displayed.
391
+ */
392
+ get stochasticActive(): boolean;
393
+ set stochastic(value: boolean);
394
+ get depthTest(): boolean;
395
+ set depthTest(value: boolean);
396
+ get depthWrite(): boolean;
397
+ set depthWrite(value: boolean);
381
398
  }