Hello! You can see the functions used to compute ESM and CESM in shadowsFragmentFunctions.fx
:
- ESM :
float esm = 1.0 - clamp(exp(min(87., depthScale * shadowPixelDepth)) * shadowMapSample, 0., 1. - darkness);
- CESM:
float esm = clamp(exp(min(87., -depthScale * (shadowPixelDepth - shadowMapSample))), darkness, 1.);
They look pretty similar to one another at a glance, but once you plot the values according to the shadowMapSample
value, they look pretty different (for simplicity, I substituted depthScale
and shadowPixelDepth
for 1.0, and darkness
for 0.0):
ESM is f1, CESM is f2. The link to the plots is here: Graphtoy
@sebavan can complement with anything I missed