diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-06-05 15:23:10 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-06-05 15:24:58 +0300 |
commit | 957c8f1305149ce85472a4082405217475af4b62 (patch) | |
tree | 924aac9126c5a9b38d27e6a60387c76f1362df5a | |
parent | bbaa1bffe9dbc35d2791b83d0014ccb4ffb6087a (diff) |
Workbench: World Space Cavity
When using the world space cavity shader together with viewport or image
rendering only a single pattern was used. This was that the iteration of
the cavity shader was updated when the cache is initialized.
Now the cavity iteration is updated together when the TAA samples are
updated.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D5021
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_effect_taa.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_effect_taa.c b/source/blender/draw/engines/workbench/workbench_effect_taa.c index 7fd68babc13..88f1f30941a 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_taa.c +++ b/source/blender/draw/engines/workbench/workbench_effect_taa.c @@ -170,12 +170,6 @@ DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_bu WORKBENCH_TextureList *txl = vedata->txl; WORKBENCH_EffectInfo *effect_info = stl->effects; WORKBENCH_FramebufferList *fbl = vedata->fbl; - WORKBENCH_PrivateData *wpd = stl->g_data; - /* - * jitter_index is not updated yet. This will be done in during draw phase. - * so for now it is inversed. - */ - int previous_jitter_index = effect_info->jitter_index; { const eGPUTextureFormat hist_buffer_format = DRW_state_is_image_render() ? GPU_RGBA16F : @@ -203,12 +197,6 @@ DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_bu DRW_shgroup_uniform_float(grp, "mixFactor", &effect_info->taa_mix_factor, 1); DRW_shgroup_call(grp, DRW_cache_fullscreen_quad_get(), NULL); - /* - * Set the offset for the cavity shader so every iteration different - * samples will be selected - */ - wpd->ssao_params[3] = previous_jitter_index; - return pass; } @@ -216,6 +204,8 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata) { WORKBENCH_StorageList *stl = vedata->stl; WORKBENCH_EffectInfo *effect_info = stl->effects; + WORKBENCH_PrivateData *wpd = stl->g_data; + const float *viewport_size = DRW_viewport_size_get(); const DRWView *default_view = DRW_view_default_get(); int num_samples = 8; @@ -245,6 +235,8 @@ void workbench_taa_draw_scene_start(WORKBENCH_Data *vedata) const float *transform_offset = samples[jitter_index]; effect_info->taa_mix_factor = 1.0f / (jitter_index + 1); effect_info->jitter_index = (jitter_index + 1) % num_samples; + /* Copy jitter index to Cavity iteration */ + wpd->ssao_params[3] = effect_info->jitter_index; /* construct new matrices from transform delta */ float winmat[4][4], viewmat[4][4], persmat[4][4]; |