Repository navigation
feat: every lamp and fire in reach casts a cached shadow (GD3D11-like) - no more light through walls - #559
Open
BoroBongo wants to merge 2 commits into
Open
feat: every lamp and fire in reach casts a cached shadow (GD3D11-like) - no more light through walls#559BoroBongo wants to merge 2 commits into
BoroBongo wants to merge 2 commits into
Conversation
…) - candles in houses no longer light the street and distant walls Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… pass keeps Lit/World SRP batched Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
Every lamp and fire in reach casts a shadow from walls and VOBs, like in GD3D11. Candles inside houses no longer light the street, and distant buildings no longer show red patches through their walls.
Stacked on #555 (base
feature/pcvr-shadows-lighting), so the diff shows only the cache.LightShadowCacheDomain(owned byStationaryLightsService): a 16 bitTexture2DArray, 256 lights × 6 faces of 128×128 (48 MB). Every pooled lamp/fire in reach gets its surroundings drawn once into its six faces: the distance to the nearest wall or VOB. Lights baked into lightmaps and moving spell lights are excluded.GothicLightCachepass inLit-World,Lit-AlphaToCoverageandLit-SingleMesh(GothicShadowCaster.hlslwithGOTHIC_LIGHT_CACHE): writes the distance to the light. It has its own LightMode, so URP never draws it.StationaryLighting.hlsl,StationaryLightContribution): the light's slot is packed into its color alpha (indoor + 2 × (slot + 1)), and the world shader compares distances with a 2×2 bilinear filter. A light without a slot falls back to the roof rule of feat: PC shadows - sun/moon, lamps, torch and spells, the hero's own shadow, SSAO, darker nights (GD3D11-like) #555. PC only: Quest's shaders compile it away.Decision record:
Docs/adr/2026-11-23-cached-lamp-shadows.md. Technical:Docs/world-lighting.md→ "Shadows and darkness".Why
URP draws every shadow casting light again in every frame, six times, and takes about 40 at most. With 40 the frame rate tanked, and all other lamps lit through walls. GD3D11 keeps a light's shadow map and draws it again only when something changes; URP has no such cache (HDRP has).
How to test manually
PCVR build, quality High, Shadows on. G2, Khorinis at night:
Tested so far:
Save/load
Nothing saved. The cache is rebuilt after loading (about a second).
Known gaps / follow-ups