diff options
author | Pablo Dobarro <pablodp606> | 2020-03-01 21:57:44 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-03-01 22:05:58 +0300 |
commit | ff0124418f42dc12f31b00faf23276db961e2e51 (patch) | |
tree | 56dbd9be3bf1f967b997fe6fddb86125dd40dc75 /source/blender/editors | |
parent | fc7fdc5c4ed69809bcecc5762957aa42375ca6a2 (diff) |
Sculpt: Hardness brush property
The hardness property moves the brush falloff towards the edges, making
the brush sharper.
This should be the intended way to control the brush falloff instead of
tweaking the falloff curve manually, as it can be mapped to pressure to
make the falloff variable during the stroke.
It is also a good idea to show in the UI that the custom curves is an
advance features and it should almost never be modified when sculpting/
painting unless you want to create some advanced effects. By modifying
the curves freely it is really easy to break the brushes and make them
produce artifacts. This needs to be done in a later after merging the
pending projects to reorganize all the brush properties accordingly.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6902
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index c2ae563c45f..e203cabe22d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1953,8 +1953,20 @@ float tex_strength(SculptSession *ss, } } + /* Hardness. */ + float final_len = len; + const float hardness = br->hardness; + float p = len / cache->radius; + if (p < hardness) { + final_len = 0.0f; + } + else { + p = (p - hardness) / (1.0f - hardness); + final_len = p * cache->radius; + } + /* Falloff curve. */ - avg *= BKE_brush_curve_strength(br, len, cache->radius); + avg *= BKE_brush_curve_strength(br, final_len, cache->radius); avg *= frontface(br, cache->view_normal, vno, fno); /* Paint mask. */ |