[Bf-blender-cvs] [48fd10a77dd] master: Sculpt: Reduce the displacement step in the cloth solver

Pablo Dobarro noreply at git.blender.org
Tue Oct 20 01:28:05 CEST 2020


Commit: 48fd10a77dd8e53eb0ef063ce11bf4086fdb9f17
Author: Pablo Dobarro
Date:   Sun Oct 18 01:10:19 2020 +0200
Branches: master
https://developer.blender.org/rB48fd10a77dd8e53eb0ef063ce11bf4086fdb9f17

Sculpt: Reduce the displacement step in the cloth solver

Previously the base displacement for solving the constraints was always
using 0.5, which may introduce artifacts when multiple constraints of
different types are computed for the same vertex. This introduces a
factor that reduces the base displacement of the solver, reducing the
artifacts.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9202

===================================================================

M	source/blender/editors/sculpt_paint/sculpt_cloth.c

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index 591168fd3a2..1a1200bb6c2 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -153,6 +153,8 @@ static float cloth_brush_simulation_falloff_get(const Brush *brush,
 
 #define CLOTH_LENGTH_CONSTRAINTS_BLOCK 100000
 #define CLOTH_SIMULATION_ITERATIONS 5
+
+#define CLOTH_SOLVER_DISPLACEMENT_FACTOR 0.6f
 #define CLOTH_MAX_CONSTRAINTS_PER_VERTEX 1024
 #define CLOTH_SIMULATION_TIME_STEP 0.01f
 #define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH 0.35f
@@ -805,10 +807,13 @@ static void cloth_brush_satisfy_constraints(SculptSession *ss,
                                         (cloth_sim->length_constraint_tweak[v2] * 0.5f);
 
       if (current_distance > 0.0f) {
-        mul_v3_v3fl(correction_vector, v1_to_v2, 1.0f - (constraint_distance / current_distance));
+        mul_v3_v3fl(correction_vector,
+                    v1_to_v2,
+                    CLOTH_SOLVER_DISPLACEMENT_FACTOR *
+                        (1.0f - (constraint_distance / current_distance)));
       }
       else {
-        copy_v3_v3(correction_vector, v1_to_v2);
+        mul_v3_v3fl(correction_vector, v1_to_v2, CLOTH_SOLVER_DISPLACEMENT_FACTOR);
       }
 
       mul_v3_v3fl(correction_vector_half, correction_vector, 0.5f);



More information about the Bf-blender-cvs mailing list