Skip to main content

Module radiance

Module radiance 

Source
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:

  1. Scene pass: CPU writes emissive/occluder data to a scene texture
  2. Ray-march pass (per cascade): probes cast rays through the scene
  3. Merge passes: upper cascades merge into lower (propagates far-field radiance)
  4. Finalize pass: cascade 0 probes sum rays, produces light texture
  5. Composition: sprite shader reads light texture to modulate output

Structs§

DirectionalLight
A directional light (infinite distance, parallel rays).
EmissiveSurface
An emissive surface that radiates light.
Occluder
A rectangular occluder that blocks light.
RadiancePipeline
The radiance cascade compute pipeline.
RadianceState
Radiance state gathered from TypeScript each frame.
SpotLight
A spot light with position, direction, and spread.