-
-
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
Improve shadow rendering performance by rendering static shadows and dynamic shadows separately for each light #4635
Comments
Hmm.. For Directional Shadows this might not be very effective. Any time the Camera Moves, the Directional Shadows would have to be re-rendered anyway even if all the geometry is static. |
The shadow frustum is stabilized and snapped to prevent jittering when the camera moves, so I assume the shadow map only needs to be re-rendered when enough movement has occurred and repositioning is required. See also godotengine/godot#33340. |
Indeed for directional lights you often have that the larger cascades don't need to be updated regularly so this could speed it up as well. But the bigger benefit will be with normal lights |
I honestly don't think that this is the way to go. While having the concept of static geometry makes sense for shadows I can think of several other parts of the engine that could benefit from this as well. If we are seriously considering this I think we should implement a general-purpose solution that makes it possible to mark nodes (and all their children) as static, making it impossible for the user to move them, change their mesh & collision shapes, or add any children. We would also need to explicitly block certain nodes & features (e.g. animation, custom vertex shaders, ...) in the static part of the scene hierarchy to make sure that nothing breaks. |
Related to #2745 and #4661 (technique from the same presentation).
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Godot currently performs shadow map caching for all light types, but it will invalidate the entire texture (from both static and dynamic object casters) whenever it changes. This means the static geometry also needs to be redrawn on the shadow map whenever a dynamic object is moved.
This is especially taxing with DirectionalLight shadows, which update every frame as soon as an animated object is present in the scene (unless its Cast Shadow property is set to Off).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Improve shadow rendering performance by rendering static shadows and dynamic shadows separately for each light. This can be used to make caching more effective, especially in levels with complex static geometry.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Slides 44 to 50 of https://research.activision.com/publications/2021/10/shadows-of-cold-war--a-scalable-approach-to-shadowing mention a caching approach that could be used. Including screenshots of the most important 3 slides for reference, in case that link goes down:
What would be done on the Godot side:
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
The shadow rendering pipeline is core, and can't be overwritten by an add-on.
Keywords for easier searching: shadowmap, shadowmapping
The text was updated successfully, but these errors were encountered: