Shadow mapping question.

Is this how shadow mapping should be done? Draw the scene from the players perspective. Save that data in an image, also save the depth information. Draw the scene again, but this time from the perspective of the light. Save this depth data, check the depth data against the original data, if the depth is closer, than that pixel is shaded.

Continue this procedure for the remaining lights. Tint the pixel more and more, for each light that is blocked. Is this correct??

Not quite.

Foreach Light:
Draw then scene from the light’s perspective
Copy the depth information to a depth texture
Draw the scene from the user’s perspective, additive mode
Set hardware up so that it adds only light ambient
if the screen pixel is in shadow from the light,
but adds the full light value if the pixel is not
in shadow

Note that the “set the hardware up” and “copy depth buffer to depth texture” is what the OpenGL shadow extensions are all about. Or you could code it up using a floating-point fragment program.

You can turn of color writes when rendering the shadow buffer, as you only want depth; that’ll improve fill rate. Also, no shaders required; only depth output needs to be correct. This also saves fill rate.

Why bother using the shadow/depth extensions? Why not just render the scene from each light’s perspective, apply each of those textures to all of the scene’s polygons, and do the comparison in a fragment program? There’s no need to draw the scene twice for each light.