[Bf-blender-cvs] [36b2a8fb6c5] greasepencil-object: Fix pattern mode for strokes

Antonio Vazquez noreply at git.blender.org
Wed Feb 21 09:35:21 CET 2018


Commit: 36b2a8fb6c5622e6583a30381e4f1607f0618421
Author: Antonio Vazquez
Date:   Wed Feb 21 09:30:09 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB36b2a8fb6c5622e6583a30381e4f1607f0618421

Fix pattern mode for strokes

Now use the alpha channel

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

M	source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
M	source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl

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

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index a3490997c8b..d25ca28154a 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -35,8 +35,7 @@ void main()
 	/* pattern */
 	if (color_type == GPENCIL_COLOR_PATTERN) {
 		vec4 text_color = texture2D(myTexture, mTexCoord);
-		/* normalize texture color */
-		float nvalue = 1.0 - ((text_color.x + text_color.y + text_color.z) / 3.0);
-		fragColor = mix(vec4(0.0, 0.0, 0.0, 0.0), mColor, nvalue);
+		fragColor = mColor;
+		fragColor.a = min(text_color.a, mColor.a);
 	}
 }
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 78f48fe4e65..f606dca9187 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_stroke_frag.glsl
@@ -37,8 +37,7 @@ void main()
 	/* pattern */
 	if (color_type == GPENCIL_COLOR_PATTERN) {
 		vec4 text_color = texture2D(myTexture, mTexCoord);
-		/* normalize texture color */
-		float nvalue = 1.0 - ((text_color.x + text_color.y + text_color.z) / 3.0);
-		fragColor = mix(vec4(0.0, 0.0, 0.0, 0.0), tColor, nvalue);
+		fragColor = tColor;
+		fragColor.a = min(text_color.a, tColor.a);
 	}
 }



More information about the Bf-blender-cvs mailing list