07.01.2013 Views

3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository

3D graphics eBook - Course Materials Repository

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Shadow volume 186<br />

The depth fail method has the same considerations regarding the stencil buffer's precision as the depth pass method.<br />

Also, similar to depth pass, it is sometimes referred to as the z-fail method.<br />

William Bilodeau and Michael Songy discovered this technique in October 1998, and presented the technique at<br />

Creativity, a Creative Labs developer's conference, in 1999. [2] Sim Dietrich presented this technique at a Creative<br />

Labs developer's forum in 1999. [3] A few months later, William Bilodeau and Michael Songy filed a US patent<br />

application for the technique the same year, US 6384822 [4] , entitled "Method for rendering shadows using a shadow<br />

volume and a stencil buffer" issued in 2002. John Carmack of id Software independently discovered the algorithm in<br />

2000 during the development of Doom 3. [5] Since he advertised the technique to the larger public, it is often known<br />

as Carmack's Reverse.<br />

Exclusive-or<br />

Either of the above types may be approximated with an exclusive-or variation, which does not deal properly with<br />

intersecting shadow volumes, but saves one rendering pass (if not fill time), and only requires a 1-bit stencil buffer.<br />

The following steps are for the depth pass version:<br />

1. Disable writes to the depth and color buffers.<br />

2. Set the stencil operation to XOR on depth pass (flip on any shadow surface).<br />

3. Render the shadow volumes.<br />

Optimization<br />

• One method of speeding up the shadow volume geometry calculations is to utilize existing parts of the rendering<br />

pipeline to do some of the calculation. For instance, by using homogeneous coordinates, the w-coordinate may be<br />

set to zero to extend a point to infinity. This should be accompanied by a viewing frustum that has a far clipping<br />

plane that extends to infinity in order to accommodate those points, accomplished by using a specialized<br />

projection matrix. This technique reduces the accuracy of the depth buffer slightly, but the difference is usually<br />

negligible. Please see 2002 paper Practical and Robust Stenciled Shadow Volumes for<br />

Hardware-Accelerated Rendering [6] , C. Everitt and M. Kilgard, for a detailed implementation.<br />

• Rasterization time of the shadow volumes can be reduced by using an in-hardware scissor test to limit the<br />

shadows to a specific onscreen rectangle.<br />

• NVIDIA has implemented a hardware capability called the depth bounds test [7] that is designed to remove parts<br />

of shadow volumes that do not affect the visible scene. (This has been available since the GeForce FX 5900<br />

model.) A discussion of this capability and its use with shadow volumes was presented at the Game Developers<br />

Conference in 2005. [8]<br />

• Since the depth-fail method only offers an advantage over depth-pass in the special case where the eye is within a<br />

shadow volume, it is preferable to check for this case, and use depth-pass wherever possible. This avoids both the<br />

unnecessary back-capping (and the associated rasterization) for cases where depth-fail is unnecessary, as well as<br />

the problem of appropriately front-capping for special cases of depth-pass.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!