LerpworksAcademy
On this page

Graphics › Light

Shadows: maps, cascades and soft edges

Know first: Depth buffer: what is closer to the camera, Direct and indirect light

A shadow is a place that cannot see the light. Your eye grasps that at once, but the engine has to work it out for millions of points in every frame. This lesson shows how it does that with a shadow map, and where jagged edges, stripes, “floating” objects and shimmering come from. It also explains why the sun gets several maps, what makes a shadow soft, and what virtual shadow maps and ray-traced shadows change. This is the seventh lesson of the course “How an engine draws a frame.”

Why this matters

In the last lesson, a point that cannot see the sun received only indirect light. But how does the engine know that the point cannot see it? Without the answer, several things stay a mystery:

  • why a shadow on the ground has steps and shimmers when the camera moves;
  • where the stripes on a lit wall come from, and why a crate on the floor looks as if it hovers in the air;
  • why the shadow of a pole is sharp at its base and soft at its tip;
  • why a dozen lamps with shadows can cost more than a hundred lamps without them.

Further in the article

  1. Can the point see the light?
  2. The shadow map: depth as the lamp sees it
  3. What goes wrong with a shadow map
  4. Cascades: shadows from the sun
  5. Soft edges
  6. Shadows from lamps, and what they cost
  7. Baked and contact shadows
  8. Virtual shadow maps
  9. Ray-traced shadows
  10. Where it breaks
  11. Connections: the same idea in other fields
  12. Key points
  13. Test yourself