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?

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…


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?

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

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

mmm, my entire lighting model is not one pass (in general) but ill try the alpha thing…thanks.