[Bf-blender-cvs] [e43fcee7782] greasepencil-object: GPencil: Fix NaN result in divide blend mode

Clément Foucault noreply at git.blender.org
Thu Feb 13 00:35:41 CET 2020


Commit: e43fcee7782f3407b168c99b6d5b04e9b74a8e0e
Author: Clément Foucault
Date:   Wed Feb 12 23:28:14 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBe43fcee7782f3407b168c99b6d5b04e9b74a8e0e

GPencil: Fix NaN result in divide blend mode

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

M	source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl

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

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 a9c66e82d75..29fa893afbf 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl
@@ -102,7 +102,7 @@ void blend_mode_output(
     case MODE_DIVIDE:
       /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/
       color.a *= opacity;
-      frag_revealage = frag_color = clamp(1.0 / (1.0 - color * color.a), 0.0, 1e18);
+      frag_revealage = frag_color = clamp(1.0 / max(vec4(1e-6), 1.0 - color * color.a), 0.0, 1e18);
       break;
     case MODE_OVERLAY:
       /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/



More information about the Bf-blender-cvs mailing list