Merge pull request #32309 from clayjohn/particles_tex_scale

Fix particles scale randomization
This commit is contained in:
Rémi Verschelde 2019-09-24 18:05:44 +02:00 committed by GitHub
commit 0c3335d1f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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()) {