stencil shadows- edges aren't projected correctly

my stencil shadow algorithm works like this:
to find the edges of a face that need to be projected to infinity i chech if that face is front faced to the light and if the neighbour that shares the edge is not front faced to the light, if that’s true then we have an edge that must be projected.

so my problem is this, when i have the two points of an edge i must project them according to the light direction but some times they are projected in ccw order and sometimes they are not depending on the light’s position wich leads to shadows artifacts and bad results.

how can i solve this? or, is there a better way of doing this?

Originally posted by jcabeleira:
[b]my stencil shadow algorithm works like this:
to find the edges of a face that need to be projected to infinity i chech if that face is front faced to the light and if the neighbour that shares the edge is not front faced to the light, if that’s true then we have an edge that must be projected.

so my problem is this, when i have the two points of an edge i must project them according to the light direction but some times they are projected in ccw order and sometimes they are not depending on the light’s position wich leads to shadows artifacts and bad results.

how can i solve this? or, is there a better way of doing this?[/b]

Always use the front facing poligons order to determine you edge’s direction.

Originally posted by Csiki:
[b] Always use the front facing poligons order to determine you edge’s direction.

[/b]

could you give me more details? i’m not sure if i understood your suggestion…

Originally posted by Csiki:
[b] Always use the front facing poligons order to determine you edge’s direction.

[/b]

could you give me more details, please? i’m not sure if i understood…

Originally posted by jcabeleira:
could you give me more details, please? i’m not sure if i understood…

If your front facing poligon is:
A - B - C - D - A (for example),
then render the quad strip below:
A - inf A - B - inf B - C - inf C - D - inf D - A - inf A

glDisable( GL_CULL_FACE );