-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move DirectionalLight3D's shadow mode to a project setting #3353
Comments
I am concerned that having multiple DirectionalLight3Ds may be more of a common use-case then we realize. Before moving the settings, we should try to ascertain how common of a use case it really is. |
I'd say multiple 3D Directional lights aren't a common use case, not with shadows anyway, as the quality tanks hard with just 2 shadowed directional lights, especially considering that often times it is desired to have the highest draw distance while maintaining good quality shadows. Also there is the added Performance hit with having 2 directional shadow casters, and add to that, that Sky only takes into account one Directional light, so there isn't going to be that many people trying to have like 2 suns or something.. A cool part of moving this to Project settings - Mobile default could be added, like with the shadow resolutions and soft shadows Additionally, I think Blending should also be changed to a Project setting, if this is switched to a Project setting, and naturally Blending should default to off if Orthogonal |
I read an UE4 environment scene breakdown the other day. It seems using multiple DirectionalLights is a popular choice to fake global illumination when other GI methods aren't viable (due to performance constraints or lack of real-timeness). However, in this case, only one DirectionalLight will have shadows enabled as the "fake GI" lights don't have shadows enabled. Therefore, this proposal doesn't impact this use case 🙂 PS: We should probably document this multiple DirectionalLight trick somewhere, as it's an effective and fairly cheap alternative to VoxelGI, SDFGI or LightmapGI in mostly outdoor scenes. |
+1 to documenting the trick, as someone making outdoor scenes a lot (racer & shooter both) |
I think this can be worked around by adding a sort of "preferred mode" in project settings and add options to directional lights to use the preferred mode or a force it to use something else. |
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
The DirectionalLight3D shadow mode setting doesn't adjust itself automatically for mobile platforms, which leads to unexpectedly low performance. This is because the default mode (PSSM 4 Splits) is too expensive for most mobile devices. Instead, Orthogonal or PSSM 2 Splits should be used along with a lower shadow maximum distance (to preserve shadow detail).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Move the DirectionalLight3D shadow mode property to a project setting (but keep Max Distance as a property).
This would allow defaulting the shadow mode to Orthogonal mode on mobile platforms, which is significantly faster than PSSM 4 Splits (the current default on all platforms). This also makes it easier to adjust all DirectionalLight3Ds' shadow mode at run-time (e.g. in a graphics options menu). You would no longer need to apply this change to every DirectionalLight3D manually using a script.
The only downside of this change is that you won't be able to use different DirecionalLight3D shadow modes at the same time. Nonetheless, I don't think this use case is common right now as shadow quality will suffer if you have more than one DirectionalLight3D with shadows already. For temporary effects such as thunder, it's generally better to brighten the main DirectionalLight3D, increase ambient lighting or add a second DirectionalLight3D without shadows.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
rendering/shadows/directional_shadow/mode
with the options Orthogonal (Fast), PSSM 2 Splits (Average), PSSM 4 Splits (Slow).If this enhancement will not be used often, can it be worked around with a few lines of script?
No, as DirectionalLight3D rendering code is part of the engine.
Is there a reason why this should be core and not an add-on in the asset library?
This is core rendering functionality.
The text was updated successfully, but these errors were encountered: