# Get shadow map texture

**URL:** <https://forum.babylonjs.com/t/get-shadow-map-texture/48302>\
**Category:** Questions\
**Tags:** shadows, shadowgenerator\
**Created:** [February 26, 2024, 2:06pm UTC](https://forum.babylonjs.com/t/get-shadow-map-texture/48302 "2024-02-26T14:06:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![robcaa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/robcaa/32/36415_2.png) [@robcaa](https://forum.babylonjs.com/u/robcaa)\
**Post date:** [February 26, 2024, 2:06pm UTC](https://forum.babylonjs.com/t/get-shadow-map-texture/48302/1 "2024-02-26T14:06:21Z")

</div>

Hello!

I am using CascadedShadowGenerator, and I would like to get somehow the actual shadow map texture and save it to a file.  
So I try to read the texture pixels draw it to a canvas and then open the image in a new browser tab.  
The image save part is working. You can test it if uncommenting the “Just for testing the image save” part in the PG code.

So my question how can I get correctly the shadow generator, shadow texture? Because now I get only a blank image. Is it possible?

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

In the PG hitting the “M” key will make the shadow map and render it to a canvas.

---

<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:** [February 27, 2024, 10:46am UTC](https://forum.babylonjs.com/t/get-shadow-map-texture/48302/2 "2024-02-27T10:46:12Z")

</div>

Assigned @Evgeni\_Popov on February 27, 2024, 10:46am UTC



---

<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:** [February 27, 2024, 12:19pm UTC](https://forum.babylonjs.com/t/get-shadow-map-texture/48302/3 "2024-02-27T12:19:49Z")

</div>

It’s currently not possible to do it because reading from a 2DArrayTexture is not supported.

We have an internal issue about it, but if someone is willing to implement it, all the better!

---

<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:** [February 27, 2024, 12:19pm UTC](https://forum.babylonjs.com/t/get-shadow-map-texture/48302/4 "2024-02-27T12:19:51Z")

</div>

Unassigned @Evgeni\_Popov on February 27, 2024, 12:19pm UTC



---

<div class="post-metadata">

**Author:** ![robcaa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/robcaa/32/36415_2.png) [@robcaa](https://forum.babylonjs.com/u/robcaa)\
**Post date:** [February 27, 2024, 2:25pm UTC](https://forum.babylonjs.com/t/get-shadow-map-texture/48302/5 "2024-02-27T14:25:04Z")

</div>

Thanks for the info. I may not need it after all.  
But for debugging reason it would be nice to show the shadow map
