CascadedShadowGenerator not working but regular ShadowGenerator works

Hi everyone!

I have a small question regarding shadow generators. I’ve probably missed something crucial, but after changing my regular ShadowGenerator to CascadedShadowGenerator, the shadows have disappeared. I was just trying the cascaded version to see if it works better with large rooms I have, since the regular one doesn’t work that well when the directional light is situated far away.

So here is the broken one with CascadedShadowGenerator:

Here is a working one with regular ShadowGenerator:

Does anyone have a clue why the cascaded one is not working?

You need to set the shadowMaxZ property of the shadow generator (or camera.maxZ, which is the value used when shadowMaxZ is not set) to the smallest possible value. See Cascaded Shadow Maps | Babylon.js Documentation

You can also raise the lamba value as it seems a bigger value than 0.5 (the default) is better suited in your case:

For fairer comparison with the non cascaded shadow generator, here’s the PG using the same filtering technic than in the cascaded PG:

3 Likes

Yeah, that was it! Thank you :heart_eyes: Also a bit curious on what the lights intensity levels can be, I somehow figured that the max value was one :smiley:

There’s no real max value, you can use whatever is best for you (I set it to 2 in the PG so that we can better see the shadows).

2 Likes