PDA

View Full Version : Shadow Volume Speed



dalangalma
06-15-2004, 08:50 AM
After reading http://www.gamedev.net/reference/articles/article1990.asp on using Cg to create shadow volumes, I have a quick question. Don't the extra zero-area quads on each edge blow up the model size by quite a bit? Dosen't that slow down rendering quite a bit, especially since you need to render each model 3 times? How would you deal with that?

dorbie
06-15-2004, 09:09 AM
That's the price you pay for the degenerate quad approach to shadow volumes. You can do the stencil increment and decrement in a single pass now with appropriate extensions. The real cost is dispatch and T&L on the the silhouette volumes, the other passes have the same cost and same number so they aren't affected by the fact you have a degenerate edge duplicate of the original model.

The alternative is to compute the silhouette on the CPU and that's what many do, it really depends on where you think you can afford the time to extrude. Other factors like size of vertex program may come into play depending on hardware and whether you are handling your bones on the GPU.

dalangalma
06-15-2004, 09:44 AM
Does modern hardware check for degenerate triangles, or will it try to render them?

SirKnight
06-15-2004, 11:09 AM
Originally posted by dalangalma:
Does modern hardware check for degenerate triangles, or will it try to render them?If you store the degenerate tris in their own array then you can render the model by itself without worrying about those degens. Only have that array in play when you are doing the shadow passes.

-SirKnight

Adruab
06-15-2004, 01:06 PM
Yes, you'd have to use a separate array, as the normals must be set to the face normals to use the degenerate triangle approach (not to mention you'd be store a TON of information you would never use).

And yes, most hardware will automatically reject degenerate triangles based on indices. Based on actual point, I'd imagine that they do some based on positional info too (if the screen coord of two vertices are the same or something...). Either way, zero fill rate should be spent on the degenerates, which tends to be the bigest problem in stencil shadow rendering.