The directional lights' shadow does not look right

The directional lights’ shadow does not look right


I have never seen any shadow like that in any renderers for any lights. The shadow is a circle??!!

What is the algorithm behind the directional lights’ shadow?

https://playground.babylonjs.com/#R1EVD0#131

@Evgeni_Popov can help with that, he is the king of the shadows

Huh, Popov taught me how to solve this problem.you can check this topic :wink:

3 Likes

musk’s topic goes very well into this, the same frustum problem is happening here:


Move the light a tiny bit up, shadows render as expected:

Alternatively, you can set the light’s frustum manually:

There’s some talk about how the directional light’s position affects the shadows here: Shadows | Babylon.js Documentation (babylonjs.com)
And here’s a bit more on the calculation of the shadow projection matrix: Tutorial 16 : Shadow mapping (opengl-tutorial.org)

Does that solve your question, @Newsome ?

1 Like

@PirateJC could we add this to the doc I am pretty sure this kind of tips can be a lot of help :slight_smile:

2 Likes