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-18 02:10:19 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-20 02:27:44 +0300
commit48fd10a77dd8e53eb0ef063ce11bf4086fdb9f17 (patch)
tree83b00adfa7d8c2f78152c89719499679aec594e6 /source/blender/editors/sculpt_paint
parentea4d28aea0343afbd9b1cddc9fc20679f234945e (diff)
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
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_cloth.c9
1 files changed, 7 insertions, 2 deletions
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);