Fixed radial inwards velocity clamping incorrectly (regression from 83488)

This commit is contained in:
QbieShay 2023-11-22 22:38:14 +01:00
parent 80de898d72
commit a879e59581
1 changed files with 6 additions and 3 deletions

View File

@ -762,8 +762,11 @@ void ParticleProcessMaterial::_update_shader() {
code += "}\n";
code += "vec3 process_radial_displacement(DynamicsParameters param, float lifetime, inout uint alt_seed, mat4 transform, mat4 emission_transform){\n";
code += "vec3 process_radial_displacement(DynamicsParameters param, float lifetime, inout uint alt_seed, mat4 transform, mat4 emission_transform, float delta){\n";
code += " vec3 radial_displacement = vec3(0.0);\n";
code += " if (delta < 0.001){\n";
code += " return radial_displacement;\n";
code += " }\n";
code += " float radial_displacement_multiplier = 1.0;\n";
if (tex_parameters[PARAM_RADIAL_VELOCITY].is_valid()) {
code += " radial_displacement_multiplier = texture(radial_velocity_curve, vec2(lifetime)).r;\n";
@ -774,7 +777,7 @@ void ParticleProcessMaterial::_update_shader() {
code += " }else{radial_displacement = get_random_direction_from_spread(alt_seed, 360.0)* param.radial_velocity;} \n";
code += " if (radial_displacement_multiplier * param.radial_velocity < 0.0){\n // Prevent inwards velocity to flicker once the point is reached.";
code += " if (length(radial_displacement) > 0.01){\n";
code += " radial_displacement = normalize(radial_displacement) * min(abs((radial_displacement_multiplier * param.radial_velocity)), length(transform[3].xyz - global_pivot));\n";
code += " radial_displacement = normalize(radial_displacement) * min(abs((radial_displacement_multiplier * param.radial_velocity)), length(transform[3].xyz - global_pivot) / delta);\n";
code += " }\n";
code += " \n";
code += " return radial_displacement;\n";
@ -923,7 +926,7 @@ void ParticleProcessMaterial::_update_shader() {
}
code += " // calculate all velocity\n";
code += " \n";
code += " controlled_displacement += process_radial_displacement(dynamic_params, lifetime_percent, alt_seed, TRANSFORM, EMISSION_TRANSFORM);\n";
code += " controlled_displacement += process_radial_displacement(dynamic_params, lifetime_percent, alt_seed, TRANSFORM, EMISSION_TRANSFORM, DELTA);\n";
code += " \n";
if (tex_parameters[PARAM_DIRECTIONAL_VELOCITY].is_valid()) {
code += " controlled_displacement += process_directional_displacement(dynamic_params, lifetime_percent, TRANSFORM, EMISSION_TRANSFORM);\n";