[Bf-blender-cvs] [3e3c442d852] greasepencil-object: GPencil: More changes to Blend modes in Glow

Antonio Vazquez noreply at git.blender.org
Mon Feb 17 17:24:44 CET 2020


Commit: 3e3c442d85270528a8d2872d05ca4074f77f3c9f
Author: Antonio Vazquez
Date:   Mon Feb 17 17:24:11 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB3e3c442d85270528a8d2872d05ca4074f77f3c9f

GPencil: More changes to Blend modes in Glow

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

M	source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M	source/blender/draw/engines/gpencil/shaders/gpencil_vfx_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 b4566fd4a23..fc21b6a1422 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -134,8 +134,7 @@ static void gpencil_vfx_blur(BlurShaderFxData *fx, Object *ob, gpIterVfxData *it
   }
   if (blur_size[1] > 0.0f) {
     grp = gpencil_vfx_pass_create("Fx Blur V", state, iter, sh);
-    DRW_shgroup_uniform_vec2_copy(
-        grp, "offset", (float[2]){-blur_size[1] * s, blur_size[1] * c});
+    DRW_shgroup_uniform_vec2_copy(grp, "offset", (float[2]){-blur_size[1] * s, blur_size[1] * c});
     DRW_shgroup_uniform_int_copy(grp, "sampCount", max_ii(1, min_ii(fx->samples, blur_size[1])));
     DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
   }
@@ -465,9 +464,8 @@ static void gpencil_vfx_glow(GlowShaderFxData *fx, Object *UNUSED(ob), gpIterVfx
   }
 
   grp = gpencil_vfx_pass_create("Fx Glow V", state, iter, sh);
-  DRW_shgroup_uniform_vec2_copy(
-      grp, "offset", (float[2]){-fx->blur[1] * s, fx->blur[1] * c});
-  DRW_shgroup_uniform_vec3_copy(grp, "threshold", ref_col);
+  DRW_shgroup_uniform_vec2_copy(grp, "offset", (float[2]){-fx->blur[1] * s, fx->blur[1] * c});
+  DRW_shgroup_uniform_vec3_copy(grp, "threshold", (float[3]){-1.0f, -1.0f, -1.0f});
   DRW_shgroup_uniform_vec3_copy(grp, "glowColor", (float[3]){1.0f, 1.0f, 1.0f});
   DRW_shgroup_uniform_bool_copy(grp, "glowUnder", (fx->flag & FX_GLOW_USE_ALPHA) != 0);
   DRW_shgroup_uniform_bool_copy(grp, "firstPass", false);
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl
index 4d7218667e2..0f1f65d649f 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl
@@ -182,8 +182,11 @@ void main()
     fragRevealage.rgb += (1.0 - rev) * weight;
   }
 
-  fragColor *= glowColor.rgbb / weight_accum;
-  fragRevealage = 1.0 - fragRevealage / weight_accum;
+  if (weight_accum > 0.0) {
+    fragColor *= glowColor.rgbb / weight_accum;
+    fragRevealage = fragRevealage / weight_accum;
+  }
+  fragRevealage = 1.0 - fragRevealage;
 
   if (firstPass && glowUnder) {
     /* In first pass we copy the reveal buffer. This let us do the alpha under if needed. */



More information about the Bf-blender-cvs mailing list