Shadows

From DmWiki

Shadows are dark areas where light is blocked by the presence of an opaque object. Good-looking shadows are notoriously difficult to create in real-time 3D graphics; however, ray tracing handles shadows with ease.

For real-time graphics, there are three basic methods of creating shadows:

  • Projected shadows: When projecting shadows onto a flat surface, a black alpha-blended polygon can be drawn on the ground that matches the projected shape of the shadow-casting object. This is a tacky way to draw shadows that only works right on a flat surface; however, it is relatively simple to implement, and many modern games (for example, Half-Life 2) still use this method.
  • Shadow volumes: The shadow method used in Doom 3. Triangles are drawn that delineate regions of space in and out of shadow, and the stencil buffer is then used to prevent light from being drawn in these areas. This produces pixel-accurate, good-looking shadows; however, the shadows are unrealistically sharp (although this may not be a problem) and the technique requires a lot of extra fill rate, as well as specially pre-processed models, which make it difficult to use with skinning. For more information, see the shadow volumes article.
  • Shadow maps: A depth image is drawn from the light's point of view, showing the distance from the light to each point in its field of view. When the scene is rendered, the distance of each point to the light source is computed and compared to the corresponding point in the shadow map; if the distance is greater, the point is in shadow. Shadow maps require no special pre-processing, but require extra video memory. They also suffer from aliasing problems due to the limited resolution of the shadow map, although perspective shadow maps and percentage-closer filtering (PCF) can alleviate this. For more information, see the shadow mapping article.


DevMaster navigation