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

Commit

Permalink
Workaround for AO flickering with recent Nvidia drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
Chman committed Aug 7, 2017
1 parent df8259f commit f27e035
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PostProcessing/Resources/Shaders/AmbientOcclusion.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f27e035

Please sign in to comment.