Ambient Occlusion flickering (PostProcessing stack)

I’m getting some strange flickering from the ambient occlusion effect in the PostProcessing stack.

(If the image doesn’t load, here is a link: https://giant.gfycat.com/CleverFelineHen.gif)

This is a new scene in a brand new project with very little modification to the default settings. Only the AO effect is enabled in the PostProcessing profile. I’ve tried every combination of settings and the flickering persists. Here is the strange thing, changing the Sample Count to any other setting will stop the flickering completely, but only for a matter of time. The next time I open the project I’ll get flickering. The flickering is there in builds as well, not just the editor.

Other things I’ve tried:
-Updating my drivers
-Different shaders/materials/models

System:
-Windows 10 v10.0.15063 Build 15063
-Unity 5.6.0f3
-Processor: Intel Core i3-2100 CPU
-GPU: nVidia GeForce 570 GTX

Not helping much sorry but, just so you know you are not alone:
We have the same problem, and it only happens on some machines. Our usual work machine are fine, it mostly happens on lower specs (470GTX for instance)

We are investigating solutions, I’ll make sure to post here if we find one : )

Temporary work around for us is to remove the variable settings from the profile and to hardcode it in the shader.

In AmbientOcclusion.cginc, line 56 just comment out the variable version and the #ifdef to only leave the static const version, and set it to whatever you’d like.

// Sample count
//#if !defined(SHADER_API_GLES)
//int _SampleCount;
//#else
// GLES2: In many cases, dynamic looping is not supported.
// - Hacky fix for a problem on low spec machines with flickery AO
static const int _SampleCount = 3;
//#endif
5 Likes

Thanks, that really help me.

Where is AmbientOcclusion.cginc ?

Funnily enough this is fixing flickering in 2020 for me as still using an AO based on one of those older ones.
Annoying bug!

2024 and it fixes for me. Thanks!