Hi,
I am currently running into the issue, that I do not know, how to update the right DepthRenderer for cascaded shadow maps.
Have a look at the following playground. Zoom out on first camera! After the switch to the other camera, the shadows should disappear.
https://www.babylonjs-playground.com/#1ST43U#442
The reason seems to be, that both cameras need different depth renderers and that they need to be set to the csm? But I still do not seem to get it to work.
Any recommendations?
Best,
Martin
Why would the shadows disappear when switching to the 2nd camera?
Hi,
I actually do not know. I guess the shadows are disappearing for you, too inside of the playground?
My feeling is, that the Depth Renderer still renders from the perspective of the other camera an not from the current active one.
No, the shadows are visible both from camera 1 and 2 in the PG (4.2.0-beta.5):
Is it the same even if you zoom out farther with the first camera?
In the following two pictures you see the two depth renderers.
I have also tried out a PG with only one depth renderer and when I refresh on second camera, its still the depth renderer of the first one. I am just not sure, how I can make it active. https://www.babylonjs-playground.com/#1ST43U#443
When switching cameras and depth renderers, you should set autoCalcDepthBounds
to true
each time so that internal data are recomputed to match the new depth renderer:
https://www.babylonjs-playground.com/#1ST43U#444
1 Like
Thanks a lot! That was easier than expected! Great to know! 