Shadow generator produces wrong shadow

It appears that the shadow generator is not producing the expected results. In this example, sphere0’s shadow is a circular line instead of a solid circle, and sphere1 does not cast a shadow at all

Can you please let me know what I am doing wrong
Thank you

You need to set shadowMinZ and shadowMaxZ.
For example:

    light.shadowMinZ = 0
    light.shadowMaxZ = 5

see line 36


Or don’t set it, but put the light farther away.
In debug view, it’s a good idea to make the frame include everything you want to cast a shadow on.

Example of placing the light farther away.

Debugging views can be easily turned on in inspector


@qq2315137135 Thank you for the solution and thank you for demo’ing BABYLON.DirectionalLightFrustumViewer - it is indeed very helpful and I did not know about it

If it can help, we have some docs explaining how to setup the parameters of the frustum for directional lights:

1 Like