Parent: #126
Problem
Bloom's cascaded sun shadows and per-light approaches cannot scale to UE-class geometric detail and many shadowed lights without fixed-resolution waste, aliasing, cascade transitions, or a shadow-map-per-light explosion. #11 already identifies virtual shadow maps as a major visual gap.
Outcome
Page-cached virtual shadow maps (VSMs) for directional, spot, and point lights on capable tiers, with stable filtering, explicit invalidation, bounded memory, and a correct cascaded/conventional fallback.
Architecture contract
Address space and cache
- Per-light virtual address space mapped through page tables to a shared physical page pool.
- Directional light uses camera-centered clip levels with stable texel/page snapping.
- Spot lights use a 2D projection; point lights use a documented cube/octahedral representation.
- Page metadata tracks owner, virtual coordinate, last use, dirty state, and generation.
- Fixed memory budget with deterministic allocation/eviction and coarse fallback coverage.
Page demand and rendering
- Mark pages from the camera-visible receiver set; optionally use depth/visibility buffer to avoid requesting empty screen regions.
- Compact requested/dirty pages on GPU.
- Cull shadow casters against each page and issue GPU-driven page renders where supported.
- Static pages persist. Dynamic caster/light/transform changes invalidate only affected pages, conservatively.
- Missing pages sample a coarser resident level or conventional fallback—never unshadowed by accident.
Sampling and quality
- Cross-page filtering must not reveal seams; include borders/gutters or neighbor-aware sampling.
- Receiver-plane/depth bias and normal bias are scene-scale aware and exposed through quality presets, not arbitrary per-scene hacks.
- Directional clip-level transitions blend without visible rings.
- Alpha-tested casters preserve coverage. Translucent colored shadows are out of scope unless explicitly added later.
Capability fallback
- High tier: VSM page marking/caching/GPU-driven render.
- Middle/baseline tier: improved CSM/conventional per-light maps with cascade blending and caching.
- Capability report states which path is active and why.
Milestones
- Directional-light address/page table with debug visualization.
- Receiver demand, physical cache, and coarse fallback.
- Static/dynamic invalidation and GPU-driven caster submission.
- Seam-safe filtering and clip-level blending.
- Spot and point light support plus shared budget arbitration.
- Quality-tier integration and fallback qualification.
Acceptance criteria
Likely files
native/shared/src/shadows.rs
native/shared/src/renderer/graph.rs, scene_pass.rs, hiz.rs, shader modules
- scene/light data in
native/shared/src/
- public quality/capability APIs in
src/
Verification
Run the quality corpus with camera cuts, rapid movement, dynamic casters, alpha-tested assets, and a forced small page budget. Attach uncapped GPU timings, cache statistics, memory, and fallback captures.
Non-goals
- Ray-traced shadows replacing VSMs everywhere.
- Requiring VSMs on low tiers.
- Colored translucent shadow transport.
Dependencies
Parent: #126
Problem
Bloom's cascaded sun shadows and per-light approaches cannot scale to UE-class geometric detail and many shadowed lights without fixed-resolution waste, aliasing, cascade transitions, or a shadow-map-per-light explosion. #11 already identifies virtual shadow maps as a major visual gap.
Outcome
Page-cached virtual shadow maps (VSMs) for directional, spot, and point lights on capable tiers, with stable filtering, explicit invalidation, bounded memory, and a correct cascaded/conventional fallback.
Architecture contract
Address space and cache
Page demand and rendering
Sampling and quality
Capability fallback
Milestones
Acceptance criteria
Likely files
native/shared/src/shadows.rsnative/shared/src/renderer/graph.rs,scene_pass.rs,hiz.rs, shader modulesnative/shared/src/src/Verification
Run the quality corpus with camera cuts, rapid movement, dynamic casters, alpha-tested assets, and a forced small page budget. Attach uncapped GPU timings, cache statistics, memory, and fallback captures.
Non-goals
Dependencies