Merge pull request #83749 from k0T0z/fix-enabling-particle-turbulence
Fix massive performance hit due to enabling collision
This commit is contained in:
commit
bbade19822
1 changed files with 10 additions and 6 deletions
|
@ -984,6 +984,9 @@ void ParticleProcessMaterial::_update_shader() {
|
|||
}
|
||||
code += " \n";
|
||||
code += " vec3 noise_direction = get_noise_direction(TRANSFORM[3].xyz);\n";
|
||||
// The following snippet causes massive performance hit. We don't need it as long as collision is disabled.
|
||||
// Refer to GH-83744 for more info.
|
||||
if (collision_mode != COLLISION_DISABLED) {
|
||||
code += " if (!COLLIDED) {\n";
|
||||
code += " \n";
|
||||
code += " float vel_mag = length(final_velocity);\n";
|
||||
|
@ -991,6 +994,7 @@ void ParticleProcessMaterial::_update_shader() {
|
|||
code += " final_velocity = mix(final_velocity, normalize(noise_direction) * vel_mag * (1.0 + (1.0 - vel_infl) * 0.2), vel_infl);\n";
|
||||
code += " }\n";
|
||||
}
|
||||
}
|
||||
code += " \n";
|
||||
code += " // limit velocity\n";
|
||||
if (velocity_limit_curve.is_valid()) {
|
||||
|
|
Loading…
Reference in a new issue