# Stencil shadow volumes - 2 approaches.

This topic is 4940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have already implemented following approach: - for each model create another model with additional polygons on edges and vertex normals taken from neighbour faces - create volumes by drawing that model with vertex program which will push vertices with back facing normals to infinity (that was only the core of the algorithm) Now I am curious how efficient is this solution compared with computing sillhuette and the capping polygon on CPU (I am not sure if "capping" is the right word - by "capping " I mean the shape that will close the volume). I read about the sillhuette method quite often, but I don't think its faster than the method with precalculated model. There ofcourse would be less triangles but you have to compute the volume for every light and every position change between light and shape on CPU (although you could skip some frames for speedup). Please tell me which method is better (or maybe you know other solutions), and save me some time experimenting with that - I think implementing sillhuette approach would be more complicated than the other one. thx

##### Share on other sites
I'd imagine it's about the same amount of work either way... as for speed, my guess is that using a vertex program approach is better since it lessens the load on the CPU...

roos

##### Share on other sites
hi,

depends on your program. The vertex shader way is 100% on the GPU, but on the other hand, you have a lot more triangles to draw. The method using edge detection and construction of the volume on the CPU uses less triangles (can even skip the capping of the volume if you're not inside the shadow volume) so it's more CPU intensive, but you send less faces to the GPU.

So : if you're limited by triangle throughput, use the CPU way (edge detect, etc.) and if you're limited by the CPU (heavy physic engine for example) use the vertex shader way ^^

as for the performances, on a simple test scene, they are quite similar with a good CPU. I didn't test that on more consistent scenes, as I'll use shadow mapping from now on ^^

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633724
• Total Posts
3013556
×