Sign in to follow this  
adt7

Shadow Occlusion Blending

Recommended Posts

I've just managed to get nice looking shadows going for omni-directional lights, but I'm having problems combining the occlusion textures for more than one light. Since I'm using a deferred solution, I produce my shadow maps, and then use them to populate a shadow occlusion buffer which is then applied as post-processing effect. If I try to apply more than two lights to my occlusion buffer, only the last one is applied, so obviously I need to use alpha blending, however I have no idea what states to set to get it to work for shadows. Can anyone provide any insight? My occlusion texture is currently produced as forms (in it's simplest form):
float shadow = 1;

if(inShadow)
   shadow = 0.5f;

return shadow;

As for producing the depth maps/filling the occlusion buffer I'm doing the following (psuedocode):
foreach (light in shadowLights)
{
   setDepthMaps
   renderDepthMaps

   setOcclusionMap
   renderOcclusionMap
}

return occlusionMap;

Share this post


Link to post
Share on other sites
There's no correct way to apply shadow occlusion data once you've calculated and summed the contribution of your light sources. Anything you would do with alpha blending won't look right, and you won't be be able to apply it to the correct light source.

Either do the shadow map depth comparison in you deferred light shader and apply the occlusion factor there, or send the occlusion texture to your light shader and use that value to attenuate that light's contribution.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this