diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-05 15:23:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-05 15:45:39 +0300 |
commit | c944dca127073db103cab380018dfc01b2cbb681 (patch) | |
tree | 9aceefe9648670e7c604adee4763f263d3bb1a81 /source/blender/draw/engines/eevee_next | |
parent | 2a4cc0c81c1748d2a18c49ce2f13e49428a55d62 (diff) |
EEVEE-Next: Depth Of Field: Fix black tiles when max blur radius is low
There was a missing clamp in `dof_slight_focus_coc_tile_get()`
and a couple of wrongly handled corner cases.
Diffstat (limited to 'source/blender/draw/engines/eevee_next')
-rw-r--r-- | source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_resolve_comp.glsl | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc index ffef9da5e29..4b136e183bc 100644 --- a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc +++ b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc @@ -142,7 +142,7 @@ void DepthOfField::sync() } /* Disable post fx if result wouldn't be noticeable. */ - if (fx_max_coc_ < 0.5f) { + if (fx_max_coc_ <= 0.5f) { fx_radius = 0.0f; } diff --git a/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_resolve_comp.glsl b/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_resolve_comp.glsl index a4b58f950a0..d21f6d69541 100644 --- a/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_resolve_comp.glsl +++ b/source/blender/draw/engines/eevee_next/shaders/eevee_depth_of_field_resolve_comp.glsl @@ -29,6 +29,7 @@ float dof_slight_focus_coc_tile_get(vec2 frag_coord) vec2 sample_uv = (frag_coord + quad_offsets[i] * 2.0 * dof_max_slight_focus_radius) / vec2(textureSize(color_tx, 0)); float coc = dof_coc_from_depth(dof_buf, sample_uv, textureLod(depth_tx, sample_uv, 0.0).r); + coc = clamp(coc, -dof_buf.coc_abs_max, dof_buf.coc_abs_max); if (abs(coc) < dof_max_slight_focus_radius) { local_abs_max = max(local_abs_max, abs(coc)); } @@ -94,7 +95,7 @@ void main() float slight_focus_max_coc = 0.0; if (prediction.do_slight_focus) { slight_focus_max_coc = dof_slight_focus_coc_tile_get(frag_coord); - prediction.do_slight_focus = slight_focus_max_coc > 0.5; + prediction.do_slight_focus = slight_focus_max_coc >= 0.5; if (prediction.do_slight_focus) { prediction.do_focus = false; } |