Skip to content

fix(renderer): cull splats by projected footprint - #397

Open
yingliang-zhang wants to merge 1 commit into
sparkjsdev:mainfrom
yingliang-zhang:fix/upstream-footprint-frustum-culling-v1
Open

fix(renderer): cull splats by projected footprint#397
yingliang-zhang wants to merge 1 commit into
sparkjsdev:mainfrom
yingliang-zhang:fix/upstream-footprint-frustum-culling-v1

Conversation

@yingliang-zhang

Copy link
Copy Markdown

Summary

  • replace center-only lateral clipXY rejection with conservative projected-footprint culling for standard 3D Gaussians
  • derive the NDC footprint bound from the final ellipse axes after covariance projection, blur, standard-deviation scaling, focal adjustment, and pixel-radius clamping
  • keep the 2DGS direct-corner path conservative by relying on GPU primitive clipping instead of rejecting by center
  • document the updated clipXY semantics and add a focused shader source-contract regression

Motivation

The vertex shader currently rejects a splat when its center is outside the lateral clipXY boundary. A large or anisotropic Gaussian can still overlap the retained region even when its center is outside that boundary, so the center-only test can remove visible border contributions.

This change waits until the projected covariance and final ellipse axes are available. It computes the ellipse's axis-aligned NDC extent and rejects only when the complete footprint misses the configured boundary. A one-projected-pixel padding with a small NDC floor keeps the comparison conservative at float32 boundaries.

Scope

This is the lateral X/Y part of the broader clipping discussion in #226. It intentionally leaves the existing behind-camera and near/far center tests unchanged; precise Gaussian truncation across near/far planes also interacts with sorting and requires a separate design.

For 2DGS, the existing direct-corner path has no equivalent projected-covariance bound. It now defers lateral clipping to normal GPU primitive clipping rather than retaining the old false-negative center test. The tradeoff is additional vertex work for off-screen 2DGS primitives.

Verification

  • npm run build:wasm
  • npm test — 2/2 passed
  • npm run lint — 85 files checked, no findings
  • npm run build — production and development bundles built successfully
  • real WebGL browser capture exercised the shader with no compilation or console errors

Related to #226; this PR does not close the near/far clipping request.

@yingliang-zhang
yingliang-zhang force-pushed the fix/upstream-footprint-frustum-culling-v1 branch from b578399 to 4f5ba10 Compare July 30, 2026 07:17
@asundqui

Copy link
Copy Markdown
Contributor

Hi @yingliang-zhang , thank you for your contribution. I agree that the way we are culling splats using just the splat center and clipXY isn't ideal, and can lead to large splats "popping" in and out and the boundaries of the screen. Your change does seem to make the culling more conservative and would slightly reduce popping. However, it also comes at the cost of culling fewer splats that aren't visible and slightly more code execution to determine if a splat can be culled.

However, I feel that neither our current solution nor yours really solves the problem on a more fundamental level... The original 3DGS formulation is an approximation with a very strange Z-plane aligned projection that causes problems with clipping and distortion. I think there are several more principled approaches:

In SparkRenderer there is a commented out option enableRayEval that we worked on previously (with Florian Hahlbohm of HTGS) that is intended to address the popping+artifacting along the lines of those three approaches. They all share the same per-fragment evaluation of 3DGS, which is more "3D correct".

This is a feature we intend to add to Spark in the near future to improve, stay tuned! cc: @oscarlorentzon @dmarcos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants