Class GaussianSplattingGpuSorterExperimental
Constructors
constructor
-
new GaussianSplattingGpuSorter(
engine: AbstractEngine,
name?: string,
keyBits?: number,
): GaussianSplattingGpuSorterExperimentalCreates a GPU sorter. Shaders are compiled asynchronously: sort returns false until they are ready. Await GaussianSplattingGpuSorter.LoadDependenciesAsync before the first sort.
Parameters
- engine: AbstractEngine
the WebGPU engine
- name: string = "GaussianSplattingGpuSorter"
debug name
- keyBits: number = DefaultKeyBits
number of bits of the depth sort keys (8 to 24, default 16). Each 4 bits cost one radix pass; 16 bits is enough for most scenes.
Returns GaussianSplattingGpuSorter
- engine: AbstractEngine
Accessors
active Count
-
get activeCount(): number
ExperimentalNumber of splats rendered after applying the intervals (the number of keys sorted).
Returns number
key Bits
-
get keyBits(): number
ExperimentalNumber of bits of the depth sort keys.
Returns number
padded Count
-
get paddedCount(): number
ExperimentalNumber of output slots (activeCount rounded up to a multiple of 16).
Returns number
Methods
create Output
-
ExperimentalCreates an output receiving the sorted indices of one view. Use one output per camera that is sorted independently.
Returns GaussianSplattingGpuSortOutput
the new output
dispose
-
ExperimentalReleases all the GPU resources, including the outputs created by createOutput.
Returns void
set Intervals
-
ExperimentalRestricts the sort to ranges of source splats, like the CPU worker's
intervalsmessage.Parameters
- intervals: Nullable<ArrayLike<number>>
flat
[start0, count0, start1, count1, ...](start, COUNT pairs), or null to sort every splat
Returns boolean
false (and logs an error) if the packed intervals or padded active count exceed the scan or device storage-buffer limits. Overlapping intervals count each occurrence. Sorting is disabled until valid intervals or a valid source are set.
- intervals: Nullable<ArrayLike<number>>
set Part Matrices
-
setPartMatrices(
matrices: Nullable<
ArrayLike<number>
| readonly GaussianSplattingGpuSortMatrix[],
>,
): voidExperimentalSets the transform of each part of a compound mesh. Used instead of the world matrix given to sort when a part indices texture was set in setSource. The matrices are copied: call this again when they change.
Parameters
- matrices: Nullable<ArrayLike<number> | readonly GaussianSplattingGpuSortMatrix[]>
one matrix per part, or a flat array of 16 floats per part, or null for a non-compound mesh
Returns void
- matrices: Nullable<ArrayLike<number> | readonly GaussianSplattingGpuSortMatrix[]>
set Source
-
ExperimentalSets the splat data to sort.
Parameters
- source: IGaussianSplattingGpuSortSource
the source textures and layout
Returns boolean
false (and logs an error) if the source or active interval count exceeds GaussianSplattingGpuSorter.GetMaxSupportedSplatCount
- source: IGaussianSplattingGpuSortSource
sort
-
sort(
output: GaussianSplattingGpuSortOutput,
worldMatrix: GaussianSplattingGpuSortMatrix,
viewMatrix: GaussianSplattingGpuSortMatrix,
options?: IGaussianSplattingGpuSortOptions,
): booleanExperimentalEnqueues the sort of the active splats for a view. Call it outside of any render pass, once per output and per frame.
Parameters
- output: GaussianSplattingGpuSortOutput
the output receiving the sorted indices
- worldMatrix: GaussianSplattingGpuSortMatrix
world matrix of the mesh (ignored for compound meshes, which use the part matrices)
- viewMatrix: GaussianSplattingGpuSortMatrix
view matrix of the camera
Optionaloptions: IGaussianSplattingGpuSortOptionshandedness, camera position and depth range
Returns boolean
false if nothing was enqueued (unsupported active intervals, shaders still compiling, no source, or no depth range), true otherwise
- output: GaussianSplattingGpuSortOutput
StaticGet Max Supported Splat Count
-
ExperimentalGets the maximum number of splats the sorter can sort on an engine.
Parameters
- engine: AbstractEngine
the engine
Returns number
the maximum splat count
- engine: AbstractEngine
StaticIs Supported
-
ExperimentalWhether GPU sorting is available on an engine: a WebGPU engine with compute shader support.
Parameters
- engine: AbstractEngine
the engine
Returns boolean
true if a GaussianSplattingGpuSorter can be created
- engine: AbstractEngine
StaticLoad Dependencies Async
-
ExperimentalRegisters the WebGPU compute engine extension and loads the compute shaders of the sorter. The result is cached: calling it again returns the same promise. It must have completed before the first sort (which returns false until then). If loading fails, the promise rejects and the next call retries.
Returns Promise<void>
a promise resolved when the dependencies are ready
WebGPU compute depth sorter for Gaussian Splatting. It reproduces the ordering of the CPU sort worker (back-to-front counting sort) entirely on the GPU, and writes the sorted splat indices in a vertex buffer ready to be used as the instanced
splatIndexattributes (GaussianSplattingGpuSortOutput).Pipeline of a sort (all dispatches are enqueued on the engine's command encoder, without any CPU readback):
keyBits-bit key (farthest = smallest). Supports splat intervals, compound parts (per-part matrices) and SOG decoded means.ceil(keyBits / 4)passes of count, scan (2 levels) and scatter. No subgroup operation is required.vertexCount.Usage constraints:
onBeforeRenderObservable/onBeforeCameraRenderObservable).