Problem with poly winding of shadow volume walls

I am having a problem with the faces making up the sides of a shadow volume: Sometimes they’re treated as back faces altough they’re front faces, and vice versa.

I know that this has to do with the order in which I pass the sides’ quad vertices to OpenGL. This order simply depends on the order of the vertices of the silhouette edge the quad has been constructed of.

I am gathering all edges more or less in a random sequence by simply processing each face of the model one by one as they are stored in memory. So whatever face comes first determines the order of the edge’s vertices.

How do I make sure front and back faces of the shadow volume are always rendered properly? I just can’t get this to work.

You almost answered your own question.
Let’s say you have an edge between polygon A facing towards the light and polygon B facing away from light.
When extruding this edge you can use the winding of either A or B, but you cannot mix it. If you decide to take the winding of polygons facing towards light source you should stick to that.

Thank you very much indeed man! :slight_smile:

I have been trying to make real time shadowing work for months and I was almost in despair about it.