O'Reilly logo

3D Graphics with XNA Game Studio 4.0 by Sean James

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Shadow mapping—drawing the depth map

Now that we've seen how to perform projective texturing, we are ready to learn how to add shadows to our scene with shadow mapping. Shadow mapping is a process where we:

  1. Render the scene to a depth texture. This is similar to the depth texture we rendered to perform prelighting, but this time we render the scene from the light's point of view, pretending that the light we are generating shadows for is a point-target type of camera. The depth texture will store the distance from the light of the closest vertices that are in view of the light's virtual camera.
  2. Render the scene using the normal effects, but project the depth texture onto the scene from the light's point of view. This will allow us to extract the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required