-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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 particles not properly updated by their lifetime #45496
Conversation
af04d1c
to
c72d60c
Compare
c72d60c
to
aefce80
Compare
} else { | ||
uint32_t alt_seed = p.seed; | ||
|
||
p.time += local_delta; | ||
p.custom[1] = p.time / lifetime; | ||
tv = p.time / p.lifetime; | ||
|
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.
Should p.custom[1]
be set as the same as tv too? Or is there something that assumes p.custom[1]
is in relation to the unadjusted lifetime?
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.
Its used in this code:
float base_angle = (parameters[PARAM_ANGLE] + tex_angle) * Math::lerp(1.0f, p.angle_rand, randomness[PARAM_ANGLE]);
base_angle += p.custom[1] * lifetime * (parameters[PARAM_ANGULAR_VELOCITY] + tex_angular_velocity) * Math::lerp(1.0f, rand_from_seed(alt_seed) * 2.0f - 1.0f, randomness[PARAM_ANGULAR_VELOCITY]);
p.rotation = Math::deg2rad(base_angle); //angle
float animation_phase = (parameters[PARAM_ANIM_OFFSET] + tex_anim_offset) * Math::lerp(1.0f, p.anim_offset_rand, randomness[PARAM_ANIM_OFFSET]) + p.custom[1] * (parameters[PARAM_ANIM_SPEED] + tex_anim_speed) * Math::lerp(1.0f, rand_from_seed(alt_seed), randomness[PARAM_ANIM_SPEED]);
p.custom[2] = animation_phase;
I'm not sure whether it's can be changed here so I used a temporary variable to avoid this.
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.
I've no idea either not that familiar with the particles, we'll see if anyone else chimes in.. Worst case though it wouldn't be bad to merge as is and this could be fixed in a separate PR if necessary.
Thanks! |
Fixed several properties which gather from the texture in default Particles material that is not properly handled by
lifetime_randomness
. Also fixed inCPUParticles
/CPUParticles2D
.Before:
After:
Fix #43485
Test Project:
Particles_3.2_CurveTest.zip