# Slope scaled depth bias with normal maps

I'm using a slope scaled depth bias to reduce shadow acne with shadow maps. However, it's causing artifacts when used with normal mapped surfaces because the bias varies over the surface, where it should really take the normal of the underlying geometry as a bias for all texels instead.

The bias is calculated like this:

float bias = 0.005 * tan(acos(dot(normal,-lightDirection)));


How can I get around this problem, when I don't have geometry information available while applying the shadow map (e.g. during lighting pass of deferred shader)?

BTW, if you want tan(acos(something)), it's probably faster to calculate sqrt(1 - something^2) / something, which is equivalent (using some trig identities). Generally if you're combining forward and inverse trig functions in an equation, there's another way to write it with no trig functions at all.
• apply the bias when rendering the shadow map, instead of when sampling it. I think that's the usual/"standard" approach to shadow map biasing You seem correct. At least the slide 68 of the presentation "Secrets of CryENGINE 3 Graphics Technology", about Shadow Artifacts, agrees with that practice.