Shadows are what make objects feel grounded in a scene. This tutorial implements shadow mapping: a depth-only first pass from the light’s perspective builds the shadow map, and the deferred lighting pass compares each fragment’s light-space depth against it to decide lit vs. shadowed.

Shadow pass and final result

What you’ll learn:

  • Rendering a depth-only pass into an MTLTexture shadow map
  • Transforming fragments to light space for depth comparison
  • Shadow bias to avoid self-shadowing artifacts
  • Percentage-closer filtering (PCF) for soft shadow edges

Read the tutorial β†’