Penumbrae get softer with distance, and that is the whole trick

Built on radiance cascades by Alexander Sannikov. Sources for this reference

This is the note behind radiance cascades. It opens with the observation the technique is built on, because the structure only makes sense once that is in front of you, so the first demo below is deliberately the naive method a cascade exists to replace. The cascade's own structure is the second demo.

Real bounced light in a 2D scene is not hard to write. Every pixel asks in every direction whether it can see a light, and averages what comes back. It is about twenty lines and it is beautiful, and the ray count you need makes it unusable.

Naive gathered lighting, two emitters and three occluders. Left: 6 rays per pixel. Right: 64. Both march the same scene.

Six rays gives coarse structured noise, worst in exactly the wide soft penumbrae the technique was for. Sixty-four is much better and is over ten times the cost, and it is still visibly grainy, because stochastic gathering converges as the square root of the sample count: four times the rays for half the noise. Naive gathering has one dial and it is an expensive one.

The observation cascades are built on

Two facts about light in a scene, both obvious separately and load-bearing together:

So the requirement inverts with distance. Near field: high spatial resolution, low angular resolution. Far field: low spatial resolution, high angular resolution. And crucially the product of the two stays roughly constant, which means a hierarchy of levels each trading one for the other costs about the same at every level.

The structure

Cascade 0 is dense in space and sparse in angle: many probes, each looking a short distance in a few directions. Each higher cascade halves the spatial density, doubles the angular count, and looks further. The intervals are arranged to tile the full range with no overlap, so every ray length is covered exactly once.

cascade 0:  probes every 2px,   4 directions,  reach 0 to 2px
cascade 1:  probes every 4px,   8 directions,  reach 2 to 6px
cascade 2:  probes every 8px,  16 directions,  reach 6 to 14px
cascade 3:  probes every 16px, 32 directions,  reach 14 to 30px
The four levels, drawn. Each panel halves the probe density and doubles the directions per probe; the faint circle is the interval that level is responsible for. Top number is the cascade, bottom is its direction count.

That is the whole structure in one picture: going right, the probes get sparser and the fans get denser. Every level costs about the same, because the two are trading against each other, and the total lands on the order of the NUMBER OF CASCADES rather than on the order of the radius.

Four times fewer probes and twice the directions per level is half the work per level, and reach doubles each time. So covering a screen-sized radius costs on the order of the first cascade rather than on the order of the radius, which is the entire result.

Then merge downward: each cascade interpolates its parent's result spatially and sums the matching angular intervals. A pixel's final radiance is its cascade 0 probe plus a correctly weighted chain of coarser and further contributions.

What it buys and what it costs

When it is worth it, and when it is not

Being honest about the threshold, since the machinery is substantial:

The technique is credited to Alexander Sannikov, and the primary source is the paper and the surrounding discussion rather than any implementation. It is worth reading before building, because the interval arithmetic is the part everyone gets wrong first and the part that decides whether it rings.

Rules of thumb

  1. Penumbra width grows linearly with distance from the occluder. That single fact is the whole justification.
  2. Near light needs spatial resolution, far light needs angular resolution, never both. Their product is roughly constant.
  3. Quarter the probes and double the directions each level. Cost per level is then roughly flat.
  4. Intervals must tile the range exactly. Overlap double-counts, gaps show as dark rings.
  5. The characteristic artifacts are ringing at the merge and leaks through thin occluders. Budget time for both.
  6. Under about four lights, analytic soft shadows are better and are a fraction of the code.

All 61 notes How to use them Credits