Archived

This topic is now archived and is closed to further replies.

jollyjeffers

a new way to cap shadow volume geometry?

Recommended Posts

jollyjeffers    1570
hi all, It wouldn''t surprise me if someone has come up with this one before, but I haven''t seen it in any of the many papers I''ve read on the topic of shadow volume geometry... It seems that both depth-pass and depth-fail techniques really suffer from view frustum clipping, and that there isn''t a particularly easy way to stop this.. It just dawned on me that maybe (just maybe ) you could solve it using a couple of simple matrix operations. Hear me out, and then tell me where I''ve gone wrong with D3DX we have the D3DXMatrixShadow( ) function that will take a plane and create a matrix that flattens all geometry onto that plane - great for planar shadows. Given it''s just mathematics, I guess it isn''t specific to D3D Now, if we have a standard shadow volume with no caps, we can get a list of the vertices that make up either end (just a case of stepping through the array appropriately). If we created a triangle fan (or similar) that covered the end of the volume, but then flattened it (using aforementioned matrix op) onto the frustum plane(s), and then render it... Would this eliminate at least a few cases where you get shadowing errors?? I''m wondering if given a situation like: * * * ---------- * --- = plane * = vertex whether the flatten op will flatten just one (+) side, or both sides, to get: *----*-*-- or *----*-**-- * It strikes me that with a little work (maybe needing a few vertices to be added? that this could work?? Any thoughts? Jack PS - I''m writing this in my lunch break, and haven''t really sat down to program it / tihnk it through at any great lengh! DirectX 4 VB: All you need for multimedia programming in Visual Basic Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
technobot    238
First, you only need to worry about the near (in depth-pass) or far (in depth-fail) clip planes. The side planes are not an issue.

Second, if I''m not mistaken, the matrix will bring the cap to the wrong part of the frustum plane, at least in some cases:

volume: \ \
plane: ---\----\--
\ \
cap: \__\


becomes:

\ \__
---\----\--
\ \
\ \


And finally, the depth-fail technique was designed specifically to *avoid* near clip-plane capping problems, but suffers from far clip-plane capping problems. However, with a minor adjustment of you projection matrix, the far clip plane is essentially moved to infinity, avoiding the clip-planes capping problem altogether.

Michael K.,
Co-designer and Graphics Programmer of "The Keepers"



We come in peace... surrender or die!

Share this post


Link to post
Share on other sites
jollyjeffers    1570
quote:
The depth-fail technique was designed specifically to *avoid* near clip-plane capping problems, but suffers from far clip-plane capping problems.


Right, gotcha

Now, the million dollar question - [u]is the depth-fail technique robust?[/u] I know that the depth-pass technique isn''t, and it''s near as impossible to solve.

I''ve read so much now that I think my eyes might start to bleed and no one has said it in clear english as to whether this depth-fail with corrected projection matrix does the job?!

Jack

DirectX 4 VB: All you need for multimedia programming in Visual Basic
Formula 1 Championship Manager, My Game Project.

Share this post


Link to post
Share on other sites
mohamed adel    174
depth fail after using capping the shadow volume, extending far clipping plane to infinity is robust.but you have to care for some things for animated characters to produce the shadow volume witout cracks (happens with skinning) and you will have to apply tweening for the shadow volume if you are tweening your character.this is explained in a technical paper on ati website.but if you do all these things then it is robust.it is though slower and more difficult than depth pass so if the camera isn''t entering the shadow volume as in strategy games then better use depth pass.

Share this post


Link to post
Share on other sites