From bf799cb12c6991ef8fcbfcd0bc0777e62e08ad9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Mon, 8 Mar 2021 17:21:17 +0100 Subject: Fix T81741 EEVEE: Ambient Occlusion does not converge properly This was due to the AO random sampling using the same "seed" as the AA jitter. Decorelating the noise fixes the issue. --- .../blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl index 689f99edad9..a0bfd440dd9 100644 --- a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl @@ -60,7 +60,11 @@ vec2 get_ao_area(float view_depth, float radius) vec2 get_ao_noise(void) { - return texelfetch_noise_tex(gl_FragCoord.xy).xy; + vec2 noise = texelfetch_noise_tex(gl_FragCoord.xy).xy; + /* Decorrelate noise from AA. */ + /* TODO(fclem) we should use a more general approach for more random number dimentions. */ + noise = fract(noise * 6.1803402007); + return noise; } vec2 get_ao_dir(float jitter) -- cgit v1.2.3