Sign in to follow this  
mattm

skinned models and stencil shadow volumes

Recommended Posts

From my research I have found two ways of computing shadow volumes; on the CPU and on the GPU. In my tests on my engine the GPU method (where degenerative quads are put in along all possible shad-casting edges and then extruded on the GPU) is faster than the CPU method. My question is how would you go about implementing the GPU method for skinned (or morphing) models. Now with the CPU method, as the sillouete is calculated every frame, there would not be a problem. However, with the GPU method if the vertices move relative to each other (rather than them all moving relative to the world, which is handled by a world transform matric) then, as far as I can see, the model containg the degenerative quads also need to be recalculated. Am i missing something vital here. One thing i did think of was using the same shadow model (with the degenerative quads) as my main rendering model; at the moment i create a seperate model for the shadow volume. I.E i would load my x mesh, create the degenerative quads and then dispose of the original mesh and only use the "shadow" mesh, even for non-shadowing rendering. However, this might cause some issue with UV coordinates etc; Is this the normal way of doing things or is the "two" model approach a better way? If the latter, is there a way to quickly update the vertices and degenrative quads if they cahnge position relative to each other? Any help or advice on this would really be appreciated. Thanks, Matt

Share this post


Link to post
Share on other sites
I think you'd need to insert degenerates into /every/ edge (as potential edges will be changing across the animation), but beyond that, what's wrong with just using regular matrix palette skinning to obtain world or model space positions/normals that you extrude normally?

Share this post


Link to post
Share on other sites
I may be mssingsomething, so thanks for been patient, but i will try and explain with an example:

I have a terrain mesh.

Upon loading the mesh i generate a shadow mesh with the degenrative quads in.

I now have two meshes which i maintain: my terrain mesh and my terrain-shadow mesh.

As long as my terrain doesn't change, or only moves with a rotation/translation, i can easily keep the shadow mesh in sync (by applying the equivalent transoforms to it).

However, say i now raise the center of my terrain mesh upwards into a hill.

The shadow mesh will still be using the orginal coordinates of the vertices, so the hill will no be there. Therefor i need to pass what changes i have done to my terrain mesh to my shadow mesh. The only way i can think of doing this is to loop through all vertices of my shadow mesh, find the ones that have changed and adjust them; or simply call the routine that calculates the shadow volume again.


Thanks for your help,

Matt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this