From c63fd2e72b4cd4a41dec00c36597d4be6e122b4f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 15 Dec 2022 19:13:37 +0100 Subject: [PATCH] Fixed a premultiplied alpha shader issue that lead to artifacting when brightness was adjusted. --- resources/shaders/glsl/core.glsl | 1 + resources/shaders/glsl/scanlines.glsl | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/shaders/glsl/core.glsl b/resources/shaders/glsl/core.glsl index b17415b03..9e60a02d2 100644 --- a/resources/shaders/glsl/core.glsl +++ b/resources/shaders/glsl/core.glsl @@ -73,6 +73,7 @@ void main() // Brightness. if (brightness != 0.0) { + sampledColor.rgb /= sampledColor.a; sampledColor.rgb += 0.3 * brightness; sampledColor.rgb *= sampledColor.a; } diff --git a/resources/shaders/glsl/scanlines.glsl b/resources/shaders/glsl/scanlines.glsl index 923e70290..39df227f4 100644 --- a/resources/shaders/glsl/scanlines.glsl +++ b/resources/shaders/glsl/scanlines.glsl @@ -158,6 +158,7 @@ void main() // Brightness. if (brightness != 0.0) { + colorTemp.rgb /= colorTemp.a; colorTemp.rgb += 0.3 * brightness; colorTemp.rgb *= colorTemp.a; }