From f67f895770c546243d6976228fbf4a500c19185f Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Wed, 25 Nov 2020 16:00:44 +0100 Subject: GPencil: Disable vertex color when use holdout If the material has the holdout enabled, the value of the vertex color must not be used. --- .../draw/engines/gpencil/shaders/gpencil_common_lib.glsl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/draw') diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl index 94b066c12e5..45b2b92a09b 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl @@ -526,6 +526,11 @@ void stroke_vertex() vec4 stroke_col = MATERIAL(m).stroke_color; float mix_tex = MATERIAL(m).stroke_texture_mix; + /* Special case: We don't use vertex color if material Holdout. */ + if (GP_FLAG_TEST(GP_FLAG(m), GP_STROKE_HOLDOUT)) { + vert_col = vec4(0.0); + } + color_output(stroke_col, vert_col, vert_strength * small_line_opacity, mix_tex); matFlag = GP_FLAG(m) & ~GP_FILL_FLAGS; @@ -576,6 +581,11 @@ void fill_vertex() float fill_opacity = fcol1.a - (fcol_decode.a * 10); fcol_decode.a /= 10000.0; + /* Special case: We don't use vertex color if material Holdout. */ + if (GP_FLAG_TEST(GP_FLAG(m), GP_FILL_HOLDOUT)) { + fcol_decode = vec4(0.0); + } + /* Apply opacity. */ fill_col.a *= fill_opacity; /* If factor is > 1 force opacity. */ -- cgit v1.2.3