Expand description
Radiance Cascades 2D Global Illumination
Implements Alexander Sannikov’s Radiance Cascades algorithm using wgpu compute shaders. Provides real-time 2D GI with emissive surfaces, occluders, and light propagation.
Architecture:
- Scene pass: CPU writes emissive/occluder data to a scene texture
- Ray-march pass (per cascade): probes cast rays through the scene
- Merge passes: upper cascades merge into lower (propagates far-field radiance)
- Finalize pass: cascade 0 probes sum rays, produces light texture
- Composition: sprite shader reads light texture to modulate output
Structs§
- Directional
Light - A directional light (infinite distance, parallel rays).
- Emissive
Surface - An emissive surface that radiates light.
- Occluder
- A rectangular occluder that blocks light.
- Radiance
Pipeline - The radiance cascade compute pipeline.
- Radiance
State - Radiance state gathered from TypeScript each frame.
- Spot
Light - A spot light with position, direction, and spread.