PDA

View Full Version : shadow



ryan
09-09-2003, 11:52 PM
how would i go about tagging areas of a scene as shadowed so I can build up the lit areas easily. Im using shadow maps and the most obvious answer to me would be to use the stencil buffer but how do would i get the shadowed areas from the depth map comparision?

Obli
09-10-2003, 02:26 AM
I am also interested in this since I would like to do shadow mapping and light projection.
For shadow mapping, I will investigate a bit in the next few days, I have a line of code which takes something like...

(GL_TEXTURE_COMPARE_OPERATOR_SGIX, GL_TEXTURE_LEQUAL_R_SGIX)

As soon as I understand what's going on I will tell how to do it in the fixed function pipe.

Errm, how to do shadow mapping in programmable fragment pipes?

ryan
09-10-2003, 03:23 AM
i already have shadows and my illumination model implemented, im not concerned with those details....im just trying to extend what i have to include multiple lights and a single ambient pass....but i cant put the shadow info into the stencil buffer

Tom Nuydens
09-10-2003, 03:32 AM
If your lighting model (including shadows) won't otherwise fit in a single pass, you can put the shadows for each light into destination alpha. You then render the light with (GL_DST_ALPHA, GL_ONE) blending.

If your entire lighting model does fit in a single pass, you have no problem. Just render all lights with (GL_ONE, GL_ONE) blending and you're done.

-- Tom

ryan
09-10-2003, 03:56 AM
mmm, my entire lighting model is not one pass (in general) but ill try the alpha thing...thanks.