# The shadow is pretty weird. Someone please help

**URL:** <https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488>\
**Category:** Questions\
**Created:** [September 6, 2019, 12:17am UTC](https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488 "2019-09-06T00:17:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahilnare](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sahilnare/32/43834_2.png) [@sahilnare](https://forum.babylonjs.com/u/sahilnare)\
**Post date:** [September 6, 2019, 12:17am UTC](https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488/1 "2019-09-06T00:17:19Z")

</div>

Here’s the [code in the playground](https://www.babylonjs-playground.com/#LBYR0F#1)

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [September 6, 2019, 2:17am UTC](https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488/2 "2019-09-06T02:17:34Z")

</div>

[https://www.babylonjs-playground.com/#LBYR0F#3](https://www.babylonjs-playground.com/#LBYR0F#3)  
Added two lines (65-66)  
`shadowGenerator.useBlurExponentialShadowMap = true;`  
`shadowGenerator.blurScale = 4;`

[https://doc.babylonjs.com/babylon101/shadows#soft-shadows](https://doc.babylonjs.com/babylon101/shadows#soft-shadows)

---

<div class="post-metadata">

**Author:** ![sahilnare](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sahilnare/32/43834_2.png) [@sahilnare](https://forum.babylonjs.com/u/sahilnare)\
**Post date:** [September 6, 2019, 9:57am UTC](https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488/3 "2019-09-06T09:57:19Z")

</div>

Thank you. What if I wanted to make the shadows darker? Also, it’s working if I change the map size of shadow generator from 1024 to 8192. Should I do that? Or is this method the better one??

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [September 6, 2019, 2:42pm UTC](https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488/4 "2019-09-06T14:42:14Z")

</div>

As for shadow darkness - I’ll quote [Deltakosh post from the old forum](http://www.html5gamedevs.com/topic/16723-soft-shadows/):

> **So how shadows work?**
> 
> Realtime shadows used in Babylon.js use a texture to determine distance between every pixel (that the light can see) and the light. During mesh rendering, shaders compute the current distance of every pixel to the light.  
> IF this distance is greater than the one saved inside the texture this means that the light CANNOT see the pixel so shaders know they can skip lighting phase for this specific pixel
> 
> **Long story short**
> 
> Shadows work like in the real word: by not computing the light. Which means that you cannot control the “darkness” because the shadow is not painted or rendered. You can see a shadow because light is not applied where the shadow is.

For example, here [Babylon.js Playground](https://www.babylonjs-playground.com/#2B2TKO) is very good example of different shadows darkness from the same object.

If you changed the shadow map size to 8192, you definitely will notice how FPS will drop. So while the bigger shadow map size gives better quality, for the sake of FPS it is better to use blur filters to achieve even better and realistic results.

Here I made some tweaks with your example - added floor texture, made meshes bigger and, most important, put the light much closer (from y=500 to 50) [https://www.babylonjs-playground.com/#LBYR0F#4](https://www.babylonjs-playground.com/#LBYR0F#4)

---

<div class="post-metadata">

**Author:** ![sahilnare](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sahilnare/32/43834_2.png) [@sahilnare](https://forum.babylonjs.com/u/sahilnare)\
**Post date:** [September 6, 2019, 4:15pm UTC](https://forum.babylonjs.com/t/the-shadow-is-pretty-weird-someone-please-help/5488/5 "2019-09-06T16:15:28Z")

</div>

Yeah the FPS dropped a lot. Putting the light closer makes a significant difference. The shadow explanation is also pretty neat. Thanks for the help!
