# ESM Artifacts

This topic is 2929 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've been working on getting ESM working correctly and I am getting some weird self shadowing errors, I think its best explained by a screenshot. http://img204.imageshack.us/img204/5209/artifacts.png As you can see their are clearly some errors. Anyways here's my code:

float ESM_K = 60.0f; // Range [0, 80]
float ESM_MIN = -0.5f; // Range [0, -oo]
float ESM_DIFFUSE_SCALE = 1.39f; // Range [1, 10]

float3 GetShadow(half fSplitIndex, float2 splitUV[4], float4 lightDepths)
{

}


I have tried playing around with the parameters but nothing seems to work right. I get the same results with and without the blur so I know its not the blur. I'm fairly certain it isn't the PSSM stuff either, as that works fine without the ESM. Anyways thank you for any help you can give! -Toaster

##### Share on other sites
I can't see your image, but are you sure it is the ESM aspect which is at fault? I mean, what if you replace it with a regular depth test, something like:

float3 GetShadow(half fSplitIndex, float2 splitUV[4], float4 lightDepths){    float shadow = 0.0f;    float receiver = lightDepths[fSplitIndex];    float occluder = tex2D(sampShadowMap, splitUV[fSplitIndex].xy)[fSplitIndex];    shadow = occluder < receiver ? 0 : 1;	    return shadow;}

I guess I'm saying is it a case of bad shadow setup, or it the choice of values/constants for the ESM?

You'll need to remove the blur pass for this to make sense... in fact does the blur pass affect the problem?

##### Share on other sites
Edit: Hmm after some playing around I have the same artifact with no ESM and no blur. So it must be something wrong with my PSSM.

New screenshot:
http://img237.imageshack.us/img237/5209/artifacts.png

Thanks for the help so far! :)

-Toaster

##### Share on other sites
Quote:
 Original post by toasterthegamerSo it must be something wrong with my PSSM.

So does the issue disappear is you reduce the number of cascades to one? To me it looks a bit like there is some depth biasing taking place. And are you only rendering the back-facing triangles into your shadow map?

##### Share on other sites
Yeah I use back-facing only. It has something to do with the bias but no matter what I set I get this:

http://img30.imageshack.us/img30/1969/biasartifacts.png

-Toaster

##### Share on other sites
There are two different artifacts in your first picture, both should be fixable.

1. The bias errors you see come mostly on back faces. Back faces should always be in shadow. The way to solve this is to include some shading - multiply by dot(n,l) for your light.

2. There is some light leaking associated to ESM. There are lots of ways to improve this, but foremost you should render front faces in your shadow map when working with ESM.