From f27e035990bdcc612289e30aba4e24dedc98e273 Mon Sep 17 00:00:00 2001 From: Thomas Hourdel Date: Mon, 7 Aug 2017 13:10:02 +0200 Subject: [PATCH] Workaround for AO flickering with recent Nvidia drivers --- PostProcessing/Resources/Shaders/AmbientOcclusion.cginc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc b/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc index 0fd0ff6c..5a66bc1f 100644 --- a/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc +++ b/PostProcessing/Resources/Shaders/AmbientOcclusion.cginc @@ -209,8 +209,10 @@ float3 PickSamplePoint(float2 uv, float index) // Uniformaly distributed points on a unit sphere http://goo.gl/X2F1Ho #if defined(FIX_SAMPLING_PATTERN) float gn = GradientNoise(uv * _Downsample); - float u = frac(UVRandom(0.0, index) + gn) * 2.0 - 1.0; - float theta = (UVRandom(1.0, index) + gn) * UNITY_PI_2; + // FIXME: This was added to avoid a NVIDIA driver issue. + // vvvvvvvvvvvv + float u = frac(UVRandom(0.0, index + uv.x * 1e-10) + gn) * 2.0 - 1.0; + float theta = (UVRandom(1.0, index + uv.x * 1e-10) + gn) * UNITY_PI_2; #else float u = UVRandom(uv.x + _Time.x, uv.y + index) * 2.0 - 1.0; float theta = UVRandom(-uv.x - _Time.x, uv.y + index) * UNITY_PI_2;