[Bf-blender-cvs] [ca55a1b564a] master: Fix Cloth brush grab artifacts in the affected area

Pablo Dobarro noreply at git.blender.org
Thu Oct 15 19:55:42 CEST 2020


Commit: ca55a1b564a6ff32784d7c611b4728be400637e8
Author: Pablo Dobarro
Date:   Thu Oct 15 19:54:21 2020 +0200
Branches: master
https://developer.blender.org/rBca55a1b564a6ff32784d7c611b4728be400637e8

Fix Cloth brush grab artifacts in the affected area

The cloth brush grab mode was creating constraints at 1.0 strength in
the area of the brush where the fade was evaluated to 1. This was causing
stability issues in the simulation and not producing ideal results.
Now the constraint strength is scaled with an empirically found factor.

The values in this patch may require further tweaking after experimenting
a little bit more with them.

Reviewed By: sergey, zeddb

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

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

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 efd80eef0cb..591168fd3a2 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -157,6 +157,7 @@ static float cloth_brush_simulation_falloff_get(const Brush *brush,
 #define CLOTH_SIMULATION_TIME_STEP 0.01f
 #define CLOTH_DEFORMATION_SNAKEHOOK_STRENGTH 0.35f
 #define CLOTH_DEFORMATION_TARGET_STRENGTH 0.01f
+#define CLOTH_DEFORMATION_GRAB_STRENGTH 0.1f
 
 static bool cloth_brush_sim_has_length_constraint(SculptClothSimulation *cloth_sim,
                                                   const int v1,
@@ -381,7 +382,8 @@ static void do_cloth_brush_build_constraints_task_cb_ex(
         /* When the grab brush brush is used as part of the cloth brush, deformation constraints
          * are created with different strengths and only inside the radius of the brush. */
         const float fade = BKE_brush_curve_strength(brush, sqrtf(len_squared), ss->cache->radius);
-        cloth_brush_add_deformation_constraint(data->cloth_sim, node_index, vd.index, fade);
+        cloth_brush_add_deformation_constraint(
+            data->cloth_sim, node_index, vd.index, fade * CLOTH_DEFORMATION_GRAB_STRENGTH);
       }
       else if (brush->cloth_deform_type == BRUSH_CLOTH_DEFORM_SNAKE_HOOK) {
         /* Cloth Snake Hook creates deformation constraint with fixed strength because the strength



More information about the Bf-blender-cvs mailing list