Repository navigation
fix(core): keep shadow maps bound in passes without the LightingEffect (4/5) - #10903
Closed
charlieforward9 wants to merge 18 commits into
Closed
charlieforward9 wants to merge 18 commits into
charlieforward9 wants to merge 18 commits into
Conversation
… off EffectManager reuses the existing LightingEffect and calls setProps when a new one is passed. Turning the last `_shadow` light off kept the shadow module registered as a default module, but getShaderModuleProps stopped passing the dummy shadow map, so shadow_uShadowMap0/1 were unbound and every layer skipped drawing. Call cleanup() from setProps when no light casts shadows, so layers are rebuilt without the module. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Layer._drawLayer applies `getPolygonOffset` (default [0, -layerIndex * 100]) in every pass. The shadow map stores gl_FragCoord.z, which includes the offset, so the k-th layer drawn in the shadow pass stored a depth k * 100 * 2^-16 closer to the light. From the third layer on, layers fell partly or fully into their own shadow. ShadowPass now sets depthBias: 0 so the shadow map is drawn without the offset. Co-Authored-By: Claude Opus 5.5 <[email protected]>
getViewProjectionMatrices fitted the light frustum to the points where the viewport corner rays hit the ground. With the default fov, the top corners reach the horizon at pitch ~71.6. Just below it the hits are far beyond the camera's far plane (light frustum 20 x 28 km at pitch 72, 63 m texels). Above it they are behind the camera, so the shadow map no longer covers the visible scene. Shadows disappear, and fragments past the light frustum's far plane are always shadowed (black areas). Fit the light frustum to the view frustum clipped to z >= 0 instead: the frustum corners above the ground plus the points where frustum edges cross the ground. When every corner ray hits the ground before the far plane, this gives the same points as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#10187 gives every default shader module empty props in passes whose effects don't supply them, so that their getUniforms always runs. The LightingEffect sits out of picking, so with a `_shadow` light the shadow module's getUniforms({}) returned `shadow_uShadowMap0/1: undefined` there. luma.gl merged that over the bound shadow maps and skipped every draw with a missing texture binding: nothing could be picked, for any layer. createShadowUniforms now returns the dummy-map bindings only when it has a dummy map, so a pass without the effect keeps the maps already bound (`useShadowMap` is false, so nothing samples them). Co-Authored-By: Claude Opus 5.5 <[email protected]>
[Medium impact] The PR appears safe to merge; no actionable issues remain. SummaryKeeps shadow-map bindings unchanged when a pass leaves out
Reviews (6) · Last reviewed commit: "Merge branch 'master' into fix/shadow-mo..." · Reviewed by Greptile |
# Conflicts: # test/modules/core/passes/shadow-pass.spec.ts # test/render/test-cases/effects.spec.ts
…-high-pitch # Conflicts: # test/render/test-cases/effects.spec.ts
…eep-bindings # Conflicts: # test/modules/core/shaderlib/shadow/shadow.spec.ts
If pickObject throws or the assertion fails, the test rejected without finalizing the Deck, leaving its animation loop and GPU resources alive on the shared device for later tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
charlieforward9
changed the base branch from
master
to
fix/shadow-frustum-high-pitch
October 26, 2026 04:00
# Conflicts: # test/render/test-cases/effects.spec.ts
# Conflicts: # test/modules/core/shaderlib/shadow/shadow.spec.ts
This was referenced Oct 26, 2026
ibgreen
reviewed
Oct 26, 2026
ibgreen
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the current head. CI passes and the existing review thread is resolved. I found no remaining blocker; this looks ready for approval.
ibgreen
approved these changes
Oct 26, 2026
This was referenced Oct 28, 2026
Member
Author
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.
Closes #10902. Part 4 of 5 of the shadow fixes; parts 1–3 (#10892, #10891, #10893) have merged, and #10913 follows. Introduced by #10187.
Since #10187, passes give every default shader module empty props when their effects don't supply any.
LightingEffectsits out of picking, so under a_shadowlight theshadowmodule returnsundefinedshadow-map bindings during picking. luma.gl then skips every pick draw, and no layer can be picked.Change List
createShadowUniforms: return no bindings when there is no dummy shadow mapLightingEffectkeep the maps already bound;useShadowMapis false there, so nothing samples themDeck#picking under a shadow lightfails on masterThis also keeps layers drawing when a shadow light is switched off (#10888's path); #10891 releases the shadow resources in that case. Verified with the core
shaderlib/shadow,effects,passes,deck,deck-pickerandpick-layerstests,test/modules/extensions, and theeffectsandterrain-layerrender tests.