POC / Radiance Cascades

Trying to build up my intuition around Suslik's Radiance Cascades GI approach.

2D

Things are simpler in 2D so we'll start there.

Radiance Intervals (2D)

In 2D these are bands/shells/annuluses/crusts(🍕) of radiance values where relative to the previous level, each cascade level:

  • doubles the inner radius of the band
  • doubles the width of the band
  • doubles the number of rays per probe
  • halves the total number of rays

level 0 ray count:

branching factor(Nlevel):

Ray Distributions (2D)

level:

2level spacing (level 0):

branching factor(Nlevel):

color lower levels:

show cascade ray counts:

Probe Ray Interpolation (2D)

min level:

max level:

branching factor(Nlevel):

level 0 ray count:

Probe Rays vs Light (2D)

Visualize the radiance intervals that have a light in their bounds by drawing the quantized angle to the light

click/drag to move the light

min level:

max level:

light radius:

show light/probe overlap

branching factor(Nlevel):

Flatland (2D)

Debug/Development

run continuously and collect frame timings
timings
render world mip level
render probe directions
disable brush preview
raymarch mipmap N on cascade level N
raymarch with dda
raymarch fixed size step multiplier:

Radiance Cascade Parameters

2i spacing (level 0):
2r raycount (level 0):
branching factor:
interval radius (level 0):
interval accumulation decay:
max probe level:

Brush Parameters

erase
brush opacity:
brush radiance:
brush radius:
brush color:

approach

  • storage: create an 'SSBO' for probes that has enough space to cover level 0 (e.g., probeCount * raysPerProbe). Double this size so we can ping pong cascade levels

  • raymarch: for level=max..0

    • cast rays from the probe center offset by the level's interval start
    • dda through the world texture (emitters / occluders)
    • if ray hits an emitter write store radiance in SSBO
    • if ray hits occluder write 0 into SSBO
    • if ray hits nothing (and level < max)
      • fetch upper level ray values per probe
      • bilinear interpolate between these 4 values and store the result in SSBO
  • irradiance: compute irradiance per probe by accumulating the averaging the probe values stored in SSBO (e.g., average of all rays for the associated level 0 probe)

This demo requires WebGPU - in other words, you should open this page in Chrome or Edge.

3D

Probe Ray Distribution (3D)

(Work in progress)

ray packing:
min level:
max level:

This demo requires WebGPU - in other words, you should open this page in Chrome or Edge.

Fuzz World (3D)

(Work in progress)

This demo requires WebGPU - in other words, you should open this page in Chrome or Edge.