Stencil Shadows Artefacts.

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.

“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.

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

Ok thanks, i might just add in some dodgy hack to make the model enclosed.

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.