Clay Thumb: Remove hardcoded hardness value
authorPablo Dobarro <pablodp606@gmail.com>
Sun, 1 Mar 2020 19:13:29 +0000 (20:13 +0100)
committerPablo Dobarro <pablodp606@gmail.com>
Mon, 2 Mar 2020 10:54:54 +0000 (11:54 +0100)
Clay Thumb was using a custom hardness implementation and value to make
it functional. Hardness is now a property of brushes and it is
implemented for all brushes, so this is no longer needed.

Reviewed By: brecht

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

source/blender/blenkernel/intern/brush.c
source/blender/editors/sculpt_paint/sculpt.c

index 09b3ad89e73c7d3259b9cbfc7e206a0ad15a28c6..1d3965fc7c39c682b0d30e62347dbc7b5f813e64 100644 (file)
@@ -943,6 +943,7 @@ void BKE_brush_sculpt_reset(Brush *br)
       br->alpha = 0.5f;
       br->normal_radius_factor = 1.0f;
       br->spacing = 6;
+      br->hardness = 0.5f;
       br->flag |= BRUSH_SIZE_PRESSURE;
       br->flag &= ~BRUSH_SPACE_ATTEN;
       break;
index e203cabe22d23eed292851f90ee805caed8f96b2..c0f843a47bbbff4371d6d5693fb30d8df59b349c 100644 (file)
@@ -5344,7 +5344,6 @@ static void do_clay_thumb_brush_task_cb_ex(void *__restrict userdata,
   float(*mat)[4] = data->mat;
   const float *area_no_sp = data->area_no_sp;
   const float *area_co = data->area_co;
-  const float hardness = 0.50f;
 
   PBVHVertexIter vd;
   float(*proxy)[3];
@@ -5387,17 +5386,10 @@ static void do_clay_thumb_brush_task_cb_ex(void *__restrict userdata,
       interp_v3_v3v3(intr, intr, intr_tilt, tilt_mix);
       sub_v3_v3v3(val, intr_tilt, vd.co);
 
-      /* Deform the real vertex test distance with a hardness factor. This moves the falloff
-       * towards the edges of the brush, producing a more defined falloff and a flat center. */
-      float dist = sqrtf(test.dist);
-      float p = dist / ss->cache->radius;
-      p = (p - hardness) / (1.0f - hardness);
-      CLAMP(p, 0.0f, 1.0f);
-      dist *= p;
       const float fade = bstrength * tex_strength(ss,
                                                   brush,
                                                   vd.co,
-                                                  dist,
+                                                  sqrtf(test.dist),
                                                   vd.no,
                                                   vd.fno,
                                                   vd.mask ? *vd.mask : 0.0f,