The traditional way that shadows are computed in graphics is to create a mathematical model of a scene, and for every point draw a line to every light in the scene and figure out how many of those lines are obscured by another object. This gives excellent detail, but as you can imagine it can be very slow, and it doesn’t use the fact that if two points on a surface are close together, and one point is in the shadow, it’s very likely that the other point is in the shadow as well. So, in 1978, Lance Williams introduced the idea of shadow mapping. Rather than take a point in the scene and look at the light, shadow mapping looks at the scene from the perspective of the light. Everything it can see is lit, everything it cannot see is shadowed. This data is stored in a texture map, called a depth map. One of the great things about this technique is that even if the perspective of the camera is changed, the depth map doesn’t need to be updated. Once the depth map is created, to create shadows in a scene you just have to trace a ray from the camera, find a point, and compare it to the depth map to see if it’s in the shadow or not.
Shadow mapping now can be done by GPUs, which means there is dedicated hardware that only does shadow mapping. So, doing shadow maps on the GPU takes no time at all and is a very fast way to good looking shadows.
http://en.wikipedia.org/wiki/Shadow_Maps#Creating_the_shadow_map






Leave a Comment
You must be logged in to post a comment.
* You can follow any responses to this entry through the RSS 2.0 feed.