Gaussian splats write the scene depth - #9175
Merged
Merged
Conversation
The scene depth texture had no producer for gaussian splats, so effects consuming it - volumetric fog, DOF, SSAO - had nothing to stop at in a splat only scene, and needed a proxy mesh in the depth prepass to work at all. The forward pass already composites the splats with premultiplied blending, which accumulates a transmittance weighted depth for free once the depth is written alongside the color, so this needs no second pass over the splats. The forward gsplat chunks now write vLinearDepth to the scene depth attachment when SCENE_TEXTURE_DEPTH is defined, which the camera sets when the depth is being produced in the scene pass. The linear depth varying, previously generated for the prepass only, is generated for that define as well - in all three vertex chunks, including the hybrid one. Dithered splats render as opaque, so the fragments surviving the dither write full coverage rather than their alpha. Both renderers set `sceneTexturesWrite` on the forward material from `GsplatParams.sceneDepthWrite` per frame. That only selects the blend state, as the write itself is driven by the define, so following the scene setting from frame to frame costs no shader rebuild. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Build size reportThis PR changes the size of the minified bundles.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes gaussian splats a producer of the scene depth texture, so the effects consuming it work in a splat scene with no proxy geometry of any kind.
Until now the depth those effects sample came from the depth prepass, which renders opaque meshes only - in a splat scene it produces nothing, so volumetric fog flooded the frame, DOF blurred everything uniformly, and SSAO had no surfaces. The workaround was to ship a proxy mesh alongside the capture and keep it out of the forward pass, as
gaussian-splatting/depth-of-fielddoes today. Splats cannot be rendered into the prepass instead, as a single hard depth per pixel is not what a cloud of semi transparent gaussians has.What makes this cheap is that the forward pass already composites the splats with premultiplied blending, which accumulates
Σ d·α·Twhen the depth is written next to the color - a transmittance weighted depth, for the cost of one extra attachment write and no second pass over the splats. That is exactly the soft depth a raymarched effect wants, and #9174 put the scene pass MRT and theSCENE_TEXTURE_DEPTHdefine in place for it.Changes
writeSceneTextureDepthunderSCENE_TEXTURE_DEPTH. Dithered splats render as opaque, so the fragments which survive the dither write full coverage instead of their alpha.vLinearDepth, previously generated for the prepass only, is generated for that define as well - in all three vertex chunks, hybrid included.GSplatQuadRendererandGSplatHybridRenderersetsceneTexturesWriteon the forward material fromGsplatParams.sceneDepthWriteeach frame. That only selects the blend state - the write itself is driven by the define - so following the scene setting frame to frame needs no shader rebuild.Notes
Scene#gsplat.sceneDepthWritegates it, andCameraFrame.isSplatSceneDepthSupported(device)reports whether the device can do it at all.