Recently while searching of solving the shadow acne problem of traditional shadow mapping I implemented exponential shadow maps. It did the trick (no acne at all) but at the same time introduced other unacceptable errors.

For depth map blur I use gaussian blur with smallest sigma=1.

Test for shadow map:

float occluder = texture(shadowMap lightCoords.xy).r;
float c = 5000.0;
float receiver = lightCoords.z;
float shadow = exp(c*(occluder-receiver));
shadow = clamp(shadow, 0.0, 1.0);

with small c factor c=100.0:

enter image description here

Unacceptable light bleeding

with high c factor c=5000.0:

enter image description here

No light bleeding but high frequency detail appear "swollen".

Cant find optimal c - light bleeding appear even at c=3000.0 and high frequency shadow error is already there. Not blurring the depth map helps but then aliasing occurs.

And my question is - how can I improve this technique (ESM) or should I look for another? I think good quality shadows with nice performance are definitely possible - as seen in modern games like Witcher 3 or Fallout 4.


Well nevermind. I made some research and actually gonna:

  • sample ESM using Poisson sampling in PCF fashion (thanks Bart Wronski for great Poisson Sample generator app) and extend this to PCSS technique (variable penumbra). Render to texture.
  • optionally depth aware blur to soften - EDIT not so fast this option doesnt work as expected, too bad. Instead rotating PCF kernel seem to work fine.

And too bad not much of discussion here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.