Shadow volumes and skinned meshes

Started by
4 comments, last by GameDev.net 18 years, 1 month ago
Hi everyone - what's the best way of calculating shadow volumes for skinned meshes? For non-skinned meshes, I'm currently using the method described in the DirectX documentation, where degenerate quads are placed between each shared edge of the original mesh - which adds *loads* more vertices I might add :( This works out quite well though as the CPU has to do zero work - everything is done GPU side. However a problem arises when you want to use skinned meshes, as the 'vertex-normals' are actually the face normals, so the bone influences mess this all up (imagine having different bone influences for each vertex of a face). I've investigated quite a few possibilities, such as recalculating the face normal after skinning in the vertex shader - however this requires storing and skinning the neighbouring vertices for the vertex in question! Quite expensive and loads more memory required :( I believe Doom3 calculates the volumes on the CPU, is this the best answer? Thanks for your time. Jim. ps wish i used shadow mapping now!
Advertisement
Hi,

I think the best answer to your question is "do both and profile".
Some notes. There is a sample chapter from ShaderX which tells you how ATI demo team did it for their demo engine. This is the GPU approach.

The link is:
Shadow Volume Extrusion using a Vertex Shader

Maybe you can find something in there (if you haven't already read it).

One note about Doom3. I don't know exactly, because i don't remember the shaders, but i think they not only skin the mesh on the CPU but they create the volume also on the CPU. Correct me if i'm wrong. And if i remember correctly the maximum characters per scene in Doom3 wasn't really big. 3 - 4 i think. Correct me here also.

If you have a fast skinning algorithm (with SIMD and the rest), try doing it on the CPU. It may make no noticable difference in speed, and it will be more memory friendly.

Hope that helps. Anyone has any comments?

HellRaiZer
HellRaiZer
One more comment. If you are rendering your characters with multiple passes (e.g. shading from multiple lights) you should consider building the sv on the CPU (once per frame) as it turns to be more efficient than continusly transforming the vertices with a fairly complex shader. Also consider the same thing with the other (static) meshes.

HellRaiZer
HellRaiZer
Um the shadow volumes are in general different for each light.
Quote:
Um the shadow volumes are in general different for each light.


The previous post is misleading. Sorry.
Yes the volume is different but the skinned mesh isn't. What i ment is that, when you skin the mesh in a vertex program you need to skin it once for every light. When you skin it using the CPU, you do it once per frame. Then you construct the sv for every light.

HellRaiZer
HellRaiZer
BTW, nothing prevents from skinning a low-res version of your displayed skinned mesh solely for the purpose of calculating the shadow volumes; this model could even have less bones. You will deal with a lesser number of polygons at each frame.

This topic is closed to new replies.

Advertisement