diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2021-03-08 19:21:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2021-03-08 19:25:38 +0300 |
commit | bf799cb12c6991ef8fcbfcd0bc0777e62e08ad9b (patch) | |
tree | 0678b6fa9fd6c82d167c80faf9d8bb087bbba64b | |
parent | 30cb4326fe0f5f0a8dbcbb8f4b474226c833d793 (diff) |
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.
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl | 6 |
1 files changed, 5 insertions, 1 deletions
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) |