[Bf-blender-cvs] [9e7e926ed3d] greasepencil-object: Try to fix the rim problem when the image ends outside view
Antonio Vazquez
noreply at git.blender.org
Sat Jul 7 11:13:15 CEST 2018
Commit: 9e7e926ed3d2ae1007c99748a9125c07d7b64c70
Author: Antonio Vazquez
Date: Sat Jul 7 11:13:01 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9e7e926ed3d2ae1007c99748a9125c07d7b64c70
Try to fix the rim problem when the image ends outside view
The rim is disabled if the image to rim extends beyond the borders.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_rim_prepare_frag.glsl
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
index a9932242f2b..7cbe4835024 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -394,6 +394,8 @@ static void DRW_gpencil_fx_rim(
DRW_shgroup_call_add(fx_shgrp, fxquad, NULL);
DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeColor", &e_data->temp_color_tx_a);
DRW_shgroup_uniform_texture_ref(fx_shgrp, "strokeDepth", &e_data->temp_depth_tx_a);
+ DRW_shgroup_uniform_vec2(fx_shgrp, "Viewport", DRW_viewport_size_get(), 1);
+
DRW_shgroup_uniform_int(fx_shgrp, "offset", &fxd->offset[0], 2);
DRW_shgroup_uniform_vec3(fx_shgrp, "rim_color", &fxd->rim_rgb[0], 1);
DRW_shgroup_uniform_vec3(fx_shgrp, "mask_color", &fxd->mask_rgb[0], 1);
diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_rim_prepare_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_rim_prepare_frag.glsl
index 6807a07d6c9..fe35d3832e1 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_rim_prepare_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_rim_prepare_frag.glsl
@@ -6,6 +6,7 @@ uniform mat4 ViewMatrix;
/* ******************************************************************* */
uniform sampler2D strokeColor;
uniform sampler2D strokeDepth;
+uniform vec2 Viewport;
uniform int offset[2];
uniform vec3 rim_color;
@@ -38,6 +39,13 @@ void main()
if (src_pixel.a == 0.0f) {
discard;
}
+ /* check inside viewport */
+ else if ((uv.x - dx < 0) || (uv.x - dx > Viewport[0])) {
+ discard;
+ }
+ else if ((uv.y - dy < 0) || (uv.y - dy > Viewport[1])) {
+ discard;
+ }
/* pixel is equal to mask color, keep */
else if (src_pixel.rgb == mask_color.rgb) {
discard;
More information about the Bf-blender-cvs
mailing list