-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[4.x] Use depth prepass to increase opaque render performance #70214
Conversation
What seems broken? This change should be applicable to the OpenGL renderer as well |
Checked the log, and it would appear that GL doesn't like many of the image formats that were used with the clustered renderer. Also, it would appear that refraction is currently broken. Whenever I try to start godot complains about the following:
A quick search would imply that this is caused by Line 1230 in material.cpp. godot/scene/resources/material.cpp Lines 1229 to 1231 in d44d0cc
|
Is this change relevant for 3.x's GLES3 renderer, which features a depth prepass? |
Ah yes, |
servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
Outdated
Show resolved
Hide resolved
I've tested this change on https://github.com/Calinou/godot-reflection, but it doesn't improve things much on a Radeon RX 6900 XT (Mesa RADV). This was tested by running the project without the editor in the background and staying at the spawn location. GPU is forced into a high power state with gamemode to avoid fluctuations. 1152×864
3840×2160
This can be reproduced when disabling all environment effects as well (uncheck everything in Environment, but keep Tonemap on Filmic): 3840×2160 (no effects)
|
@Calinou That scene is a bad test case for this PR since it is >90% solid geometry. What I do is leverage the depth pre-pass to make the rendering of alpha-clipped elements far cheaper, which doesn't really matter in scenes without alphaclipped objects. You should see at least some speedup if you open a scene with vegetation or hair cards. I think there is a link to an example project in my original post. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than this one small comment, I think this should be good!
servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp
Outdated
Show resolved
Hide resolved
Thanks! |
Some minor performance improvements I came up with while investigating #68959.
This has the big advantage that transparent fragments can be discarded by the early test before they even enter the fragment stage. We thus save ourselves from starting a fragment shader just to immediately quit it again when we discard.
I tested this PR using https://github.com/Rytelier/Godot-4-forest-benchmark and got the following results:
Details
As you can see this change can reduce the time needed for the opaque pass by up to half.
According to renderdoc 33678, 12582, and 3654 are all meshes used to render the leaves of the trees.
Visually I could see no difference between the rendered frames.
(Kinda) fixes #60364
This PR is not applicable to the mobile renderer, since it has no prepass. I am fairly certain that a similar change could be implemented in the OpenGL renderer, but it appears to be currently broken