[LWJGL] [JOML] Shadow Map to an Ortographic View


I’m adding and studying about shadows and I’ve came across a lot with tutorials that use something like this for the LightView Ortho matrix:
new Matrix4f().setOrtho(-10.0f, 10.0f, -10.0f, 10.0f, -1f, 20.0f);

Playing with the values and the light I got this values as “good” values:
new Matrix4f().setOrtho(-50.0f, 50.0f, -50.0f, 50.0f, -1f, 200.0f);

I’ve tried different values and approaches with the distance of light trying to understand what is happening…

My question is: there is a way to compute this ortho matrix based on my current camera properties?

Thanks in advanced … this forum is the best :stuck_out_tongue:

[edit] I’ve updated the image with more objects in the scene.
Current result: