From d75566167f29add824912c20e0128987c8dd49d2 Mon Sep 17 00:00:00 2001 From: ChibiDenDen Date: Wed, 23 Aug 2023 19:20:14 +0300 Subject: [PATCH] fix clear color on mobile renderer (cherry picked from commit df25e878425fc39465dfe105c56400c8c1733241) --- .../renderer_rd/forward_mobile/render_forward_mobile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index fe9659b5ab7..16f265ae6e2 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -776,7 +776,8 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color bool draw_sky = false; bool draw_sky_fog_only = false; // We invert luminance_multiplier for sky so that we can combine it with exposure value. - float sky_energy_multiplier = 1.0 / _render_buffers_get_luminance_multiplier(); + float inverse_luminance_multiplier = 1.0 / _render_buffers_get_luminance_multiplier(); + float sky_energy_multiplier = inverse_luminance_multiplier; Color clear_color = p_default_bg_color; bool keep_color = false; @@ -922,14 +923,14 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color // regular forward for now Vector c; { - Color cc = clear_color.srgb_to_linear(); + Color cc = clear_color.srgb_to_linear() * inverse_luminance_multiplier; if (rb_data.is_valid()) { cc.a = 0; // For transparent viewport backgrounds. } c.push_back(cc); // Our render buffer. if (rb_data.is_valid()) { if (p_render_data->render_buffers->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) { - c.push_back(clear_color.srgb_to_linear()); // Our resolve buffer. + c.push_back(clear_color.srgb_to_linear() * inverse_luminance_multiplier); // Our resolve buffer. } if (using_subpass_post_process) { c.push_back(Color()); // Our 2D buffer we're copying into.