1
\$\begingroup\$

One of my favourite games recently implemented ambient occlusion as a graphics feature, which appears to perform very well in most circumstances - except during sunrise and sunset. As someone who is getting into shader programming, I'm intrigued by this.

My understanding of AO is that you precompute the diffuse shading for a range of incident vectors, then use that information to produce a correct shadowing scale for real-time use by enumerating over all the lights and computing how their position in relation to the object compares to each of the incident vectors, essentially interpolating across the closest values. Since the occlusion is pre-computed against a model, taking complex shapes and self-occlusion into account, you don't need to raytrace and the performance is much better.

So here's where I get lost - since the diffuse map is precomputed, and you're just comparing light positions to those maps for all objects within the screen space, why would performance suffer for cases where the ambient light (the sun) is close to the horizon? It seems like this shouldn't matter - surely the performance of such a shader scales against vertices, not the angle of the light?

The game uses the latest version of Unity (they just bumped up a minor release) but I don't know if they use the built-in Unity SSAO shader. Performance hit is major - 28fps at 1440p during "day" hours, dropping to 12-14fps during sunrise/set. This only occurs when AO is enabled.

I'm not interested in finding a solution - I'm sure they'll fix it sooner or later - I'd just like to get a better idea of how AO performance scales, what its pain-points are, and why this kind of behaviour might appear.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.