Skip to content
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

Properly calculate lifetime_split for particles #73313

Merged
merged 1 commit into from
Apr 12, 2023

Conversation

clayjohn
Copy link
Member

Fixes: #50825

Supersedes: #55382

While evaluating #55382 I realized that the problem lies elsewhere which is why #55382 was causing additional artifacts

This PR adjusts the calculating of lifetime_split by adding one to it and then taking the modulo of the result with the amount of particles. It is difficult to say why this change is needed. I think it is because the nature of the particles means that the first particle emitted is always particle 1 rather than particle 0. But It is difficult to track particles individually.

Because I am uncertain about the reasoning for the fix, I think this would be better merged after 4.0 and then cherrypicked for 4.0.1

Before
Screenshot from 2023-02-14 14-14-55
After
Screenshot from 2023-02-14 14-15-31

Before
Screenshot from 2023-02-14 14-34-41
After
Screenshot from 2023-02-14 14-35-37

Before
Screenshot from 2023-02-14 14-35-06
After
Screenshot from 2023-02-14 14-35-30

I also tested with particle trails enabled but the before and after is not so obvious there

@akien-mga akien-mga merged commit 5e34a28 into godotengine:master Apr 12, 2023
@akien-mga
Copy link
Member

Thanks!

@YuriSizov
Copy link
Contributor

Cherry-picked for 4.0.3.

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.

Lifetime draw order in GPUParticles2D is wrong at the beginning
3 participants