-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Fix massive performance hit due to enabling collision #83749
Fix massive performance hit due to enabling collision #83749
Conversation
4e5ff02
to
eb8fb25
Compare
Looks good to me, I also tested the PR and it works as expected. |
eb8fb25
to
771bcda
Compare
771bcda
to
a3460b2
Compare
Signed-off-by: Saif Kandil <74428638+k0T0z@users.noreply.github.com>
a3460b2
to
98db2b4
Compare
What I see is that this snippet is a simple calculation going on there, so why there's a massive performance hit happening here? Maybe the if (!COLLIDED) {
float vel_mag = length(VELOCITY);
float vel_infl = clamp(mix(turbulence_influence_min, turbulence_influence_max, rand_from_seed(alt_seed)) * turbulence_influence, 0.0, 1.0);
VELOCITY = mix(VELOCITY, normalize(noise_direction) * vel_mag * (1.0 + (1.0 - vel_infl) * 0.2), vel_infl);
} EDIT: I noticed the |
Godot detects when the COLLIDED keyword is used. If it's used anywhere in the shader then Godot will generate the screen space SDF for collisions. The performance cost is not from the shader itself, but from the cost of generating the SDF. If the SDF is used by another effect, then using COLLIDED wouldn't add additional cost |
@clayjohn I noticed |
I don't know if that was the root of the cause of the original reason for the performance problem. Turbulence will always come at an increased cost. So eventually rather be safe than sorry with the documentation? |
Indeed, we still expect turbulence to take up a significant amount of GPU time on integrated graphics. |
Thanks! |
Fixes #83744
Do we need to modify this patch #76598?