From 3d9545d2e0aee9f6c67867b22cf3fb9b1f708bc6 Mon Sep 17 00:00:00 2001 From: vaxerski Date: Fri, 18 Aug 2023 22:07:28 +0200 Subject: [PATCH] shaders: minor premultiplication fixes --- src/render/shaders/Border.hpp | 7 +++++-- src/render/shaders/Shadow.hpp | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/render/shaders/Border.hpp b/src/render/shaders/Border.hpp index d881dc5b5..4e2d485db 100644 --- a/src/render/shaders/Border.hpp +++ b/src/render/shaders/Border.hpp @@ -109,11 +109,14 @@ void main() { discard; } - if (pixColor[3] == 0.0) + if (additionalAlpha == 0.0) discard; pixColor = getColorForCoord(v_texcoord); + pixColor.rgb *= pixColor[3]; - gl_FragColor = pixColor * alpha * additionalAlpha; + pixColor *= alpha * additionalAlpha; + + gl_FragColor = pixColor; } )#"; diff --git a/src/render/shaders/Shadow.hpp b/src/render/shaders/Shadow.hpp index 49f548d78..2c7b07b28 100644 --- a/src/render/shaders/Shadow.hpp +++ b/src/render/shaders/Shadow.hpp @@ -79,9 +79,7 @@ void main() { } // premultiply - pixColor[0] *= pixColor[3]; - pixColor[1] *= pixColor[3]; - pixColor[2] *= pixColor[3]; + pixColor.rgb *= pixColor[3]; gl_FragColor = pixColor; })#";