Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-10-15 20:54:21 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-15 20:54:41 +0300
commitca55a1b564a6ff32784d7c611b4728be400637e8 (patch)
tree72bdccfa210948875cf405afe1667e36076c350e
parent91af828e8bfaa04cbd49f1859e06a1f76749102d (diff)
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
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c4
1 files changed, 3 insertions, 1 deletions
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