Why the box in shadow?

We use ESM and make box as receiver.Then it will be in shadow.

I think that if the box is receiver.d and z is very close.And (d-z) → 0,the result should be 1.
1 means that not in shadow.But the box is in shadow.

You have to adjust the bias/depth scale/shadow min/max planes to get proper shadows.

For eg:


Yes,i find that the PG use spotLight and it will not auto calculate shadow bounds.I use directionalLight instead.And I set autoCalcShadowZBounds true.But the box still in shadow.
I don’t know what is the role of bias in ESM.Could you please explain to me the principle?Thank you.

The shadow box is right.

I don’t know why the ground as caster and receiver will produce this result?
Could someone explain it to me?

The bias in ESM is used in the same way than for other filtering methods. See Shadows | Babylon.js Documentation for more explanations.

A bias of 0.1 will fix the problems in your PG (use the Inspector to interactivily change the bias and see the result in real time).

It’s because the mesh is self shadowing. See this section in the shadow doc.

I know the self-shadow.It seems like shadow acne.But it happens when the shadering pixel depth less than the sample depth.But in ESM,if the d and z is close,we use this formula and it means that it will be bright.

Like the ESM has contact light-bleeding.The d and z close,it will be bright.

ESM is implemented as e^(-c*(z-d)) in Babylon.js and not e^(-c*(d-z)) for some reasons (maybe compatibility with WebGL 1?), meaning light leaking is replaced by shadow acne.

1 Like

I think it might be related to this problem.

If like you said,the box as receiver and caster at the same time.It still will be bright,but not dark(shadow acen).

It’s doing shadow acne because we are doing visibility=1-e^(-c*(z-d)) with e^(-c*(z-d)) being clamped to 1 if it goes over 1, which is what is happening when d > z because -c*(z-d) is a big positive number. So, in that case 1-e^(-c*(z-d))=0 => shadow acne.

1 Like

CESM appears to be the original ESM implementation where you get light leaking artefacts instead of shadow acne.

1 Like