diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-04-21 01:43:35 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-05-05 19:40:50 +0300 |
commit | c8293d6258e2b74ca29356dd9deca59c127eed3c (patch) | |
tree | faba44cc3adb6c0f066c08c0a4e093687034048d /source/blender/draw/engines/eevee/eevee_mist.c | |
parent | 5f7f90d5a222023837efc1aab62bf2cffa997217 (diff) |
Fix T86037 EEVEE: SSR option changes render passes result
This was caused by the SSR option resetting the accumulation. But the
render passes were only cleared in the init phase. This means that
when SSR was resetting the `taa_render_sample` the actual renderpasses
would still contains 1 sample. This means the renderpasses were always
divided by the wrong number of samples.
The fix is to clear just before accumulation if the sample is 1.
The fact that it works for motion blur is kind of a blessing. This is because
we check `stl->effects->ssr_was_valid_double_buffer` before resetting the
sampling. So this only happens on the first motion step and does not affect
the rest of the rendering.
Differential Revision: https://developer.blender.org/D11033
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_mist.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_mist.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_mist.c b/source/blender/draw/engines/eevee/eevee_mist.c index 2b448695528..d4490d6fd4c 100644 --- a/source/blender/draw/engines/eevee/eevee_mist.c +++ b/source/blender/draw/engines/eevee/eevee_mist.c @@ -40,12 +40,9 @@ void EEVEE_mist_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) EEVEE_TextureList *txl = vedata->txl; EEVEE_StorageList *stl = vedata->stl; EEVEE_PassList *psl = vedata->psl; - EEVEE_EffectsInfo *effects = stl->effects; EEVEE_PrivateData *g_data = stl->g_data; Scene *scene = draw_ctx->scene; - const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - /* Create FrameBuffer. */ /* Should be enough precision for many samples. */ DRW_texture_ensure_fullscreen_2d(&txl->mist_accum, GPU_R32F, 0); @@ -53,12 +50,6 @@ void EEVEE_mist_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) GPU_framebuffer_ensure_config(&fbl->mist_accum_fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(txl->mist_accum)}); - /* Clear texture. */ - if (effects->taa_current_sample == 1) { - GPU_framebuffer_bind(fbl->mist_accum_fb); - GPU_framebuffer_clear_color(fbl->mist_accum_fb, clear); - } - /* Mist settings. */ if (scene && scene->world) { g_data->mist_start = scene->world->miststa; @@ -103,9 +94,17 @@ void EEVEE_mist_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat { EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_PassList *psl = vedata->psl; + EEVEE_EffectsInfo *effects = vedata->stl->effects; if (fbl->mist_accum_fb != NULL) { GPU_framebuffer_bind(fbl->mist_accum_fb); + + /* Clear texture. */ + if (effects->taa_current_sample == 1) { + const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + GPU_framebuffer_clear_color(fbl->mist_accum_fb, clear); + } + DRW_draw_pass(psl->mist_accum_ps); /* Restore */ |