-
-
Notifications
You must be signed in to change notification settings - Fork 20.8k
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 collided 3D GPU particles sometimes jittering #92474
Fix collided 3D GPU particles sometimes jittering #92474
Conversation
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.
Tested locally on the RD and GLES3 backends and can confirm that this PR fixes the jittering.
With the jittering fixed, it's more obviously when the particle penetrates and then de-penetrates a surface (in the next frame) unofortunately, but that is something we can fix later. This PR is already a huge improvement.
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.
Tested locally, it works as expected.
However, this PR completely changes the appearance of the trails particles in https://github.com/godotengine/godot-demo-projects/tree/master/3d/particles due to the collision behavior being modified in "fringe" cases:
Before
particle_trail_collision_before.mp4
After (this PR)
particle_trail_collision_after.mp4
I assume this is because this PR changes how particles collide when they spawn within a collision box (even if only slightly). Reducing the particle's collision base size from 0.1 to 0.01 fixes the issue in the particles demo, but I thought I'd highlight it.
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.
Despite my above comment, I still think this is good to merge. Code looks good to me.
I would highlight this change in the next blog post still, just in case.
Thanks! |
@Calinou What version/commit did you use for the before? |
It's |
Fixes an issue found by @RPicster in #87320.
What would happen is a particle will collide with a collider, the collision system would detect it and attempt to move the particle out of the collider. Sometime this would result in a particle that still touches the collider and other times not (When it touched was cause by a floating point precision error). If the particle did not touch the collider it would start moving again even though visually it is touching the collider. This causes "collided" particles to jitter. It is much more visible at lower Particle "Fixed FPS"
The solution I found was to introduce an EPSILON term in collision calculations. This ensures that collided particle will always "touch" the collider after the particle has been moved. This solution was applied to the Forward+ renderer as well as the OpenGL renderer.
An MRP showcasing the issue and solution for multiple collider types