[Bf-blender-cvs] [956fafbc136] greasepencil-refactor: GPencil: Refactor: Fix completely hard stroke not being 100% hard

Clément Foucault noreply at git.blender.org
Tue Feb 11 18:58:53 CET 2020


Commit: 956fafbc13691494fd173584f0b13ddfe11d9208
Author: Clément Foucault
Date:   Tue Feb 11 18:58:36 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB956fafbc13691494fd173584f0b13ddfe11d9208

GPencil: Refactor: Fix completely hard stroke not being 100% hard

This was a problem with intensily lit gpencil objects.

===================================================================

M	source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl

===================================================================

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
index 80e3df699f8..729bcc31ceb 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
@@ -175,10 +175,15 @@ float stroke_round_cap_mask(vec2 p1, vec2 p2, float thickness, float hardfac)
   uv_end /= thickness;
 
   float dist = clamp(1.0 - length(uv_end) * 2.0, 0.0, 1.0);
-  /* Modulate the falloff profile */
-  float hardness = 1.0 - hardfac;
-  dist = pow(dist, mix(0.1, 10.0, hardness));
-  return smoothstep(0.0, 1.0, dist);
+  if (hardfac > 0.999) {
+    return step(0.0, dist);
+  }
+  else {
+    /* Modulate the falloff profile */
+    float hardness = 1.0 - hardfac;
+    dist = pow(dist, mix(0.01, 10.0, hardness));
+    return smoothstep(0.0, 1.0, dist);
+  }
 }
 
 #endif



More information about the Bf-blender-cvs mailing list