[Bf-blender-cvs] [7e593898844] greasepencil-object: GPencil: More changes to Glow Blend modes

Antonio Vazquez noreply at git.blender.org
Mon Feb 17 16:39:45 CET 2020


Commit: 7e593898844db4fd1880d03942a93f99a6a36712
Author: Antonio Vazquez
Date:   Mon Feb 17 16:39:37 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB7e593898844db4fd1880d03942a93f99a6a36712

GPencil: More changes to Glow Blend modes

Still some issues

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

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 22838280ccf..a85605e7c4b 100644
--- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c
@@ -441,7 +441,29 @@ static void gpencil_vfx_glow(GlowShaderFxData *fx, Object *UNUSED(ob), gpIterVfx
   DRW_shgroup_uniform_bool_copy(grp, "firstPass", true);
   DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
 
-  state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL;
+  state = DRW_STATE_WRITE_COLOR;
+  /* Blending: Force blending. */
+  switch (fx->blend_mode) {
+    case eGplBlendMode_Regular:
+      state |= DRW_STATE_BLEND_ALPHA_PREMUL;
+      break;
+    case eGplBlendMode_Add:
+      state |= DRW_STATE_BLEND_ADD_FULL;
+      break;
+    case eGplBlendMode_Subtract:
+      state |= DRW_STATE_BLEND_SUB;
+      break;
+    case eGplBlendMode_Multiply:
+    case eGplBlendMode_Divide:
+      state |= DRW_STATE_BLEND_MUL;
+      break;
+  }
+
+  if (fx->blend_mode == eGplBlendMode_Subtract) {
+    /* For this effect to propagate, we need a signed floating point buffer. */
+    iter->pd->use_signed_fb = true;
+  }
+
   grp = gpencil_vfx_pass_create("Fx Glow V", state, iter, sh);
   DRW_shgroup_uniform_vec2_copy(
       grp, "offset", (float[2]){0.0f - fx->blur[1] * s, fx->blur[1] * c});
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 8fb5edb3163..4d7218667e2 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vfx_frag.glsl
@@ -196,7 +196,7 @@ void main()
   }
 
   if (!firstPass) {
-    fragColor.a = dot(fragRevealage.rgb, vec3(0.333334));
+    fragColor.a = clamp(1.0 - dot(fragRevealage.rgb, vec3(0.333334)), 0.0, 1.0);
     blend_mode_output(blendMode, fragColor, 1.0, fragColor, fragRevealage);
   }
 }



More information about the Bf-blender-cvs mailing list