# getShadowMap().resize() does not work

**URL:** <https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735>\
**Category:** Bugs\
**Created:** [July 25, 2019, 6:53pm UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735 "2019-07-25T18:53:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theodore\_Lee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/theodore_lee/32/5061_2.png) [@Theodore\_Lee](https://forum.babylonjs.com/u/Theodore_Lee)\
**Post date:** [July 25, 2019, 6:53pm UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735/1 "2019-07-25T18:53:03Z")

</div>

Calling `shadowGenerator.getShadowMap().resize(newShadowMapSize)` to resize a shadowmap does not work, as demonstrated in the playground below.

[https://playground.babylonjs.com/#PRK3XX#2](https://playground.babylonjs.com/#PRK3XX#2)

In the playground, press the Space key once the scene is loaded to attempt to resize a shadowmap. It does not work - the shadow disappears.

In other cases, where the shadow-casting-mesh may be larger, the shadow is still there, but is however smaller and not the right size for the mesh.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 25, 2019, 8:29pm UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735/2 "2019-07-25T20:29:38Z")

</div>

Hi

I could reproduce the issue with Chrome and Firefox. No errors or any log in the console. Anyways, I’m taking a look.

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [July 25, 2019, 9:34pm UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735/3 "2019-07-25T21:34:55Z")

</div>

It works with webgl1 but not with webgl2. pinging @sebavan

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 25, 2019, 11:14pm UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735/4 "2019-07-25T23:14:18Z")

</div>

Yup looks like a bug as the light UBOs are not flagged as dirty the new size info are not passed through the shader. I should have a fix by tomorrow morning.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [July 25, 2019, 11:43pm UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735/5 "2019-07-25T23:43:57Z")

</div>

It is already tomorrow in France 😉 so I pushed the fix here: [Fix RTT resize and ShadowGenerator by sebavan · Pull Request #6627 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/6627) It will be part of the next nightly tomorrow.

---

<div class="post-metadata">

**Author:** ![Theodore\_Lee](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/theodore_lee/32/5061_2.png) [@Theodore\_Lee](https://forum.babylonjs.com/u/Theodore_Lee)\
**Post date:** [July 26, 2019, 12:01am UTC](https://forum.babylonjs.com/t/getshadowmap-resize-does-not-work/4735/6 "2019-07-26T00:01:55Z")

</div>

Thank you, @sebavan!
