Corners Don't Look Like That: Regarding Screenspace Ambient Occlusion (2012)

4 years ago (nothings.org)

> Game developers are in love with screenspace ambient occlusion (SSAO).

I work in 3d and I think I can say with confidence that developers are not in love with SSAO. It's just that real ambient occlusion for moving models is both really hard to set up and would totally blow the performance budget for most games, while in most 3d engines you can add SSAO in couple of minutes and it costs ~1ms per frame.

That will hopefully change as graphics cards that support raytracing become more common. But in the meantime, we know SSAO is a hack. We know it doesn't look physically correct, we only use it because (if done well) it looks better than the alternative, which is no ambient occlusion, or ambient occlusion only on static models.

  • The article may have been about SSAO, but it applies equally well to "real ambient occlusion", because raytracing voxels assume that corners "absorb" light like a black hole.

    The photographs prove however, that corners in the real world do NOT absorb light, meaning that even "voxel ambient occlusion" and other "realer-models" are fake.

    • What people generally mean by Ray traced AO is just an approximation for path traced global illumination. It doesn't just work on the basis of corner=dark, and can be set up to be realistic.

      It doesn't really have much to do with voxels, either. RTAO operates directly on the scene geometry (through an acceleration structure), or an approximation of it.

      The true holy grail we are approaching and what game developers always wanted is ray traced global illumination, which is basically the perfect solution.

      2 replies →

  • I can confirm that when the article was written, bad SSAO was everywhere :-)

    • In games where I've worked as a graphics programmer we have mainly used SSAO solutions such as HBAO and GTAO.

      I wasn't really a fan of AO during the original craze but I really like these modern screen space versions.

      6 replies →

  • AO is only half of what's needed, you need full GI for realistic corners. One phenomenon that the article didn't point out, but you can simulate trivially easy in Blender, is that corners that are perfectly lit are actually lighter, due to more reflected light reaching them. To observe, just set two grey planes at 90 degrees to each other and add a point light at medium distance. Render with Cycles. Pay attention to corners in well lit places with plain smooth diffuse walls like conference rooms and you will be able to spot it in real life too!

    • You don't really need full GI. RTAO in Unity for example does take into account direct light and treats it differently to get the described effects, as well as some degree of indirect lighting so some corners do look comparatively brighter in some places.

  • At the time that the article was written, SSAO was usually way overdone in games. It's an effect used because it's cheap, okay, but then it should be toned down, not turned up to 11 and drawing attention. I do remember the ridiculous fuzzy black bars in corners.

    • Same as it ever was. Remember when lens flares were The Cool New Thing and ridiculously overblown in every game that came out? Or when it was reflections, or shadows, or bloom, or...

      3 replies →

For an article whose thesis is broadly ‘surfaces don’t darken much towards concave corners, so using SSAO is bad’, there sure are a lot of graphs on this page that show that surfaces definitely, empirically darken as they approach concave corners, in a way that looks rather like it could be quite cheaply simulated using SSAO…

Very thorough break down of how lighting in corners actually happens in reality, and the general misunderstanding of it in people implementing SSAO.

Honestly SSAO is just a performance hack.

But that's ok! Game engines and the like are filled with performance hacks where things can be "wrong" but sufficiently close to what's expected that we don't (generally) notice it. Sometimes it's approximations (fast inverse sqrt for example), movement (strafe + forward having faster movement), or lighting (artificial glow, halos, SSAO, etc).

That said it wouldn't hurt for shader writers to read something like this, because maybe these issues can be handled better even though the AO is still just being approximated.

  • I'm a gamer and a programmer, not a physicist. I would never have noticed that light doesn't work like SSAO.

    • People don’t need to understand, or even see the difference, they will still feel something is off in a 3D scene at a subconscious level.

Games aren’t made to look physically realistic at all costs; it’s an artistic effort to try to make games look visually good, communicate with players clearly, and balance performance.

SSAO is subjective if it looks good, but it often does communicate corners and edges clearly which may be what they are going for.

  • Right. SSAO is a cheap way of emphasizing depth and edges. You might as well tell a line artist ‘you know, real objects don’t have black lines round the edge?’.

  • I don't think SSAO is really ever selected over more realistic methods for artistic preference. High budget animated films tend to go for ray traced methods even when they have a non-photorealistic style.

    SSAO is just cheap.

    • For what it's worth, the existing game console hardware at the time was the Xbox 360 and the PlayStation 3, so SSAO really would have been ROI back then.

    • 'just cheap' = 'actually viable at 30-60fps on mid-spec PC/console'

      If you have to real-time light everything, then there's not a lot of other viable options to make your scene look a bit more solid and objects look more grounded for the cost of just a couple of milliseconds of GPU time.

Screenspace anything feels like the natural progression after cubemaps. It's a cheap approximation, but it gets like 60% of the way there on hardware that exists today. The (long and slow) migration to realtime ray-tracing kinda blows out the need for future lighting tricks.

For the non-gamers, the Wikipedia link:

https://en.wikipedia.org/wiki/Screen_space_ambient_occlusion

This article does explain a part of why I find 3D games jarring and peculiar, though; I could never get past how odd corners in games can look (e.g. when they are right behind a lamp that somehow doesn't reach them).

Just didn't know this is what it was called.

Frankly I prefer the era where games didn't try to do this.

I think SSAO and hacks like these are why games can have very detailed, beautiful graphics aiming for maximum realism, and still look "like a game". Screenshots of modern games look photo-realistic in the thumbnail, but the illusion breaks as soon as you look at them in full resolution.

Vaguely related (in terms of reality doesn't work that way), but in film there's a tendency to show close-up leg movement wrong. Example: https://youtu.be/k3TYpGyH4JU?t=51

When a biped walks, there's a fast movement period as the leg swings forward, and then a slow period (from the camera POV) where the leg rocks slowly while the body swings around and the other leg to plant it, followed by a faster pickup to swing the leg again.

But in movies they always show the single leg complete its entire motion at a single (unrealistic) speed, usually with the leg just rocking along the ground like it was made of wood instead of actually planting the foot.

I'm not sure how accurate the data from the reference photos is as colored walls are often intentionally painted in such a way that the edges at the corners remain lighter or even white to create a "sharper" corner and avoid clashes between differently colored surfaces. Often this can also be an artefact of the gap left between two sheets of wallpaper touching at the corners.

SSAO is well known to be a quick and dirty approximation, not sure what the point of the article is.

It would have been much more interesting to see a comparison between the photos of the corners in his room and a ray-traced version of a 3D model of the room with full bidir metropolis and a long render time.

  • Most of the stuff that is well known to some group of people isn't well known to everybody, so maybe don't just be that dismissive? Also, the article is ~10 years old. I wouldn't be surprised if it actually contributed to how well known these facts are today.

I always disable SSAO in games, I've never really cared for the effect that much and it often seems to eat a lot of resources.

Anyone know of a book or guide to doing lovely lighting, digitally or real world.

Looking for a book of principals.

  • Nothing is going to beat a photography habit and trying to imitate your favorite photographs. I would also recommend shooting film but I understand why you wouldn’t wanna do that.

    The reality is there are no principals with lighting; only opportunities to get different results.

Ambient occlusion is a horrible hack from twenty years ago. You don’t need to measure pixel values from photographs to know that it bears no relation to how light works in the real world. Just don’t use it.