Clear specular buffer if bg mode is canvas and ss effects are used
Explicitly clear the separate specular buffer when the background mode is canvas and screen space effects (and thus a separate specular buffer) are used.
(cherry picked from commit af9d1743f3
)
This commit is contained in:
parent
c8b50871fe
commit
361c0d53f3
|
@ -2028,6 +2028,16 @@ void RenderForwardClustered::_render_scene(RenderDataRD *p_render_data, const Co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (using_separate_specular && is_environment(p_render_data->environment) && (environment_get_background(p_render_data->environment) == RS::ENV_BG_CANVAS)) {
|
||||||
|
// Canvas background mode does not clear the color buffer, but copies over it. If screen-space specular effects are enabled and the background is blank,
|
||||||
|
// this results in ghosting due to the separate specular buffer copy. Need to explicitly clear the specular buffer once we're done with it to fix it.
|
||||||
|
RENDER_TIMESTAMP("Clear Separate Specular (Canvas Background Mode)");
|
||||||
|
Vector<Color> blank_clear_color;
|
||||||
|
blank_clear_color.push_back(Color(0.0, 0.0, 0.0));
|
||||||
|
RD::get_singleton()->draw_list_begin(rb_data->get_specular_only_fb(), RD::INITIAL_ACTION_CLEAR, RD::FINAL_ACTION_READ, RD::INITIAL_ACTION_DROP, RD::FINAL_ACTION_DISCARD, blank_clear_color);
|
||||||
|
RD::get_singleton()->draw_list_end();
|
||||||
|
}
|
||||||
|
|
||||||
if (scene_state.used_screen_texture) {
|
if (scene_state.used_screen_texture) {
|
||||||
RENDER_TIMESTAMP("Copy Screen Texture");
|
RENDER_TIMESTAMP("Copy Screen Texture");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue