From 361431d903e9aa8ceb6a9bff0e313d577071b88f Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Sun, 16 Feb 2020 17:46:39 +0100 Subject: [PATCH] Fix premultiplied alpha in-output of crosshatch shader --- .../org/openrndr/extra/fx/gl3/dither/crosshatch.frag | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orx-fx/src/main/resources/org/openrndr/extra/fx/gl3/dither/crosshatch.frag b/orx-fx/src/main/resources/org/openrndr/extra/fx/gl3/dither/crosshatch.frag index 8397a225..6b5fc0e5 100644 --- a/orx-fx/src/main/resources/org/openrndr/extra/fx/gl3/dither/crosshatch.frag +++ b/orx-fx/src/main/resources/org/openrndr/extra/fx/gl3/dither/crosshatch.frag @@ -50,6 +50,6 @@ vec3 crosshatch(vec3 texColor, float t1, float t2, float t3, float t4) { void main() { vec4 color = texture(tex0, v_texCoord0); - o_color.rgb = crosshatch(color.rgb, t1, t2, t3, t4); - o_color.a = color.a; + vec3 demultiplied = color.a == 0.0 ? vec3(0.0) : color.rgb/color.a; + o_color = vec4(crosshatch(demultiplied, t1, t2, t3, t4), 1.0) * color.a; } \ No newline at end of file