Add a scene depth mode to the CameraFrame debug rendering - #9182
Merged
Conversation
The debug rendering could display the scene colour, the bloom, the SSAO, the vignette and both halves of the depth of field, but not the depth those effects are driven by - so anything depth related had to be inspected with a hand written material sampling uSceneDepthMap, which is what the gaussian splatting examples ended up doing. Adds 'depth', displaying the linear scene depth as a ramp over the camera's clip range. Like every other mode it only displays what the frame already produces: it does not request the depth, so a frame with no depth consumer renders black rather than quietly turning a producer on. That is what the internal depthmissing mode is - the requested mode resolves to it when nothing has published a depth, and a debug build explains the black screen once. The compose pass had no camera until now, so it takes the camera component for the depth encoding defines and the clip range, and sets camera_params only for this mode, leaving the rest of the composition untouched. The screenDepthPS include is inside the depth branch, as declaring the sampler in a frame with no depth bound to it is an error. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Public API reportThis PR changes the public API surface (+1 / −1), per the docs' rules (@ignore / @Private / undocumented are excluded). Show API diff-CameraFrame.debug: "scene" | "ssao" | "bloom" | "vignette" | "dofcoc" | "dofblur" | null
+CameraFrame.debug: "depth" | "scene" | "ssao" | "bloom" | "vignette" | "dofcoc" | "dofblur" | nullInformational only — this never fails the build. |
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.
CameraFrame.debugcould display the scene colour, the bloom, the SSAO, the vignette and both halves of the depth of field - but not the scene depth those effects are driven by. So inspecting anything depth related meant writing a material that samplesuSceneDepthMapby hand, on a layer rendered after the scene pass, which is what the gaussian splatting work ended up doing twice.Adds
'depth', displaying the linear scene depth as a ramp over the camera's clip range.A debug mode never changes what is rendered
The mode does not request the depth. A frame with no depth consumer renders black instead of quietly enabling a producer, so switching the debug view can never alter the thing being debugged. That is what the internal
depthmissingmode is for: the requested mode resolves to it when nothing has published a depth, and a debug build explains the black screen once:Changes
compose.js(GLSL and WGSL): aDEBUG_COMPOSE == depthbranch, plus thedepthmissingbranch which writes black.screenDepthPSis included inside the depth branch - declaring the sampler in a frame with no depth bound to it is an error, which is also why the missing case needs a mode of its own rather than an#ifdefaround the sampling.RenderPassCompose: had no camera at all until now, so it takes the camera component forShaderUtils.addScreenDepthChunkDefines(the depth encoding varies with the producer) and for the clip range.camera_paramsis set inexecuteonly in this mode, so the rest of the composition leaves camera state alone. The resolved mode and the depth encoding key both feed the shader name.FramePassCameraFrame: reports depth availability (sceneTextureDepth || prepassEnabled) to the compose pass each frame, and warns in a debug build when the mode has nothing to show.DebugType.DEPTHinscripts/esm/camera-frame.mjs, so the editor-facing script exposes it too.Notes
gammaCorrectOutput- a subject at 12..25 of a 70 unit far clip lands around 0.45..0.63 on screen. A log remap would give the near field more contrast at the cost of no longer being proportional to distance; not done here.DEBUG_COMPOSEwas already part of the compose shader key.🤖 Generated with Claude Code