View Full Version : sampler2DShadow & deferred shading

09-17-2007, 05:31 AM
i've just switched to deferred shading, but shadow mapping doesn't work anymore. sampler2DShadow() needs the fragment's depth to compare the shadow map's depth value with, right? argh!

what can i do? would it help to get the depth somehow and write it to gl_FragDepth before the shadow map comparison?


09-17-2007, 07:30 AM
You didn't have to pass the fragments depth to sampler2DShadow(). Recalculate the WorldView Position and project it into the lightspace. Pass the Lightspace position to sampler2DShadow() to get a correct shadow...