diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-07-20 23:43:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-07-20 23:43:30 +0300 |
commit | a1689fb091a9e57336d2ac9a013a44d804cd29ea (patch) | |
tree | 8e26c24c3c80e3594abc89c94e7b881db453872a /source/blender/draw/engines/eevee | |
parent | 3005c2e2be3d0711649e4dd10697fc43ca88f50f (diff) |
Eevee: Fix wrong SSR reprojection when switching orthographic view
We just reset the temporal sampling and avoid using the previous frame
for SSR at all.
Diffstat (limited to 'source/blender/draw/engines/eevee')
3 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 6ef24d03df8..5aa331a9b99 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -515,6 +515,7 @@ typedef struct EEVEE_EffectsInfo { int volume_current_sample; /* SSR */ bool reflection_trace_full; + bool ssr_was_persp; int ssr_neighbor_ofs; int ssr_halfres_ofs[2]; struct GPUTexture *ssr_normal_input; /* Textures from pool */ @@ -908,6 +909,7 @@ void EEVEE_mist_output_accumulate(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat void EEVEE_mist_free(void); /* eevee_temporal_sampling.c */ +void EEVEE_temporal_sampling_reset(EEVEE_Data *vedata); int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_temporal_sampling_matrices_calc( EEVEE_EffectsInfo *effects, float viewmat[4][4], float persmat[4][4], const double ht_point[2]); diff --git a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c index 204b730f8da..b882db174b0 100644 --- a/source/blender/draw/engines/eevee/eevee_screen_raytrace.c +++ b/source/blender/draw/engines/eevee/eevee_screen_raytrace.c @@ -132,6 +132,14 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) }); } + const bool is_persp = DRW_viewport_is_persp_get(); + if (effects->ssr_was_persp != is_persp) { + effects->ssr_was_persp = is_persp; + DRW_viewport_request_redraw(); + EEVEE_temporal_sampling_reset(vedata); + stl->g_data->valid_double_buffer = false; + } + effects->reflection_trace_full = (scene_eval->eevee.flag & SCE_EEVEE_SSR_HALF_RESOLUTION) == 0; common_data->ssr_thickness = scene_eval->eevee.ssr_thickness; common_data->ssr_border_fac = scene_eval->eevee.ssr_border_fade; diff --git a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c index 7cd76669fe4..76e11e02d26 100644 --- a/source/blender/draw/engines/eevee/eevee_temporal_sampling.c +++ b/source/blender/draw/engines/eevee/eevee_temporal_sampling.c @@ -174,6 +174,11 @@ void EEVEE_temporal_sampling_matrices_calc( invert_m4_m4(effects->overide_wininv, effects->overide_winmat); } +void EEVEE_temporal_sampling_reset(EEVEE_Data *vedata) +{ + vedata->stl->effects->taa_render_sample = 1; +} + int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata) { EEVEE_StorageList *stl = vedata->stl; |