The Game Dev Atlas, Act I, The Pixel Art Island: an engraved map of an island whose towns are the techniques of pixel art for games.
Unrolling the map...
by Sprite Fusion

Light · Act I

Pixel art loop. A crystal mine seen from above, in the dark: timber props, a mine cart on its rails, seams of crystal. A miner walks in with a lantern, the only light. First the light is a round glow laid over floor and rock alike. Then the same mine under radiance cascades: the rock stops the light, the props cast soft shadows, and the crystals catch the light as he passes. The probes show for a moment: many near the lantern, few far from it. Then dozens of sparks drift in, then hundreds, and the whole mine is lit.
Act I, fig. 6 A mine lit by one lantern. First a round glow, then light the rock stops, then hundreds of sparks at the same cost.

Lights in 2D are usually glow sprites laid over the scene. Nothing casts a shadow, and every new light costs more.

Cover the scene with probes that cast rays. Near: many probes, a few short rays. Far: a quarter of the probes, four times the rays. Merged from far to near, every pixel gets light from all directions, at a cost the number of lights does not change.

Light my 2D scene with radiance cascades: soft shadows from any number of lights, with no baking.
Read the whole brief
Light my 2D scene with radiance cascades.

- Each frame, draw what gives light and what blocks it into one picture at [my art's resolution].
- Cascade 0: a probe every [2] px, [4] rays each, [2] px long.
- Each next cascade: probes twice as far apart, 4 times the rays, over the next stretch, 4 times longer. Stop when rays cross the screen.
- Merge from the farthest cascade to the nearest: a ray that hit nothing takes the light its wedge found one cascade up.
- Close the seams between cascades with the bilinear fix.
- A pixel's light is the mean of its cascade 0 rays.
- Give every light some size, [5] px or more: a tiny light flickers.
- Keep it pixel art: snap the light to [my palette's ramps], with ordered dither between steps.
- Run it [in a shader, every frame].

Change what stands in [brackets] to fit your game.

  1. Lights that move, or a level that changes. Nothing baked can follow those.
  2. Many lights. The cost is set by the screen's size: a hundred glowing bullets cost what one does.

Not forA few fixed lamps: glow sprites are cheaper.

Alexander Sannikov developed the method at Grinding Gear Games for Path of Exile 2.[1] Far light needs few places and many directions, near light the reverse.[1][2] Yaazarai wrote a step by step account.[3] The figure's 2D code is this atlas's own.

  1. Alexander Sannikov, Radiance Cascades, the paper, GitHub
  2. Jason McGhee, Building real-time global illumination: radiance cascades
  3. Yaazarai, Radiance Cascades, part one, GM Shaders