[Bf-blender-cvs] [93b5682444d] blender-v2.83-release: Fix T76909 GPencil: Layers with mask(s) invisible when using "in front"

Clément Foucault noreply at git.blender.org
Wed May 20 17:48:28 CEST 2020


Commit: 93b5682444d51c3232efa59b0e4e6c3e0562a503
Author: Clément Foucault
Date:   Wed May 20 17:48:14 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB93b5682444d51c3232efa59b0e4e6c3e0562a503

Fix T76909 GPencil: Layers with mask(s) invisible when using "in front"

The gpSceneDepthTexture is using a dummy 1px texture which was generating
wrong values for uvs when sampling gpMaskTexture.

Use the max size of both since any of the 2 can use dummy texture.

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

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 8c2032f834a..d81c6f4fe0b 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
@@ -99,8 +99,10 @@ void main()
     discard;
   }
 
+  vec2 fb_size = max(vec2(textureSize(gpSceneDepthTexture, 0).xy),
+                     vec2(textureSize(gpMaskTexture, 0).xy));
+  vec2 uvs = gl_FragCoord.xy / fb_size;
   /* Manual depth test */
-  vec2 uvs = gl_FragCoord.xy / vec2(textureSize(gpSceneDepthTexture, 0).xy);
   float scene_depth = texture(gpSceneDepthTexture, uvs).r;
   if (gl_FragCoord.z > scene_depth) {
     discard;



More information about the Bf-blender-cvs mailing list