PDA

View Full Version : Self-shadowing precision problem.



Alberto García
05-27-2015, 06:08 AM
I have implemented shadow mapping, all works fine except that self-shadows are not rendered correctly, as you can see in the picture:


http://s21.postimg.org/9aqnjm7w7/selfshadow.png

The problem looks like z-fighting, does anybody know how I can solve it?

Here my lookup function:



float lookup( )
{
float shadow;
float depth = texture( shadowMap, ShadowCoord.xy ).x;


shadow = ShadowCoord.z > depth ? 0.25f : 1.0f;

return shadow;
}


Thanks in advance