Repository navigation
Conversation
…read-buffer path renderOcclusionMapFromReadBuffer() rendered occlusionMapQuad, but wrote the environment depth texture into occlusionMeshMaterial's uniforms instead — a material that's unused in this path. occlusionMapQuad's uDepthTexture was left unbound, sampling as 0 and producing a zero occlusion mask (fully black output). Fixes google#531
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Collaborator
|
Checked on the simulator and looks like it's working. Tho we don't have a sample to show it so it requires some significant changes in the code to activate. |
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.
Pull Request Template
Description
Fixes read-buffer composition in
OcclusionPass(src/depth/occlusion/OcclusionPass.ts).renderOcclusionMapFromReadBuffer()rendersocclusionMapQuad, aShaderMaterialbacked by
occlusionMapUniforms. However, the environment depth texture (storedearlier by
setDepthTexture()) was being written intoocclusionMeshMaterial'suniforms instead — a material that is only used as
scene.overrideMaterialin theseparate
renderOcclusionMapFromScene()path, and is never bound toocclusionMapQuad.As a result,
occlusionMapQuad'suDepthTextureuniform was left unbound. Anunbound sampler reads as 0, so the depth comparison in
occlusion_map.glslalways evaluated to a zero occlusion mask — producing a fully black output
whenever
OcclusionPasswas driven from a read buffer (postprocessing mode)rather than the scene-override mode.
Fix: bind the environment depth texture (and the related
uViewId/uIsTextureArraystate) toocclusionMapUniforms— the uniform bag actuallyconsumed by
occlusionMapQuad— instead ofocclusionMeshMaterial.uniforms.Known follow-up (out of scope for this PR):
OcclusionMapShader(
occlusion_map.glsl.ts) currently only declares a plainsampler2D uDepthTextureand has no texture-array /uDepthNear/ per-vertexreprojection support, unlike
OcclusionMapMeshMaterial's shader (whichreprojects virtual depth into the depth camera's space via
uDepthViewMatrix/uDepthProjectionMatrix). So theisTextureArraybranchin
renderOcclusionMapFromReadBuffer()sets state that the shader doesn'tyet read, and the read-buffer path currently assumes the environment depth
texture aligns directly (same UV space) with the rendered view. Extending
occlusion_map.glslto support texture-array depth and reprojection istracked separately and not addressed here to keep this fix minimal and
reviewable.
Fixes #531
Type of Change
Media / Screen Recordings & Screenshots (If Applicable)
Checklist
npx vitest run src/depth(added a regression test assertingocclusionMapQuad's shader receives the depth texture, and thatocclusionMeshMaterialdoes not);