Open megalobyte opened 2 years ago
Judging by the screenshot, the shadows in orthogonal mode look correct to me. You should probably reduce Shadow Max Distance in the DirectionalLight3D node to increase their effective resolution – the default value is tuned for fairly large open worlds, not small-scale games.
Can you try following the same steps in 3.4.2 and see if shadows look better out of the box, with the same Shadow Max Distance value in both projects?
Also, the minimal reproduction project didn't upload (likely because you clicked away from the text field while it was still uploading). Try editing your post and upload it again.
You are right, except it was the camera's far property that I had to update. Is it too early to update the documentation? I know a lot of things are in flux with 4.0
You are right, except it was the camera's far property that I had to update.
The Far property defaults to 4000 in master
to support large open worlds out of the box.
The issue here is that DirectionalLight3D does not use the Shadow Max Distance property when the camera is in orthogonal mode, and uses the camera Far value as the maximum distance instead. Can you check whether this happens in 3.4.2 too?
Is it too early to update the documentation? I know a lot of things are in flux with 4.0
The documentation could be updated, but I feel like the core behavior mentioned above should be changed for 4.0.
In 3.4.2, I set the far value to 4000 and this is what I got:
I should mention that the Max Shadow distance was the same value for 3.4.2 and 4.0
In 3.4.2, I set the far value to 4000 and this is what I got:
I should mention that the Max Shadow distance was the same value for 3.4.2 and 4.0
That roughly looks like the shadow resolution you'd get in master
. You can compare it more easily by setting the directional shadow filter quality to Hard in the Project Settings.
About the same resolution, but doesn't have the same blend effect as 3.4.2
I'm guessing that's probably just a difference with how the rendering engine works?
I'm guessing that's probably just a difference with how the rendering engine works?
3.4 uses PCF5 shadow filtering by default, while master
uses an entirely different approach to shadow map filtering. To compare its shadow resolution with master
, you have to set the shadow filter mode to Disabled in the Project Settings (in 3.4.2).
You are right again :)
Thank you for the help! I've learned a lot
I can confirm this on master
f4b0c7a1e and 3.x
3ba980379 (both GLES3 and GLES2).
master
): test_shadow_orthogonal_camera_master.zip3.x
): test_shadow_orthogonal_camera_3.x.zipmaster
The DirectionalLight3D's Shadow Max Distance is set to 100 on all screenshots.
Far = 4000 | Far = 500 | Far = 100 |
---|---|---|
![]() |
![]() |
![]() |
3.x
The DirectionalLight's Shadow Max Distance is set to 100 on all screenshots.
Far = 4000 | Far = 500 | Far = 100 |
---|---|---|
![]() |
![]() |
![]() |
It looks like shadow_max_distance has been ignored for a long time (well over 5 years https://github.com/godotengine/godot/commit/eedb39091aaa1dc0b8f204844bb1eb270b2349f6), so there must be something else causing the issue
This appears to be done on purpose here: https://github.com/godotengine/godot/blob/251fb83d536a96110790bbf85b3fa50e5a8e2b7c/servers/rendering/renderer_scene_cull.cpp#L2084
If you remove the check, shadows will disappear unless you greatly increase Shadow Max Distance in the DirectionalLight3D properties (it must be at least 3,200 or so if the editor camera's Far property is 4,000).
Many people are reporting Shadow Mesh LOD not working correctly when they try the "Your first 3D game" official tutorial:
https://www.reddit.com/r/godot/comments/170wqon/weird_shadows_in_godot_3d_tutorial/
There seems to be a relation to orthogonal camera setting
@golddotasksquestions This is a different issue, which is tracked in https://github.com/godotengine/godot/issues/78422. You can work around the issue by disabling LOD generation on 3D scenes that have problematic shadows in the Import dock.
Godot version
499eec13a3
System information
Arch, Vukan, X11, NVIDIA GeForce GTX 1070/PCIe/SSE2
Issue description
Shadows don't appear to be rendered correctly when using an orthogonal perspective.
Orthogonal:![Screenshot from 2022-02-19 19-05-44](https://user-images.githubusercontent.com/80655527/154823344-165daca9-b68d-479b-a499-2e6f67a7b327.png)
Perspective:![Screenshot from 2022-02-19 19-06-02](https://user-images.githubusercontent.com/80655527/154823345-3ffecb55-7fb9-4a71-aa46-317d1cc0f2c0.png)
Scene uses a directional light.
Steps to reproduce
Any scene with a directional light and an orthogonal camera perspective should recreate the issue, but I've attached a project for convenience.
Minimal reproduction project
[Uploading minimal_project.zip…]()