Class GaussianPointSplattingRenderer
Constructors
constructor
-
Creates a new Gaussian Point Splatting renderer.
Parameters
- engine: AbstractEngine
the (WebGPU) engine to allocate compute resources on
Returns GaussianPointSplattingRenderer
- engine: AbstractEngine
Properties
compensation
Whether the source material enables antialiasing opacity compensation (classic COMPENSATION).
debug Active
1 when any per-part debug knob is active (drives the preprocess debug branch); 0 otherwise.
is Orthographic
Whether the active camera is orthographic (selects the ortho Jacobian in computeCov2D).
kernel Size
Low-pass antialiasing dilation, in the classic material's kernelSize units.
max Accum Frames
Cap on each output pixel's accumulated sample count (clamped to 1..65535). Past the cap later samples blend in at 1/(cap+1), so the image keeps refreshing instead of freezing.
min Pixel Size
Classic material's minPixelSize: splats whose projected diameter is below this many output pixels are skipped (0 = off).
occlusion Culling
Hi-Z occlusion culling: skip Gaussians fully behind the previous frame's nearest samples. Off by default because those stochastic samples may be semi-transparent, so culling biases the converged image. The depth pyramid is allocated only while enabled.
point Scale
Sample-density multiplier on the (importance-calibrated) point count. Keep at 1 for exact coverage = opacity*gaussian; other values trade noise for cost but bias the alpha.
right Handed System
Whether view-space forward is negative (right-handed scenes).
Accessors
accum Buffer
-
get accumBuffer(): Nullable<StorageBuffer>
The resolved, full-float accumulation buffer (
array<vec4f>, row-major, y * width + x). Bound read-only by the blit material's fragment shader. Null until the first render.Returns Nullable<StorageBuffer>
accum Depth Buffer
-
get accumDepthBuffer(): Nullable<StorageBuffer>
Per-pixel resolved surface depth (NDC z in the scene's convention), bound read-only by the blit material to write fragDepth for compositing. Null until the first render.
Returns Nullable<StorageBuffer>
accumulation Version
-
get accumulationVersion(): number
Changes whenever accumulated samples are invalidated (camera, parts, data, density or output size). A change of the upscale factor alone does not bump it; callers must reset accumulation. Wraps at 65536.
Returns number
the current accumulation generation
gaussian Count
-
get gaussianCount(): number
Number of Gaussians currently loaded.
Returns number
height
-
get height(): number
Current internal render height, in pixels.
Returns number
output Height
-
get outputHeight(): number
Output (full) height the accumulation buffer is sized to.
Returns number
output Width
-
get outputWidth(): number
Output (full) width the accumulation buffer is sized to (what the blit samples).
Returns number
pixel Cycle Length
-
get pixelCycleLength(): number
Number of frames required to visit every output pixel once at the current render scale.
Returns number
the current jitter-cycle length,
N * N
rendered Frame Count
-
get renderedFrameCount(): number
Number of compute frames successfully dispatched since this renderer was created. This does not reset when accumulated samples are invalidated.
Returns number
the lifetime successful-dispatch count
width
-
get width(): number
Current internal render width, in pixels.
Returns number
Methods
dispose
-
Releases all GPU resources owned by the renderer.
Returns void
is Ready
-
Whether the whole compute pipeline is compiled and ready to dispatch.
Returns boolean
true once every compute shader is ready
read Point Count Async
-
Reads back the total emitted point count from the last dispatched frame (async GPU readback). Used by the budget-driven auto render-scale controller.
Returns Promise<number>
the emitted point count (0 if never dispatched)
render To Buffer
-
renderToBuffer(
width: number,
height: number,
outWidth?: number,
outHeight?: number,
upsampleN?: number,
jitterX?: number,
jitterY?: number,
): booleanRuns the per-frame GPS compute pipeline for the given viewport, leaving the result in accumBuffer. Allocates/resizes buffers on demand.
Parameters
- width: number
internal render (low) width in pixels; must be
ceil(outWidth / upsampleN) - height: number
internal render (low) height in pixels; must be
ceil(outHeight / upsampleN) - outWidth: number = width
output (full) width the accumulation is reconstructed at
- outHeight: number = height
output (full) height
- upsampleN: number = 1
integer upscale factor; 1 = no upsampling
- jitterX: number = 0
this frame's sub-cell offset x in [0, N)
- jitterY: number = 0
this frame's sub-cell offset y in [0, N)
Returns boolean
true if the pipeline dispatched, false if it was not ready / had nothing to draw
- width: number
reset Accumulation
-
Restarts progressive accumulation; each output pixel is overwritten on its next visit. The cached view-projection is kept, otherwise the next renderToBuffer would detect a move and reset again.
Returns void
set Camera
-
setCamera(
view: Matrix,
viewProjection: Matrix,
near: number,
far: number,
focalX: number,
focalY: number,
camX: number,
camY: number,
camZ: number,
viewZMin: number,
viewZMax: number,
): voidSets the camera state used to project Gaussians on the next render.
Parameters
- view: Matrix
world-to-view matrix
- viewProjection: Matrix
world-to-clip matrix
- near: number
near plane distance
- far: number
far plane distance
- focalX: number
horizontal focal length in pixels
- focalY: number
vertical focal length in pixels
- camX: number
camera world position x
- camY: number
camera world position y
- camZ: number
camera world position z
- viewZMin: number
the model's minimum view-space depth this frame (depth-key normalization range)
- viewZMax: number
the model's maximum view-space depth this frame
Returns void
- view: Matrix
set Part Data
-
Uploads the per-part records (see GpsPart) and restarts accumulation when they changed.
Parameters
- packed: Float32Array
part records,
count * 40floats (world matrix + visibility + 5 debug rows per part) - count: number
number of parts (at least 1)
Returns void
- packed: Float32Array
set Projection Matrix
-
Sets the full projection for covariance, per-pixel depth and oblique clipping.
Parameters
- projection: Matrix
camera projection matrix
- inverseProjection: Matrix
inverse of the projection matrix
- reverseDepth: boolean = false
whether larger NDC depth values are nearer
Returns void
- projection: Matrix
set Projection Z
-
Sets the projection matrix's z-row (column-major m10, m11, m14, m15), used by resolve to map the view-z depth key back to ndc.z for fragDepth (it encodes the reverse-Z / half-Z convention).
Parameters
- m10: number
projection.m[10]
- m11: number
projection.m[11]
- m14: number
projection.m[14]
- m15: number
projection.m[15]
Returns void
- m10: number
supports Workload
-
supportsWorkload(
gaussianCount: number,
shDegree: number,
outWidth: number,
outHeight: number,
): booleanTrue when the storage buffers required by the given workload fit in the device limits. Callers must fall back to another renderer when it is false, otherwise buffer creation raises a validation error.
Parameters
- gaussianCount: number
number of Gaussians to render
- shDegree: number
spherical-harmonics degree of the data (0-4)
- outWidth: number
output (full) width in pixels
- outHeight: number
output (full) height in pixels
Returns boolean
whether the workload can be allocated on this device
- gaussianCount: number
update Splats
-
updateSplats(
means: Float32Array,
cov3d: Uint32Array,
colorOpacity: Uint32Array,
sh: Nullable<Uint32Array<ArrayBufferLike>>,
shDegree: number,
count: number,
): voidUploads decoded splat data into per-Gaussian GPU buffers, replacing any previous data.
Parameters
- means: Float32Array
packed positions, 4 floats per Gaussian (x, y, z, unused)
- cov3d: Uint32Array
packed 3D covariance, 4 u32 per Gaussian (3 f16 pairs of Sigma/factor + f32 factor)
- colorOpacity: Uint32Array
packed RGBA8 base color + opacity, 1 u32 per Gaussian
- sh: Nullable<Uint32Array<ArrayBufferLike>>
8-bit-quantized SH coefficients packed 4 bytes/u32 (GPS_SH_WORDS per Gaussian), or null
- shDegree: number
spherical-harmonics degree (0 = view-independent color)
- count: number
number of Gaussians
Returns void
- means: Float32Array
Owns the WebGPU compute pipeline and GPU buffers for Gaussian Point Splatting (the stochastic, sort-free point-splatting technique). Engine-focused: it knows nothing about the scene graph beyond the camera matrices and viewport size handed to it.
Per-frame pipeline (dispatched before the render pass): preprocess (1 thread/Gaussian: transform, cull, cache screen state, emit a point weight) scan (Blelloch prefix sum of the weights into a CDF + GPU-written indirect dispatch args) partition (bucketed point-to-Gaussian table that narrows the splat search) splat (indirect, 1 thread/point: find its Gaussian in the CDF, atomicMin its sample) resolve (accumulate the packed image buffer into the full-float buffer, reset it) hi-Z build (max-reduce this frame's depth into next frame's occlusion pyramid)