Skip to content

Conversation

lawnjelly
Copy link
Member

@lawnjelly lawnjelly commented Apr 1, 2025

Fixes behaviour of CPUParticles to behave similarly to Particles when using physics interpolation.

Notes

  • [3.x] Physics Interpolation - Move 3D FTI to SceneTree #103685 while being generally amazing had the unfortunate side effect of breaking CPUParticles somewhat
  • CPUParticles contained a lot of specific code to workaround problems caused by the previous server side physics interpolation, these no longer should work in the same way
  • On balance CPUParticles is better off using a paradigm of per frame processing, while following an interpolated target (as in [3.x] CPUParticles2D - Add ability to follow physics interpolated target #80931 which does this for 2D). The results are far superior.
  • This PR hardcodes it to use per frame processing when physics interpolation is on, while following the interpolated target for emission using get_global_transform_interpolated() (which is far more effective now that FTI is done client side)

Discussion

In the interests of brevity, this PR currently only changes 2 lines to get the behaviour required. There is therefore quite a lot of unused code now in CPUParticles, but that might make more sense to remove in a follow up, as it makes this PR easier to review. (Related, the equivalent change in 4.x has less to remove, because CPUParticles physics interpolation has not yet been forward ported).

CPUParticles now works perfectly in global and local mode (with physics interpolation on for the branch, with physics_interpolation_mode set to OFF and an interpolated parent it judders as expected, but users shouldn't normally be using this).
GPUParticles works perfectly in global and local mode (in both physics_interpolation_mode settings for the branch.

@lawnjelly lawnjelly added this to the 3.7 milestone Apr 1, 2025
@lawnjelly lawnjelly requested a review from a team as a code owner April 1, 2025 16:33
@lawnjelly lawnjelly changed the title Physics Interpolation - Fix CPUParticles to work with SceneTreeFTI [3.x] Physics Interpolation - Fix CPUParticles to work with SceneTreeFTI Apr 1, 2025
@lawnjelly lawnjelly requested a review from rburing April 1, 2025 19:33
Copy link
Member

@rburing rburing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that following an interpolated target is the better approach, and probably it's also the only thing that users expect from particles when they turn on FTI.

@lawnjelly lawnjelly merged commit fa5c589 into godotengine:3.x Apr 7, 2025
14 checks passed
@lawnjelly
Copy link
Member Author

Thanks!

@lawnjelly lawnjelly deleted the fti_fix_cpu_particles branch April 7, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants