-
-
Notifications
You must be signed in to change notification settings - Fork 23.7k
Fix particle jitter when scene tree is paused #95912
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
Conversation
|
I tested and can confirm that this fixing the issue with pausing, but this does not fix #50824 as that issue includes low speed scale. Using a low speed scale in the MRP still reliably reproduces the issue. I suspect that much of this issue comes from the particles interpolation which happens in the copy shader. The
And used here:
You should check the values of frame remainder, as it must be fluctuating when it shouldn't. I agree that #89991 probably isn't the right approach. But its interesting to see that suppressing velocity was enough. That indicates to me that the core of the issue is in the interpolation (which is just Also note, that the same fixes will need to be implemented for the compatibility renderer too: https://github.com/godotengine/godot/blob/master/drivers/gles3/storage/particles_storage.cpp |
|
Thanks for the review. 🙏 You're right, I simplified the logic a bit when |
|
I ran the attached test scene with the following settings:
Any other scenarios I should test this with? |
|
Yes, you should test with a low |
c4a9161 to
97b2c01
Compare
|
Thanks for the suggestion! I did some more testing with low engine time scale and low particle system speed scale. Turns out I had the engine time scale multiplied in there when it wasn't needed, and I also needed to remove the particle system speed scaling from inside The only other scenario where I also went ahead and rebased the PR on top of the master branch. |
|
Please double check its current behaviour. If currently preprocess takes speed_scale into account, it should continue to do so. |
|
Currently preprocess does take Here's a sample project demonstrating that. It pauses the SceneTree, waits two seconds, then spawns a particle system with some preprocessing (which will not actually occur on master branch, you won't see anything). With this PR, you should see the particle system spawn with correct preprocessing. That said, I understand if it's desirable to maintain the current behavior for other reasons. Happy to defer if that's the decision. |
|
Any other thoughts on this? One slightly annoying thing is that at low speed scales, the interpolation becomes very obvious. It would be great if the fixed FPS automatically adjusted with the time scale so it actually simulates at the desired FPS regardless of speed scale. But maybe that would be best addressed in a separate PR. |
Changing fixed FPS can affect particle behavior in an undesired manner, especially when collision is involved. Also, changing fixed FPS at runtime can introduce visible jitter, and the FPS must be an integer value (while the time scale is a float). Therefore, automatic adjustment based on time scale should be an opt-in property discussed in a separate proposal. Note that the particle interpolation is currently more obvious than it could be due to some properties not being interpolated: #51318 |
|
@etodd I am working on a PR to request particle process that will work even if the scene tree is paused. I think preprocess should stay as it is right now, and we'll be able to tackle the usecase you mentioned once my PR is in! |
|
Seek PR: #92089 |
25e17a2 to
d19891f
Compare
|
@QbieShay I think your changes fixed the preprocessing bug. 🎉 Which means this PR should now have no effect other than fixing the jitter. I rebased the PR and it still works on my test projects. |
|
Re-tested the first test project with Also checked the preprocess behavior on the second test project is the same on 4.4-beta1 and this branch. |
clayjohn
left a comment
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.
Discussed in the rendering meeting today. This looks fine to me
d19891f to
87efa4d
Compare
|
Rebased and re-tested! |
|
Thanks! |
|
Cherry-picked for 4.4.1. |
|
Nice! Just ran into this issue on 4.4 and tested with 4.4.1, and it's fixed |
Fixes #85213, fixes #50824, fixes #65390.
Attached is a test project which pauses and unpauses every second, and includes:
This PR is based on #89991, but in my testing, that PR changed the behavior of turbulence when the fixed FPS is set to anything other than 30.
particle-pause-jitter-fix.zip