[Bf-blender-cvs] [d47127623ed] greasepencil-object: GPencil: Use Texture alpha for Holdout

Antonio Vazquez noreply at git.blender.org
Sun Sep 13 15:51:54 CEST 2020


Commit: d47127623ed7bd51efdd40b7bcee784b52092f66
Author: Antonio Vazquez
Date:   Sun Sep 13 15:51:21 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rBd47127623ed7bd51efdd40b7bcee784b52092f66

GPencil: Use Texture alpha for Holdout

The holdout only is applied when texture alpha is > 0.

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

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

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

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
index 2d2d99bfe66..6a117b28398 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
@@ -91,8 +91,14 @@ void main()
 
   /* Holdout materials. */
   if (GP_FLAG_TEST(matFlag, GP_STROKE_HOLDOUT | GP_FILL_HOLDOUT)) {
-    revealColor = vec4(1.0 - fragColor.aaa, 1.0);
-    fragColor = vec4(fragColor.rgb, 1.0);
+    /* If texture, use only the visible area of the texture for holdout. */
+    if (GP_FLAG_TEST(matFlag, GP_STROKE_TEXTURE_USE | GP_FILL_TEXTURE_USE)) {
+      revealColor = vec4(col.aaa * fragColor.aaa, 1.0);
+    }
+    else {
+      revealColor = vec4(1.0 - fragColor.aaa, 1.0);
+      fragColor = vec4(fragColor.rgb, 1.0);
+    }
   }
   else {
     /* NOT holdout materials.



More information about the Bf-blender-cvs mailing list