Hello! I have some problems when i draw shadow volumes.
I first implement the shadows like this:
http://rafb.net/paste/results/aiA0zn64.html
The idea is this:
for each light
DrawRoom(light[i]);
DrawShadows(lights[i]);
end for
everything was correct exept the color of the shadows!
lets say the first light is a red light, the second a green and the third a blue;
the first shadow(from the red light) is correct. it has all the other colors exept the red.
the second shadow(from green) is not correct!it has only the blue color!
and the third shadow(from blue light) is black!
if I had this light colors:
1)yellow 2)blue 3)red 4)pink 5)purple 6)green
look at this:
SHADOW FROM LIGHT ----------------- SHADOW COLOR
yellow ------------------------> blue,red,pink,purple,green
blue -------------------------------> red,pink,purple,green
red ------------------------------------> pink,purple,green
pink ----------------------------------------> purple,green
purple ---------------------------------------------> green
green -------------------------------------> nothing = black
how i can fix this problem?
some people said to me to don’t render the scene like this but like this:
DrawRoomWithNoLight();
for each light
DrawShadowVolume(lights[i]);
DrawRoom(lights[i]);
end for
i try this way but i have problem with casting the shadow(no matter the number of the lights) It seems that all the vertices of the shadow are calculated correct but i does not draw correct.
maybe something with stencil going wrong?
this is the code for the new algorithm:
http://rafb.net/paste/results/CaiEdO65.html
… something else… as you can see in the code i use ARB_fragment_program. The pixel shader does not do any shadow calculation. only Per pixel lighting .
thanks in advanvce!
here is the pack with the demos and screenshots
www.csd.uoc.gr/~hatzibod/Bek3DEngine.zip