Issue with CascadedShadowMap + ShadowOnlyMaterial

For directional lights, the light position does not matter regarding the shadows themselves, but is still relevant to generate the light frustum. So, you can move the position anywhere you want to make the light frustum as tight as possible.

See: https://playground.babylonjs.com/#4DUVC6#3

The light direction is rotating, but the light position is such that the light frustum is always a good fit for the skull, so the shadows remain crisp. This PG is made with a standard shadow generator, not with CSM.

If the ground does not cast shadow, it should not be a shadow caster (as in the PG) and so won’t impact the shadow map size. Only shadow casters have to be rendered in the shadow map.

Note that percentage closer filtering (PCF) is a filtering method, not to be confused with the shadow rendering method, which is either the standard way (ShadowGenerator, a single shadow map is used) or CSM (multiple shadow maps are used). You can use PCF with both rendering methods. PCF is the default filtering method for CSM, whereas it is “none” for ShadowGenerator.

As explained above, PCF is the default filtering method for CSM, so if you didn’t change that, PCF should also work with ShadowGenerator.

CSM is WebGL2 only, contrary to ShadowGenerator that will also work in WebGL1. If you target mobiles, it’s likely that it won’t work for a number of people because they don’t support WebGL2 (all iPhones, for eg).

If your use case is like the PG with a single object casting shadows (or multiple objects but that don’t span a large area), then you should be able to achieve very good shadows with the standard shadow generator. Maybe your settings were not right?

[EDIT]
Also, performance wise, a single shadow generator is a lot faster than CSM with autoCalcDepthBounds = true.
[/EDIT]