@Deathrey yes, for now I found this article https://learnopengl.com/Advanced-Lig…Shadow-Mapping and I did implemented their ugly solution
It looks just a little bit better, but at the cost for 9 samples per pixel, I am not satisfied at all, I will keep looking for another PCF implementations.
The code I used is the same:
float shadow = 0.0f;
float2 TexelSize = 1.0 / TextureSize;
for(int x = -1; x <= 1; ++x)
{
for(int y = -1; y <= 1; ++y)
{
float pcfDepth = Texture2DSampleLevel(DepthTexture, DepthTextureSampler, UV.xy + float2(x, y) * TexelSize, 0).r;
shadow += CurrentDepth > pcfDepth ? 1.0 : 0.0;
}
}
shadow /= 9.0;
return 1.0 - shadow;