Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit f27e035

Browse files
committed
Workaround for AO flickering with recent Nvidia drivers
1 parent df8259f commit f27e035

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

PostProcessing/Resources/Shaders/AmbientOcclusion.cginc

+4-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ float3 PickSamplePoint(float2 uv, float index)
209209
// Uniformaly distributed points on a unit sphere http://goo.gl/X2F1Ho
210210
#if defined(FIX_SAMPLING_PATTERN)
211211
float gn = GradientNoise(uv * _Downsample);
212-
float u = frac(UVRandom(0.0, index) + gn) * 2.0 - 1.0;
213-
float theta = (UVRandom(1.0, index) + gn) * UNITY_PI_2;
212+
// FIXME: This was added to avoid a NVIDIA driver issue.
213+
// vvvvvvvvvvvv
214+
float u = frac(UVRandom(0.0, index + uv.x * 1e-10) + gn) * 2.0 - 1.0;
215+
float theta = (UVRandom(1.0, index + uv.x * 1e-10) + gn) * UNITY_PI_2;
214216
#else
215217
float u = UVRandom(uv.x + _Time.x, uv.y + index) * 2.0 - 1.0;
216218
float theta = UVRandom(-uv.x - _Time.x, uv.y + index) * UNITY_PI_2;

0 commit comments

Comments
 (0)