Commit: c6f6d6ef09855122eb69ab7d75e5afee7fd1e6d4
Author: Antonioya
Date:   Thu Jul 18 16:50:43 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc6f6d6ef09855122eb69ab7d75e5afee7fd1e6d4

GPencil: Enable gradient factor for Line strokes

Now it's possible to use the same gradient used in Dots and Boxes with Line 
strokes. This was disabled, pending to solve the overlap glitches, but as this 
was fixed with stencil, we can enable it again.

Also, the gradient formula has been changed to use the same of Dots.

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

M       release/scripts/startup/bl_ui/space_view3d_toolbar.py
M       source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py 
b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e7be73391b7..d8f214028ea 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1789,10 +1789,10 @@ class 
VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel):
                 ma = None
 
             col.separator()
+            col.prop(gp_settings, "gradient_factor", slider=True)
             subcol = col.column(align=True)
             if ma and ma.grease_pencil.mode == 'LINE':
                 subcol.enabled = False
-            subcol.prop(gp_settings, "gradient_factor", slider=True)
             subcol.prop(gp_settings, "gradient_shape")
 
 
diff --git 
a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl 
b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
index 73baacb35d4..8281a696b35 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -76,14 +76,11 @@ void main()
   }
 
   /* gradient */
-  /* keep this disabled while the line glitch bug exists
-  if (gradient_f < 1.0) {
-    float d = abs(mTexCoord.y - 0.5)  * (1.1 - gradient_f);
-    float alpha = 1.0 - clamp((fragColor.a - (d * 2.0)), 0.03, 1.0);
-    fragColor.a = smoothstep(fragColor.a, 0.0, alpha);
-
-  }
-  */
+   if (gradient_f < 1.0) {
+    float dist = abs(mTexCoord.y - 0.5) * 2.0;
+    float decay = dist * (1.0 - gradient_f) * fragColor.a;
+    fragColor.a = clamp(fragColor.a - decay, 0.0, 1.0);
+   }
 
   if (fragColor.a < 0.0035) {
     discard;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to