PDA

View Full Version : Stencil Shadows Artefacts.



MrShoe
06-06-2003, 01:29 AM
Im having a problem with stancil shadows. Basically my algo for finding the silhoutte is to see if a triagnle is facing the light and then check all of its edge neighbours, if a face which neighbours the light facing face isnt facing the light, then their shared edge is part of the silhoutte. However, if a triangle is facing hte light and has NO neighbour on a certain edge, then that edge is always part of the silhoutte. Now, my problem comes about when rendering models which have triangles which dont have 3 neighbours, ie: one of their edges is only shared by one face. The shadows work perfectly for models which are totally enclosed, ie: every face has 3 edge neighbours. Does anyone know if im doing somehting wrong or what?
BTW, im using depth fail stencil shadows if that matters.

AdrianD
06-06-2003, 09:20 AM
"The shadows work perfectly for models which are totally enclosed, ie: every face has 3 edge neighbours."

thats correct and that's the answer.
your other meshes don't work because this shadow method works ONLY on totally enclosed meshes. no way to change it (execpt using shadowmapping). sorry, but you have to make sure that your mashes are closed.

cass
06-06-2003, 10:03 AM
Of course, there are relatively easy ways around the "closed model" problem.

What's important is that the shadow volume is closed.

If you generate closed shadow volumes from unclosed models, that's fine. (And common.)

Thanks -
Cass

MrShoe
06-07-2003, 12:31 AM
Ok thanks, i might just add in some dodgy hack to make the model enclosed.

DopeFish
06-07-2003, 01:24 AM
Are you using the front-faces or the back-faces for the volume caps?

If you use the front-faces, you should be able to cast perfectly closed volumes without any special hacks at all. I use this method in my own code just fine, and have no troubles with "open" meshes.