Shadow Volumes/Stencil Buffer

I currently have implemented shadow volumes in a 3d GL engine I’m writing. The shadow volumes use the standard approach, using the stencil buffer, but things are pretty damn slow.

I’m only drawing about 50 - 100 polygons into the buffer, and the problem actually doesn’t seem to be polygon related but fill-rate related because reducing the polygons doesn’t have an enormous effect but reducing their size does.

I’m currently running my demo on an Athlon 800 with a GeForce2 so one would expect that things would be snappy, but I have the feeling that using the stencil buffer is simply a slow ordeal. I’m not positive that the buffer operations run in hardware, but if they aren’t I don’t know what to do about it anyway.

Anyone else have any experience with real-time shadow volume drawing/stenciling and how fast/slow it is? Any suggestions?

Thanks,
Scott

Well, shadow volumes aren’t hyperfast but they should run in real-time with high framerates for low detailed geometry (you are using only 100 polygons?). Perhaps it’s an implementation problem. How much render passes are you using?

Stencil isn’t expensive. What is expensive is that stencil shadows are a form of massive multipass rendering.

  • Matt

Are you running in 32 bpp mode? In 16 bpp the stenciling is handled by software. At least on Geforce and TNT series that is.

Originally posted by DFrey:
Are you running in 32 bpp mode? In 16 bpp the stenciling is handled by software. At least on Geforce and TNT series that is.

You are my savior. Thank you so much, I was running in 16-bit mode and when I switched to 32-bit it worked perfectly.