diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-05-05 17:10:43 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-05-05 19:40:20 +0300 |
commit | a7b7f67fc4ad0a5bf4ffc2a64467b55479f4fd95 (patch) | |
tree | 8a6688de295375a4e1b909f6230027052ed77ff5 /source/blender/draw/engines/eevee/eevee_volumes.c | |
parent | 0e5f58b68eb027152dd3038854d6589f04162c3b (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.
Reviewed by: jbakker
Differential Revision: https://developer.blender.org/D11033
Diffstat (limited to 'source/blender/draw/engines/eevee/eevee_volumes.c')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_volumes.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index d228d26cd52..3d24cd6fab5 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -394,10 +394,9 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS * - Grid exists and texture was loaded -> use texture. * - Grid exists but has zero size or failed to load -> use zero. * - Grid does not exist -> use default value. */ - GPUTexture *grid_tex = (drw_grid) ? drw_grid->texture : - (volume_grid) ? - e_data.dummy_zero : - eevee_volume_default_texture(gpu_grid->default_value); + GPUTexture *grid_tex = (drw_grid) ? drw_grid->texture : + (volume_grid) ? e_data.dummy_zero : + eevee_volume_default_texture(gpu_grid->default_value); DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, grid_tex); @@ -800,8 +799,6 @@ void EEVEE_volumes_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, EEVEE_PassList *psl = vedata->psl; EEVEE_EffectsInfo *effects = stl->effects; - const float clear[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - /* Create FrameBuffer. */ /* Should be enough precision for many samples. */ @@ -814,12 +811,6 @@ void EEVEE_volumes_output_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, GPU_ATTACHMENT_TEXTURE(txl->volume_scatter_accum), GPU_ATTACHMENT_TEXTURE(txl->volume_transmittance_accum)}); - /* Clear texture. */ - if (effects->taa_current_sample == 1) { - GPU_framebuffer_bind(fbl->volumetric_accum_fb); - GPU_framebuffer_clear_color(fbl->volumetric_accum_fb, clear); - } - /* Create Pass and shgroup. */ DRW_PASS_CREATE(psl->volumetric_accum_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL); DRWShadingGroup *grp = NULL; @@ -843,10 +834,18 @@ void EEVEE_volumes_output_accumulate(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_ { EEVEE_FramebufferList *fbl = vedata->fbl; EEVEE_PassList *psl = vedata->psl; + EEVEE_EffectsInfo *effects = vedata->stl->effects; if (fbl->volumetric_accum_fb != NULL) { /* Accum pass */ GPU_framebuffer_bind(fbl->volumetric_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->volumetric_accum_fb, clear); + } + DRW_draw_pass(psl->volumetric_accum_ps); /* Restore */ |