Merge pull request #32309 from clayjohn/particles_tex_scale
Fix particles scale randomization
This commit is contained in:
commit
0c3335d1f3
3 changed files with 6 additions and 6 deletions
|
@ -866,8 +866,8 @@ void CPUParticles2D::_particles_process(float p_delta) {
|
|||
}
|
||||
|
||||
//scale by scale
|
||||
float base_scale = Math::lerp(parameters[PARAM_SCALE] * tex_scale, 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
|
||||
if (base_scale == 0.0) base_scale = 0.000001;
|
||||
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
|
||||
if (base_scale < 0.000001) base_scale = 0.000001;
|
||||
|
||||
p.transform.elements[0] *= base_scale;
|
||||
p.transform.elements[1] *= base_scale;
|
||||
|
|
|
@ -915,8 +915,8 @@ void CPUParticles::_particles_process(float p_delta) {
|
|||
}
|
||||
|
||||
//scale by scale
|
||||
float base_scale = Math::lerp(parameters[PARAM_SCALE] * tex_scale, 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
|
||||
if (base_scale == 0.0) base_scale = 0.000001;
|
||||
float base_scale = tex_scale * Math::lerp(parameters[PARAM_SCALE], 1.0f, p.scale_rand * randomness[PARAM_SCALE]);
|
||||
if (base_scale < 0.000001) base_scale = 0.000001;
|
||||
|
||||
p.transform.basis.scale(Vector3(1, 1, 1) * base_scale);
|
||||
|
||||
|
|
|
@ -567,8 +567,8 @@ void ParticlesMaterial::_update_shader() {
|
|||
}
|
||||
}
|
||||
//scale by scale
|
||||
code += " float base_scale = mix(scale * tex_scale, 1.0, scale_random * scale_rand);\n";
|
||||
code += " if (base_scale == 0.0) {\n";
|
||||
code += " float base_scale = tex_scale * mix(scale, 1.0, scale_random * scale_rand);\n";
|
||||
code += " if (base_scale < 0.000001) {\n";
|
||||
code += " base_scale = 0.000001;\n";
|
||||
code += " }\n";
|
||||
if (trail_size_modifier.is_valid()) {
|
||||
|
|
Loading…
Reference in a new issue