From 45d3303ae42e0b563bd164148efa516f93261ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Fri, 14 May 2021 16:18:12 +0200 Subject: Fix T85845 EEVEE: Depth Of Field: Artifacts with slight out of focus This was caused by the bokeh LUT being sampled outside the valid range. But `texelFetch` is only valid if the sample actually exists. This lead to undefined behavior. The fix is to increase `DOF_MAX_SLIGHT_FOCUS_RADIUS` (which just offsets the LUT along the X=Y axis) to avoid any sample outside the defined range. --- source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/draw/engines') diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl index faac216480b..dac53719149 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl @@ -136,7 +136,7 @@ const float layer_offset_fg = 0.5 + 1.0; /* Extra offset for convolution layers to avoid light leaking from background. */ const float layer_offset = 0.5 + 0.5; -#define DOF_MAX_SLIGHT_FOCUS_RADIUS 5 +#define DOF_MAX_SLIGHT_FOCUS_RADIUS 16 float dof_layer_weight(float coc, const bool is_foreground) { -- cgit v1.2.3 From 5d97e293c30b41bcd84a2d831ae35e67d8e54670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 15 May 2021 17:48:26 +0200 Subject: EEVEE: Depth of Field: Fix tile artifacts in mixed focus regions This was caused by the slight focus gather not being wide enough for small radii. Now the cast to int will properly round the radius to the nearest integer. This is related to T86244 Black Artefacts in EEVEE on Transparent BSDF --- source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/draw/engines') diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl index cd69a0e2ab1..32841b7749c 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl @@ -40,7 +40,7 @@ void dof_slight_focus_gather(float radius, out vec4 out_color, out float out_wei DofGatherData fg_accum = GATHER_DATA_INIT; DofGatherData bg_accum = GATHER_DATA_INIT; - int i_radius = clamp(int(radius), 0, int(layer_threshold)); + int i_radius = clamp(int(radius + 0.5), 0, int(layer_threshold)); const int resolve_ring_density = DOF_SLIGHT_FOCUS_DENSITY; ivec2 texel = ivec2(gl_FragCoord.xy); -- cgit v1.2.3