accessing shadow map

Hi,

I was wondering if there is any way that I can access the 2D texture used for comparing the depth in shadow mapping.

please let me know if its possible.
thanks,
-t

You mean get the depth values out without doing a comparison? As long as you don’t actually enable the comparison, you can have it output the depth value as luminance or alpha. Using the fixed-function texture environment, however, this means the value will be converted to 8 bits, so you lose a lot of precision. I assume (but haven’t verified) that this doesn’t happen if you access the texture in a fragment program.

As far as I know there’s no way to have the comparison enabled and access the raw depth values simultaneously. If you need to that, you can still do the comparison yourself in a fragment program, though.

– Tom

Thank you for the reply. I am not really trying to access the depth texture even if it sounded like I did want to do that previously.

I want to be able to access the shadows cast of all the objects in the scene(maybe as a texture). I would like to perform some processing on those shadows. please let me know if you have any ideas.

thank you,
-t

Calling GetTexImage with DEPTH_COMPONENT generates an INVALID_ENUM error, so you can’t get it out that way.

However, you can call ReadPixels with the depth buffer as target / depth component as format when you initially generate the texture. This is likely to performa poorly on deferred-mode tile-based renderers such as Intel Extreme Graphics or the old Kyro stuff, but otherwise works about as well as you’d expect general buffer read-back to work.

Originally posted by trout:
I want to be able to access the shadows cast of all the objects in the scene(maybe as a texture). I would like to perform some processing on those shadows. please let me know if you have any ideas.
You mean you want a view of the scene with nothing except the shadows in it? Just do a rendering pass with the shadow map as your only texture, and no additional shading. You can render that to a texture rectangle (or copy it to one), and then do postprocessing effects on that texture by rendering it back to the framebuffer with a fragment program applied.

I hope I’m not still missing your point…

– Tom