-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Preprocess on GPU Particles not working correctly after await #75723
Comments
Can you reproduce this with CPUParticles? |
No. CPUParticles work correctly. I mentioned this in the example project, but I forgot to put it in this issue report. |
The issue seems to be that the GPUParticles are preprocessed without applying the world transform. When I add a camera to the particle scene, I see this (the sprite is at the scene origin): So all the particles are preprocessed, just at the wrong place (in the original scene the left half of them off the screen). On the left you can see the preprocessed particles centered around the origin, and on the right you can see the new particles appearing after the scene starts, centered around the correct particle system world position (I offset it by 128px, the with of the emitter box). I'll take this on and fix it. |
Here is what happens:
When the particles scene is created after the timer is triggered, the GPUParticles2D is created and added to the update list, but SceneTree::flush_transform_notifications() isn't called before drawing it, so preprocessing which happens on the first draw uses initial position (0, 0). To fix this, we need to call MessageQueue::get_singleton()->flush() in SceneTree::process(), after timers have been processed and before flush_transform_notifications() - in the same way as it is already called in other 2 places in the same function, with a comment "small little hack". This will put the GPUParticles2D into the xform_change_list before the call to xform flush. Maybe message queue flush in SceneTree::physics_process also needs to go after the timers and tweens have been processed? In any case all these "small little hacks" will have to be refactored at some point. :) |
Created pull request #78671 |
Is this fixed? Because I met this problem in Godot v4.1.1 |
This isn't fixed yet, as #78671 isn't merged yet (see review comments as for why it probably won't be accepted in its current state). |
is this fixed in Godot v4.2? |
Godot version
4.0.2.stable
System information
Windows 11
Issue description
If you await and then switch to a scene with GPU particles that are supposed to preprocess, they don't preprocess correctly.
Steps to reproduce
Minimal reproduction project
I've included a minimum example of the issue. Simply run the game and you'll see that the preprocess for the particles doesn't work correctly.
PreprocessBugMin.zip
The text was updated successfully, but these errors were encountered: