PDA

View Full Version : stencil shadows- edges aren't projected correctly

jcabeleira
07-29-2003, 01:04 AM
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?

Csiki
07-29-2003, 01:32 AM
Originally posted by jcabeleira:
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?

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

jcabeleira
07-29-2003, 02:50 AM
Originally posted by Csiki:
Always use the front facing poligons order to determine you edge's direction.

could you give me more details? i'm not sure if i understood your suggestion...

jcabeleira
07-29-2003, 02:53 AM
Originally posted by Csiki:
Always use the front facing poligons order to determine you edge's direction.

could you give me more details, please? i'm not sure if i understood...

Csiki
07-29-2003, 08:53 AM
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

rgpc
07-29-2003, 03:45 PM
glDisable( GL_CULL_FACE );