Skip to content

feat: Respect gsplat alphaCull on CPU raster and compute paths#8687

Merged
mvaligursky merged 4 commits into
mainfrom
mv-gsplat-alphacull
May 6, 2026
Merged

feat: Respect gsplat alphaCull on CPU raster and compute paths#8687
mvaligursky merged 4 commits into
mainfrom
mv-gsplat-alphacull

Conversation

@mvaligursky

Copy link
Copy Markdown
Contributor

scene.gsplat.alphaCull was applied only on the hybrid GPU-sort projector path. CPU-sorted raster and the tiled compute renderer still used a hardcoded ~1/255 floor. This change aligns those renderers with the same threshold (with the existing max(1/255, alphaCull) convention used for hybrid/compute projection).

Changes:

  • Compute local renderer: non-pick dispatches pass max(ALPHA_VISIBILITY_THRESHOLD, alphaCull) into tile-count / raster alphaClip uniforms (same rule as hybrid sort).
  • CPU raster (GLSL/WGSL): forward pass discards using alphaCull; clipCorner and vertex early-out use alphaCull; guard sqrt(log(...)) when opacity is at or below the threshold.
  • Hybrid raster vertex (gsplatHybrid): alphaCull uniform for quad shrink; frameUpdate syncs alphaCull on forward and pick materials.
  • ALPHA_VISIBILITY_THRESHOLD exported from gsplat-unified/constants.js; gsplat-manager imports it instead of a local constant.

Public API: No changes — existing GSplatParams#alphaCull behavior now affects CPU raster and compute renderer paths consistently with hybrid GPU sort.

Performance: Raising alphaCull can reduce work on compute and CPU raster (fewer splats / smaller quads); lowering it preserves more translucent splats.

- Wire scene.gsplat.alphaCull into compute local renderer (matches hybrid projector clamp).
- Use alphaCull uniform in forward fragment shaders and clipCorner; sync hybrid VS.
- Export ALPHA_VISIBILITY_THRESHOLD from gsplat-unified constants; reuse in manager.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Aligns gsplat alpha-threshold handling so scene.gsplat.alphaCull is applied beyond the hybrid projector path, aiming to make CPU raster and compute/local rendering behave more consistently with the unified gsplat pipeline.

Changes:

  • Adds alphaCull-based culling/shrinking to CPU raster GLSL/WGSL vertex/fragment shaders.
  • Threads alphaCull through the hybrid renderer and compute-local renderer, while centralizing the historical 1/255 visibility floor in a shared constant.
  • Updates manager/renderer plumbing so hybrid/compute paths use the shared visibility threshold logic.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatHybrid.js Adds alphaCull to the hybrid WGSL vertex path for quad shrinking.
src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplatCommon.js Adds shared WGSL alphaCull uniform and clip-corner logic.
src/scene/shader-lib/wgsl/chunks/gsplat/vert/gsplat.js Switches WGSL vertex early-out from fixed floor to alphaCull.
src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplat.js Switches WGSL forward fragment discard from fixed floor to alphaCull.
src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplatCommon.js Adds shared GLSL alphaCull uniform and clip-corner logic.
src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplat.js Switches GLSL vertex early-out from fixed floor to alphaCull.
src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplat.js Switches GLSL forward fragment discard from fixed floor to alphaCull.
src/scene/gsplat-unified/gsplat-manager.js Reuses the shared alpha visibility constant in manager logic.
src/scene/gsplat-unified/gsplat-hybrid-renderer.js Syncs alphaCull onto hybrid forward/pick materials each frame.
src/scene/gsplat-unified/gsplat-compute-local-renderer.js Propagates alphaCull into compute-local non-pick dispatch thresholds.
src/scene/gsplat-unified/constants.js Exports the shared historical visibility floor constant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/scene/shader-lib/glsl/chunks/gsplat/frag/gsplat.js Outdated
Comment thread src/scene/shader-lib/wgsl/chunks/gsplat/frag/gsplat.js
Comment thread src/scene/shader-lib/glsl/chunks/gsplat/vert/gsplat.js Outdated

// discard splats with alpha too low to contribute any visible pixel
if (half(255.0) * clr.w <= half(1.0)) {
if (clr.w <= half(uniform.alphaCull)) {
Comment on lines +17 to +19
// modify the gaussian corner so it excludes gaussian regions below alphaCull (forward pass)
void clipCorner(inout SplatCorner corner, float alpha) {
float clip = min(1.0, sqrt(log(255.0 * alpha)) * 0.5);
float clip = min(1.0, sqrt(max(0.0, log(alpha / alphaCull))) * 0.5);
Comment on lines +17 to +19
// modify the gaussian corner so it excludes gaussian regions below alphaCull (forward pass)
fn clipCorner(corner: ptr<function, SplatCorner>, alpha: half) {
let clip = min(half(1.0), sqrt(log(half(255.0) * alpha)) * half(0.5));
let clip = min(half(1.0), sqrt(max(half(0.0), log(alpha / half(uniform.alphaCull)))) * half(0.5));

frameUpdate(params) {
this._material.setParameter('alphaClip', params.alphaClip);
this._material.setParameter('alphaCull', params.alphaCull);
Comment on lines +114 to +117
// clipCorner: shrink the quad to exclude near-zero alpha regions. Mirrors the
// helper in gsplatCommonVS (kept inline to avoid pulling in the full gsplatCommonVS).
let cornerUV = vec2f(vertex_position.xy);
let clip = min(half(1.0), sqrt(log(half(255.0) * alpha)) * half(0.5));
let clip = min(half(1.0), sqrt(max(half(0.0), log(alpha / half(uniform.alphaCull)))) * half(0.5));
@mvaligursky mvaligursky added the area: graphics Graphics related issue label May 5, 2026
@mvaligursky mvaligursky merged commit e232ddf into main May 6, 2026
8 checks passed
@mvaligursky mvaligursky deleted the mv-gsplat-alphacull branch May 6, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants