Lighting & rendering · Intermediate

Shadow mapping

How real-time engines draw shadows fast, using a depth image from each light

What is shadow mapping?

Shadow mapping is a fast way for real-time engines to draw shadows. Each light first renders a depth image, the shadow map, recording how far it can see. When the scene is drawn, any point farther from the light than that recorded depth is in shadow.

Think of it like this

It is like a lighthouse keeper noting the nearest object in every direction. Anything behind those objects, from the keeper’s view, sits in their shadow.

Where it fits in a 3D project

  1. Create
  2. Surface
  3. Rig
  4. Animate
  5. Render
  6. Export

Render: Lighting the scene and turning it into images or video.

How shadow mapping works

  1. 01The engine renders the scene from the light’s point of view, storing depth only.
  2. 02That depth image, the shadow map, records the nearest surface in each direction.
  3. 03While drawing the camera view, each point is checked against the map.
  4. 04Points farther from the light than the stored depth are shaded as shadow.

Shadow mapping vs ray-traced shadows

PropertyShadow mappingRay-traced shadows
SpeedVery fastSlower
EdgesCan look blocky or blurryAccurate, from sharp to soft
HardwareWorks everywhereNeeds ray-tracing support for real time
Typical useMost games and viewportsOffline renders, high-end games

Shadow maps are the reliable default for real-time work; ray-traced shadows are worth the cost when contact shadows and soft edges must be exact.

Where shadow mapping is used

  • Shadows in video games
  • Real-time viewports and previews
  • Web and mobile 3D scenes

Beginner tip

If shadows flicker or float off objects, adjust the shadow bias before raising resolution. Bias controls how strictly points are compared with the map.

Shadow mapping FAQ

Why are my shadows pixelated?
The shadow map is too low in resolution for the area it covers, so each of its pixels spans a large patch of ground. Raise the resolution, shrink the light’s coverage, or use cascades, which give nearby areas more detail.
What shadow map resolution should I use?
The lowest that looks clean at your camera distance. As a rule of thumb, small lamps look fine at 1024 pixels and a sun covering a large area may need 4096, but test in your own scene.
What is shadow acne?
Shadow acne is a striped or speckled pattern where a surface wrongly shadows itself, caused by rounding in the depth comparison. Raising the shadow bias a little usually fixes it.

Updated October 29, 2026 · Browse all 3D terms