diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-04 23:30:09 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-05 15:45:09 +0300 |
commit | 72cdb0ed2d2cc4eebe9c756d2a87e2513b6bf1db (patch) | |
tree | af86ee2596082365bd048ec86f041307b8b59799 /source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl | |
parent | 897aa777c53439d67401b4ae3d567394a80f8be7 (diff) |
EEVEE-Next: Depth Of Field: Improve image stability
This adds anti-flicker pass to the slight focus region by using the
temporaly stable output from stabilize pass.
This also fixes the bilateral weight factor which was reversed.
Diffstat (limited to 'source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl index 15c1073309a..97c53ce3692 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_accumulator_lib.glsl @@ -6,6 +6,7 @@ **/ #pragma BLENDER_REQUIRE(common_view_lib.glsl) +#pragma BLENDER_REQUIRE(eevee_colorspace_lib.glsl) #pragma BLENDER_REQUIRE(eevee_sampling_lib.glsl) #pragma BLENDER_REQUIRE(eevee_depth_of_field_lib.glsl) @@ -339,10 +340,10 @@ void dof_gather_accumulate_resolve(int total_sample_count, out_weight = 0.0; } /* Same thing for alpha channel. */ - if (out_col.a > 0.99) { + if (out_col.a > 0.993) { out_col.a = 1.0; } - else if (out_col.a < 0.01) { + else if (out_col.a < 0.003) { out_col.a = 0.0; } } @@ -573,7 +574,8 @@ void dof_slight_focus_gather(sampler2D depth_tx, sampler2D bkh_lut_tx, /* Renamed because of ugly macro job. */ float radius, out vec4 out_color, - out float out_weight) + out float out_weight, + out float out_center_coc) { vec2 frag_coord = vec2(gl_GlobalInvocationID.xy) + 0.5; float noise_offset = sampling_rng_1D_get(SAMPLING_LENS_U); @@ -650,6 +652,8 @@ void dof_slight_focus_gather(sampler2D depth_tx, center_data.coc = clamp(center_data.coc, -dof_buf.coc_abs_max, dof_buf.coc_abs_max); center_data.dist = 0.0; + out_center_coc = center_data.coc; + /* Slide 38. */ float bordering_radius = 0.5; @@ -666,7 +670,7 @@ void dof_slight_focus_gather(sampler2D depth_tx, dof_gather_accumulate_resolve(total_sample_count, bg_accum, bg_col, bg_weight, unused_occlusion); dof_gather_accumulate_resolve(total_sample_count, fg_accum, fg_col, fg_weight, unused_occlusion); - /* Fix weighting issues on perfectly focus > slight focus transitionning areas. */ + /* Fix weighting issues on perfectly focus to slight focus transitionning areas. */ if (abs(center_data.coc) < 0.5) { bg_col = center_data.color; bg_weight = 1.0; |