Repository navigation
Backlog
Description
Follow-ups from the review of #559 (cached lamp shadows). The PR fixed these: a CPU time budget instead of 3 lights per frame, the draw list built once per light, chunk bounds cached, collider overflow logged, a comment explaining the projection, and the ADR wording. These were left for later.
Change detection
- Replace the collider polling with a signal. Today, 4 drawn lights get a physics sphere query every frame, forever. Instead:
LightShadowCacheDomain.MarkDirty(Bounds), called where a lazily loaded VOB gets or loses its collider (theVobMeshCullingChangedpath). It queues the lights whose sphere intersects. ThenCountColliders,ColliderCountand_checkListgo away. - Counting colliders misses swaps (one removed and one added) and flaps on moving colliders (thrown items, doors), which re-renders again and again and bakes the moving object in. A moving lamp is re-queued at every rebalance, because positions are compared exactly (
Vector3 !=). Use a small tolerance (~5 cm). -
chunk.enabledis a snapshot at draw time. A chunk that is disabled at that moment leaves a permanent hole in the light's shadow. Drop the check, or confirm nothing ever disables chunks. - A VOB whose collider is on a parent or child of its renderer casts nothing (
TryGetComponentonly looks at the collider's own GameObject).
Lifecycle / contracts
-
Dispose(). The atlas (48 MB),_faceTarget,_cmdand_emptyAtlasare only freed bySetEnabled(false)(_cmdand_emptyAtlasnever). Call it from the service teardown. - One contract in three places: FaceSize (C# const +
#define), the face tables (C# + HLSL), the alpha encodingindoor + 2*(slot+1)(encoded in the service, decoded in HLSL), and the 0.05 near plane (copied from the service). Move the encoding intoLightShadowCacheDomain.EncodeSlotAlpha, upload FaceSize as a global (or add a test), and share one near-plane constant. -
Capacity(256): if it is meant to equal the pool size, reference the pool's constant.
Shaders / build
- The
GothicLightCachepass is compiled into Quest builds (instancing x_WIND) but never used there. Wrap it in#if !defined(SHADER_API_MOBILE)or strip it. - The
UnityPerMaterialCBUFFER is copied into every pass (Lit-World has 5 copies). Use one include per shader so the copies can't drift apart and silently break SRP batching. -
Lit-AlphaToCoverage-Dynamicuses plainAdditionalStationaryDiffuse, so a focused alpha-tested object is lit through walls (no cache, no shadow). This was already the case before the PR.
Small
- The "N lights cached" log fires on every queue drain, including check-driven re-renders (a flapping light spams the build log).
-
_passIndicesgrows for every material seen until the world changes._renderQueue.RemoveAllallocates a delegate per rebalance. - Docs:
architecture.md"Where does my code go?" has no row for GPU infrastructure (render textures, command buffers ->Domain/Meshes/<Name>Domain). The ADR doesn't say why a URP renderer feature was not used.
Metadata
Metadata
Assignees
Labels
No labels
Activity