-
-
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 CPUParticles3D
using angle incorrectly when ROTATE_Y
is set.
#89595
Fix CPUParticles3D
using angle incorrectly when ROTATE_Y
is set.
#89595
Conversation
CPUParticles3D
using angle incorrectly when ROTATE_Y is set.
CPUParticles3D
using angle incorrectly when ROTATE_Y is set.CPUParticles3D
using angle incorrectly when ROTATE_Y
is set.
@@ -1124,7 +1124,7 @@ void CPUParticles3D::_particles_process(double p_delta) { | |||
//turn particle by rotation in Y | |||
if (particle_flags[PARTICLE_FLAG_ROTATE_Y]) { | |||
Basis rot_y(Vector3(0, 1, 0), p.custom[0]); | |||
p.transform.basis = p.transform.basis * rot_y; | |||
p.transform.basis = rot_y; |
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.
The equivalent GPU particles code is this:
// turn particle by rotation in Y
if (particle_flags[PARTICLE_FLAG_ROTATE_Y]) {
code += " vec4 origin = TRANSFORM[3];\n";
code += " TRANSFORM = mat4(vec4(cos(CUSTOM.x), 0.0, -sin(CUSTOM.x), 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(sin(CUSTOM.x), 0.0, cos(CUSTOM.x), 0.0), vec4(0.0, 0.0, 0.0, 1.0));\n";
code += " TRANSFORM[3] = origin;\n";
}
I'm not too familiar with the math here, but aren't we losing at least the origin potentially?
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.
Nevermind, we're only changing basis
, so origin
is untouched.
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.
The equivalent GPU particles code is this:
These look the same indeed. 👍
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.
We are losing align with velocity though. But GpuParticles behavior seems to be similiar, it's one or another.
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.
Looks good, and I confirmed this fixes the MRP.
@@ -1124,7 +1124,7 @@ void CPUParticles3D::_particles_process(double p_delta) { | |||
//turn particle by rotation in Y | |||
if (particle_flags[PARTICLE_FLAG_ROTATE_Y]) { | |||
Basis rot_y(Vector3(0, 1, 0), p.custom[0]); | |||
p.transform.basis = p.transform.basis * rot_y; | |||
p.transform.basis = rot_y; |
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.
The equivalent GPU particles code is this:
These look the same indeed. 👍
Thanks! And congrats for your first (!?) merged Godot contribution 🎉 I guess this will help with getting CI running out of the box to finalize #80710 once the rendering team is ready for it :D |
Resolves #89559.