Shadow generator produces wrong shadow

Hello,
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
David

You need to set shadowMinZ and shadowMaxZ.
For example:

    light.shadowMinZ = 0
    light.shadowMaxZ = 5

see line 36

2 Likes

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

2 Likes

@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:

https://doc.babylonjs.com/features/featuresDeepDive/lights/shadows#in-depth-analyzing-of-directional-light-position

1 Like