I am working on my first implementation of Stencil Shadow volumes and I have to say I'm a bit skeptical. I read this tutorial (and the tutorial the follows) and I understand the concept, the math and the geometry quite well, but the tutorial did not say if there are any constraints on the types of models you can render. Certainly I can see that any model involvng transparrencies would be bad news, but no information about the general shape.
In particular, the algorithm in the tutorial assumes that a given edge on a triangle will always be adjacent to another triangle. If you peek at my model below, you can see that the low end of his shirt (that hangs down beneath his belt) has no adjacencies at the edge. So I decided for this case that when an edge on a front facing triangle doesn't have an adjacent triangle at all, it is assumed to be a silohuette edge. It appears to work fairly well. The bottom edge of his shirt was marked as an edge appropriately. The model features plenty of such edges, especially at joints of the major body parts. Are stencil shadow volumes even expected to work for a model such as this? If no, what contraints are needed on the model for this to work?
My other question, here I am rendering the silohuette edges of the mesh in bind-pose, from the viewer's location (silohuette edge calculation all done in CPU at the moment, moving to GPU later). I have it set to rotate as it is displayed. As the model rotates, a very small but noticable number of edges tend to flicker (marked in yellow in the attached image). Sometimes little sections of edges disappear. The outisde outline seems to always be there, but various other edges flicker in and out as it rotates. Will such minor variations in the silohuette edges cause noticable artifacts when rendering the shadow volume?
In case someone asks,
1. I have properly computed and checked my indices to make sure I am retrieving adjacent vertices.
2. I consider an edge a silohuette edge if its triangle is front facing, and its adjacent triangle is back facing OR if there is no adjacent triangle.
3. I consider an edge front facing if (eyeLocation - edgeVertex0) dot faceNormal > epsilon. I have tried adjusting epsilon but it does not appear to help any of the flickering edges.
Some advice would be most appreciated!
Edited by mv348, 14 January 2013 - 11:24 PM.