Fix sqrt application for radius in particle ring emission
This commit is contained in:
parent
f91db3dc58
commit
94eefe168a
|
@ -880,7 +880,7 @@ void CPUParticles3D::_particles_process(double p_delta) {
|
|||
} break;
|
||||
case EMISSION_SHAPE_RING: {
|
||||
real_t ring_random_angle = Math::randf() * Math_TAU;
|
||||
real_t ring_random_radius = Math::sqrt(Math::randf() * (emission_ring_radius - emission_ring_inner_radius * emission_ring_inner_radius) + emission_ring_inner_radius * emission_ring_inner_radius);
|
||||
real_t ring_random_radius = Math::sqrt(Math::randf() * (emission_ring_radius * emission_ring_radius - emission_ring_inner_radius * emission_ring_inner_radius) + emission_ring_inner_radius * emission_ring_inner_radius);
|
||||
Vector3 axis = emission_ring_axis == Vector3(0.0, 0.0, 0.0) ? Vector3(0.0, 0.0, 1.0) : emission_ring_axis.normalized();
|
||||
Vector3 ortho_axis;
|
||||
if (axis.abs() == Vector3(1.0, 0.0, 0.0)) {
|
||||
|
|
|
@ -634,7 +634,7 @@ void ParticleProcessMaterial::_update_shader() {
|
|||
if (emission_shape == EMISSION_SHAPE_RING) {
|
||||
code += " \n";
|
||||
code += " float ring_spawn_angle = rand_from_seed(alt_seed) * 2.0 * pi;\n";
|
||||
code += " float ring_random_radius = sqrt(rand_from_seed(alt_seed) * (emission_ring_radius - emission_ring_inner_radius * emission_ring_inner_radius) + emission_ring_inner_radius * emission_ring_inner_radius);\n";
|
||||
code += " float ring_random_radius = sqrt(rand_from_seed(alt_seed) * (emission_ring_radius * emission_ring_radius - emission_ring_inner_radius * emission_ring_inner_radius) + emission_ring_inner_radius * emission_ring_inner_radius);\n";
|
||||
code += " vec3 axis = emission_ring_axis == vec3(0.0) ? vec3(0.0, 0.0, 1.0) : normalize(emission_ring_axis);\n";
|
||||
code += " vec3 ortho_axis = vec3(0.0);\n";
|
||||
code += " if (abs(axis) == vec3(1.0, 0.0, 0.0)) {\n";
|
||||
|
|
Loading…
Reference in New Issue