shadow map?

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.)

Maybe you can draw everything with light OFF (ambient only) and then apply light contributions using an additional blend (the reverse of what you’re probably doing right now).

In this way, the shadows will be at “ambient level” while the light contributions will only increase this brightness.

Maybe I don’t got exactly what are you trying to do.

[This message has been edited by Obli (edited 04-08-2003).]

Thanks. This is the hint I needed, to treat the ambient component seperately.