Download

Removing SSAO Temporal Dithering

TL;DR: I’m looking for a way to get a ~2ms SSAO pass on PS4 at 1080p that isn’t super dithered without TemporalAA.

I’m working on a project that relies heavily on SSAO for local shadows and I’ve run into a bit of a problem. We can only run a single pass of SSAO on our PS4 build for performance as well as FXAA rather than Temporal - a bad combination for the default settings of the SSAO shader. Here’s an example (I’ve blown up the image 2x):

88f72d2be556de4149a0f6e24f67ffce299d0323.jpeg

As you can see the 4x4 pattern used for temporal AA smoothing is very obvious here. I took the liberty of checking out PostProcessAmbientOcclusion.usf to see if there was anything I could mess with to change the bluring settings and I happened upon ths:


// AO_SAMPLE_QUALITY = 0 : no AO sampling, only upsampling
// AO_SAMPLE_QUALITY = 1 : no dither/per pixel randomization
// AO_SAMPLE_QUALITY = 2 : efficient high frequency 4x4 pattern without jitter for TemporalAA
// AO_SAMPLE_QUALITY = 3 : efficient high frequency 4x4 pattern with jitter for TemporalAA

I set the default to 1 and recompiled. I had a number of compile errors regarding a variable “bDebugLookups”. I wasn’t sure if that variable even existed anymore so I commented out everything the would have run if that was set to true and I was able to get the shader compiled, netting me this:

5609fa9fc8af499a79fc7f8c8cdadfd97b5a2079.jpeg

I haven’t checked the frame time difference yet, but it definitely removed the 4x4 pattern. However, I’m getting some seriously weird ghosting problems with AO now:

b36b596795b653f862c58fb51e84574f45c7a5ca.jpeg

Is there something obvious I missed here? Is there a better way to remove the dependency on TemporalAA from SSAO? I would gladly sacrifice detail or resolution over the dithered look. This is all on 4.12.3

I just checked - it looks the the ghosting effect in the third image is directly proportional with the AO radius set in the post process. I’ll look through the shader to see if I can find something.

Anyone else with this problem? I scoured through the temporal AA settings to see if there was a way I could run it just for SSAO like SSR does but I’m not sure if that would even work.