# Incorrect direction of shadow after enabled Exponential shadow map

**URL:** <https://forum.babylonjs.com/t/incorrect-direction-of-shadow-after-enabled-exponential-shadow-map/57967>\
**Category:** Bugs\
**Tags:** shadows, shadowgenerator\
**Created:** [April 21, 2025, 7:32am UTC](https://forum.babylonjs.com/t/incorrect-direction-of-shadow-after-enabled-exponential-shadow-map/57967 "2025-04-21T07:32:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [April 21, 2025, 7:32am UTC](https://forum.babylonjs.com/t/incorrect-direction-of-shadow-after-enabled-exponential-shadow-map/57967/1 "2025-04-21T07:32:33Z")

</div>

Version: 8.3.1  
Engine: WebGL2  
Playground:

> **[Babylon.js Playground](https://playground.babylonjs.com/#IIZ9UU%23500)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Steps to reproduce:

1. Open the playground
2. Look at the shadow

Expected:  
It looks something like if “Exponential shadow map” not enabled.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/6/c61500cda1f16666f192dff4896b5798f208233f.jpeg)

Actual:  
Shadow appears at both direction.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/d/fda7085efd784b14f051b3004bff5665c320b8f1.jpeg)

Notes:  
Blur exponential shadow map suffers the same issue here

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 21, 2025, 4:19pm UTC](https://forum.babylonjs.com/t/incorrect-direction-of-shadow-after-enabled-exponential-shadow-map/57967/2 "2025-04-21T16:19:52Z")

</div>

cc @Evgeni_Popov

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [April 21, 2025, 8:16pm UTC](https://forum.babylonjs.com/t/incorrect-direction-of-shadow-after-enabled-exponential-shadow-map/57967/3 "2025-04-21T20:16:19Z")

</div>

It’s a known problem with ESM where shadows are generated for geometry that is below the shadow receiver.

You can fix it in different ways:

- make sure the pipe doesn’t go below the plane: [https://playground.babylonjs.com/#IIZ9UU#501](https://playground.babylonjs.com/#IIZ9UU#501)
- set a nearer shadow far plane and tweak the depth scale to make it look good: [https://playground.babylonjs.com/#IIZ9UU#502](https://playground.babylonjs.com/#IIZ9UU#502)
- use CESM (you should also set a `light.shadowMaxZ` value so that the shadow is not too faint): [https://playground.babylonjs.com/#IIZ9UU#503](https://playground.babylonjs.com/#IIZ9UU#503)
