diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2019-11-14 21:12:11 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2019-11-21 20:02:33 +0300 |
commit | c7ade50deee781493e40d6851159e40e1c4a7d5d (patch) | |
tree | f534595db43cccbe00cf9f22ae9a9ba240822bba | |
parent | 15f82278d5d4ca2b282cb8e5e377965cf28aaa17 (diff) |
Clay Strips: Input pressure curve and new defaults
By squaring the pen pressure and disabling BRUSH_SPACE_ATTEN the brush
feels like it has a bigger strength range, wich makes it easier to
control when applying less pressure in order to smooth sculpted
surfaces.
Each brush should have a custom input pressure curve by default to get
an optimal behaviour and make all brushes consistent, but that is going
to take some time to get it right.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6214
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 20 |
3 files changed, 22 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 75669e8289a..a873f3a3f13 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -930,8 +930,9 @@ void BKE_brush_sculpt_reset(Brush *br) br->flag |= BRUSH_FRONTFACE; break; case SCULPT_TOOL_CLAY_STRIPS: - br->flag |= BRUSH_ACCUMULATE; - br->alpha = 0.7f; + br->flag |= BRUSH_ACCUMULATE | BRUSH_SIZE_PRESSURE; + br->flag &= ~BRUSH_SPACE_ATTEN; + br->alpha = 0.6f; br->normal_radius_factor = 1.55f; br->curve_preset = BRUSH_CURVE_SPHERE; br->spacing = 6; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 385e37f7d22..b9af33e7ad6 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1343,7 +1343,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) immUniformColor3fvAlpha(outline_col, outline_alpha); - if (ups->stroke_active && BKE_brush_use_size_pressure(scene, brush)) { + if (ups->stroke_active && BKE_brush_use_size_pressure(scene, brush) && + mode != PAINT_MODE_SCULPT) { imm_draw_circle_wire_3d( pos, translation[0], translation[1], final_radius * ups->size_pressure_value, 40); /* outer at half alpha */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 89bc7912ccf..00d2f948c5f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1731,6 +1731,9 @@ static float brush_strength(const Sculpt *sd, float flip = dir * invert * pen_flip; + /* Pressure final value after being tweaked depending on the brush */ + float final_pressure; + switch (brush->sculpt_tool) { case SCULPT_TOOL_CLAY: case SCULPT_TOOL_DRAW: @@ -1738,8 +1741,9 @@ static float brush_strength(const Sculpt *sd, case SCULPT_TOOL_LAYER: return alpha * flip * pressure * overlap * feather; case SCULPT_TOOL_CLAY_STRIPS: - /* Clay Strips needs extra strength to compensate for its default normal radius */ - return alpha * flip * pressure * overlap * feather * 1.3f; + /* Clay Strips needs less strength to compensate the curve */ + final_pressure = pressure * pressure * pressure; + return alpha * flip * final_pressure * overlap * feather * 0.3f; case SCULPT_TOOL_MASK: overlap = (1 + overlap) / 2; @@ -6133,6 +6137,16 @@ static void sculpt_update_cache_invariants( #undef PIXEL_INPUT_THRESHHOLD } +static float sculpt_brush_dynamic_size_get(Brush *brush, StrokeCache *cache, float initial_size) +{ + switch (brush->sculpt_tool) { + case SCULPT_TOOL_CLAY_STRIPS: + return max_ff(initial_size * 0.35f, initial_size * cache->pressure * cache->pressure); + default: + return initial_size * cache->pressure; + } +} + static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Brush *brush) { SculptSession *ss = ob->sculpt; @@ -6331,7 +6345,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po if (BKE_brush_use_size_pressure(scene, brush) && paint_supports_dynamic_size(brush, PAINT_MODE_SCULPT)) { - cache->radius = cache->initial_radius * cache->pressure; + cache->radius = sculpt_brush_dynamic_size_get(brush, cache, cache->initial_radius); } else { cache->radius = cache->initial_radius; |