Get shadow map texture


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?

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

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!

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