fix clear color on mobile renderer

This commit is contained in:
ChibiDenDen 2023-08-23 19:20:14 +03:00
parent 6758a7f8c0
commit df25e87842
1 changed files with 4 additions and 3 deletions

View File

@ -752,7 +752,8 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
bool draw_sky = false; bool draw_sky = false;
bool draw_sky_fog_only = false; bool draw_sky_fog_only = false;
// We invert luminance_multiplier for sky so that we can combine it with exposure value. // 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; Color clear_color = p_default_bg_color;
bool keep_color = false; bool keep_color = false;
@ -899,14 +900,14 @@ void RenderForwardMobile::_render_scene(RenderDataRD *p_render_data, const Color
// regular forward for now // regular forward for now
Vector<Color> c; Vector<Color> c;
{ {
Color cc = clear_color.srgb_to_linear(); Color cc = clear_color.srgb_to_linear() * inverse_luminance_multiplier;
if (rb_data.is_valid()) { if (rb_data.is_valid()) {
cc.a = 0; // For transparent viewport backgrounds. cc.a = 0; // For transparent viewport backgrounds.
} }
c.push_back(cc); // Our render buffer. c.push_back(cc); // Our render buffer.
if (rb_data.is_valid()) { if (rb_data.is_valid()) {
if (p_render_data->render_buffers->get_msaa_3d() != RS::VIEWPORT_MSAA_DISABLED) { 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) { if (using_subpass_post_process) {
c.push_back(Color()); // Our 2D buffer we're copying into. c.push_back(Color()); // Our 2D buffer we're copying into.