What is the different between ESM and CESM?

No, the shadowMapSample is generated with the exp, see:

As explained in this thread, we are doing e^(-c*(z-d)) and not e^(-c*(d-z)), that’s why we need to do visibility=1-e^(-c*(z-d)) in the end.

If you want to use the formula from the original paper (which are the ones you quote), you should use CESM and not ESM in Babylon.js.

3 Likes