diff --git a/internal/graphicsdriver/directx/pipeline_windows.go b/internal/graphicsdriver/directx/pipeline_windows.go index 1f5e7df8f..8ce84a356 100644 --- a/internal/graphicsdriver/directx/pipeline_windows.go +++ b/internal/graphicsdriver/directx/pipeline_windows.go @@ -221,8 +221,7 @@ float4 PSMain(PSInput input) : SV_TARGET { color = mul(color_matrix_body, color) + color_matrix_translation; // Premultiply alpha color.rgb *= color.a; - // Apply color scale. - color *= input.color; + // Do not apply the color scale as the scale should always be (1, 1, 1, 1) when a color matrix is used. // Clamp the output. color.rgb = min(color.rgb, color.a); return color; diff --git a/internal/graphicsdriver/metal/graphics_darwin.go b/internal/graphicsdriver/metal/graphics_darwin.go index 351b638d1..f128a4529 100644 --- a/internal/graphicsdriver/metal/graphics_darwin.go +++ b/internal/graphicsdriver/metal/graphics_darwin.go @@ -197,7 +197,6 @@ struct FragmentShaderImpl { c.rgb /= c.a + (1.0 - sign(c.a)); c = (color_matrix_body * c) + color_matrix_translation; c.rgb *= c.a; - c *= v.color; c.rgb = min(c.rgb, c.a); } else { c *= v.color; diff --git a/internal/graphicsdriver/opengl/defaultshader.go b/internal/graphicsdriver/opengl/defaultshader.go index 148f9b1e0..60bce1935 100644 --- a/internal/graphicsdriver/opengl/defaultshader.go +++ b/internal/graphicsdriver/opengl/defaultshader.go @@ -237,14 +237,12 @@ void main(void) { color = (color_matrix_body * color) + color_matrix_translation; // Premultiply alpha color.rgb *= color.a; - // Apply color scale. - color *= varying_color_scale; + // Do not apply the color scale as the scale should always be (1, 1, 1, 1) when a color matrix is used. // Clamp the output. color.rgb = min(color.rgb, color.a); # else - // Apply color scale. + // Apply the color scale. color *= varying_color_scale; - // No clamping needed as the color matrix shader is used then. # endif // defined(USE_COLOR_MATRIX) gl_FragColor = color;