From 1540f1df076ccd4fda224b7f56aa6ca0d2a9b1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 8 Mar 2021 17:16:46 +0100 Subject: EEVEE: RenderPass: Improve AO pass if screen space radius is small This just bypass the occlusion computation if there is no occlusion data. This avoids weird looking occlusion due to the screen space geometric normal reconstruction. --- source/blender/draw/engines/eevee/shaders/effect_gtao_frag.glsl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/blender') diff --git a/source/blender/draw/engines/eevee/shaders/effect_gtao_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_gtao_frag.glsl index 19ae0acc443..16b1a7ffeaa 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_gtao_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_gtao_frag.glsl @@ -99,9 +99,12 @@ void main() OcclusionData data = occlusion_load(vP, 1.0); - float visibility = diffuse_occlusion(data, V, N, Ng); - - FragColor = vec4(visibility); + if (min_v4(abs(data.horizons)) != M_PI) { + FragColor = vec4(diffuse_occlusion(data, V, N, Ng)); + } + else { + FragColor = vec4(1.0); + } } } -- cgit v1.2.3