[Bf-blender-cvs] [9e0674d519d] greasepencil-object: Cleanup shader code

Antonio Vazquez noreply at git.blender.org
Tue Mar 27 19:11:26 CEST 2018


Commit: 9e0674d519dc22b8683f687f4c1dae44a12c135e
Author: Antonio Vazquez
Date:   Tue Mar 27 19:11:13 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9e0674d519dc22b8683f687f4c1dae44a12c135e

Cleanup shader code

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

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

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

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
index edfc2ac3394..0983e6c4d87 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl
@@ -28,19 +28,18 @@ void main()
 	float stroke_depth = texelFetch(strokeDepth, uv, 0).r;
 	vec4 stroke_color =  texelFetch(strokeColor, uv, 0).rgba;
 
+	/* premult alpha factor to remove double blend effects */
 	if (stroke_color.a > 0) {
 		stroke_color = vec4(vec3(stroke_color.rgb / stroke_color.a), stroke_color.a);
 	}
-	
+
+	/* apply color correction for render only */
 	if (tonemapping == 1) {
-		FragColor.r = srgb_to_linearrgb(stroke_color.r);
-		FragColor.g = srgb_to_linearrgb(stroke_color.g);
-		FragColor.b = srgb_to_linearrgb(stroke_color.b);
-		FragColor.a = stroke_color.a;
-	}
-	else {
-		FragColor = stroke_color;
+		stroke_color.r = srgb_to_linearrgb(stroke_color.r);
+		stroke_color.g = srgb_to_linearrgb(stroke_color.g);
+		stroke_color.b = srgb_to_linearrgb(stroke_color.b);
 	}
-	
+
+	FragColor = stroke_color;
 	gl_FragDepth = stroke_depth;
 }



More information about the Bf-blender-cvs mailing list