I’m doing some terrain rendering and I’m using the OpenGL lighting and texture functions, and everything works nicely. Now, I’d like to add shadows. I have an algorithm which creates shadow maps (i.e. white pixel means no shadow, and black pixel means shadow). My question is, how do I use OpenGL to apply this shadow map to my scene? I tried doing some blending, but one of the problems is that polygons that are solely lit by ambient light appear too dark when they’re also in shadow. I want shadow areas to be lit at the ambient light level, and not to go lower than that level, but I don’t know how to do that with blending functions.
(If I used my own light model, then I think I could deal with shadows, but I’d like to use OpenGL lighting.)