Shadow mapping is a process, by which, shadows are added to 3D computer graphics. This concept was introduced by Lance Williams in 1978, in a paper entitled "Casting curved shadows on curved surfaces". Since then, it has been used both in pre-rendered scenes and in realtime. Shadow mapping is used by Pixar's RenderMan, and likewise, shadow mapping has been used in such films as Toy Story.
Shadows are created by testing whether a pixel is visible from the light source, by comparing it to a z-buffer or depth image, in the form of a texture. This technique involves three passes or re-renderings, although it can be accomplished with just two.
The complexity of this simple operation becomes apparent when one considers the amount of photons that are incident on the surface of the objects. The sheer number of photons incident cannot be simulated at real-time even by current fastest computers. Hence to make this effect more accessible to people via games, 3D modelling tools, visualization tools, etc, programmers employ a number of techniques to fake this complex shadow operation. The following is a partial list of algorithms that most programmers use to approach this problem:
Since only the needed information is used, the color buffer (and others) may be disabled, along with any color-altering schemes (e.g., lighting, shaders, texturing). It is important that only the shadow-casting objects are rendered, opposed to the objects that are shadowed. When shadow mapping is done in realtime, speed is important and therefore the less that is rendered, the better. A depth-offset is usually applied and enabled for the rendering of the shadow casters, since if this is not used, ugly stitching artifacts will result.
When the rendering of the shadow casters are complete, a texture map (image) of the depth buffer is made. This is the shadow map that will be used for the remainder of the process.
A test is applied to every pixel, to determine how far from the light the depth map says it is, and how far it really is. Usually, if its greater, the pixel fails the test, and is considered "shadowed".
This example used the OpenGL extension GL_ARB_shadow_ambient to accomplish the process in two passes.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Shadow mapping".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world