From 2047be4516890fe12dfc2d2f3fb40048fd1891dc Mon Sep 17 00:00:00 2001 From: Miguel Gonzalez Sanchez <822035+bitbrain@users.noreply.github.com> Date: Sat, 24 Sep 2022 20:13:12 +0100 Subject: [PATCH] fix broken 2D light blending, addresses #49922 --- servers/rendering/renderer_rd/shaders/canvas.glsl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl index 459d798a802b..1f33e84f961b 100644 --- a/servers/rendering/renderer_rd/shaders/canvas.glsl +++ b/servers/rendering/renderer_rd/shaders/canvas.glsl @@ -595,6 +595,8 @@ void main() { color = vec4(0.0); //invisible by default due to using light mask } + vec4 original_color = color; + #ifdef MODE_LIGHT_ONLY color = vec4(0.0); #else @@ -636,6 +638,8 @@ void main() { ); } + light_color.rgb *= original_color.rgb; + light_blend_compute(light_base, light_color, color.rgb); } @@ -732,6 +736,8 @@ void main() { ); } + light_color.rgb *= original_color.rgb; + light_blend_compute(light_base, light_color, color.rgb); } #endif