Builtin Library
- ..
- README.md1.8 KB
- bindings.yaml1.1 KB
- shader.wgsl5.2 KB
README.md
splat_cull
Stage 1 of the Gaussian splat per-frame depth sort. One thread per splat.
Transforms the splat's packed position to world space, frustum-culls it at three
sigma (the Gaussian's visible support), computes its view depth from the
clip-space w, and files the survivor into one of bucket_count depth buckets
ordered far to near. The bucket id lands in keys[i]; a culled splat gets
bucket_count, one past the last real bucket, so it sorts behind every survivor
and the scatter can recognise it.
Buckets are spaced logarithmically between near and far, so each spans a
constant ratio of depth: near geometry gets the same relative ordering precision
as far geometry.
indices is seeded to the identity permutation the radix passes start from.
Bindings
| Slot | Access | Contents |
|---|---|---|
records | read | Packed splat records, 6 u32 words each. |
view | read | CullUniforms — view-projection, model, frustum planes, params. |
keys | read_write | Per-splat depth bucket, or bucket_count when culled. |
indices | read_write | The sort's input permutation, seeded to the identity. |
stats | read_write | [0] = surviving splat count (atomic). |
A splat whose whole footprint projects to less than screen.z pixels of
radius is dropped as well. Distance shrinks that projection, so a cloud far from
the camera resolves to progressively fewer splats while a near one keeps every
splat it has. The radius is estimated by projecting the three world axes from
the splat's centre and keeping the widest, which holds under a sheared or
non-uniformly scaled cloud.
params is (splat count, bucket count, near depth, far depth) and screen is
(viewport width, viewport height, min screen radius in pixels, 0).
Dispatch one workgroup of 64 per 64 splats.