Hacker News new | past | comments | ask | show | jobs | submit login
Corners Don't Look Like That: Regarding Screenspace Ambient Occlusion (2012) (nothings.org)
117 points by graderjs on March 8, 2022 | hide | past | favorite | 43 comments



> 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.


https://i.natgeofe.com/n/874df281-d3e0-489a-98c0-6b840023b82...

Here is a photograph of New York City.

Here is a CGI of a bunch of boxes with "Ambient Occlusion": https://upload.wikimedia.org/wikipedia/commons/9/91/AmbientO...

You can see that "Ambient Occlusion" ultimately comes down to "corners are darker" heuristic. It doesn't matter if you're doing "Ray Tracing based Ambient Occlusion" (see https://docs.unity3d.com/Packages/com.unity.render-pipelines...), or "Screenspace", or whatever. The heuristic is: "corners probably have less light", and the design of the algorithm works backwards from that.

-------

Now look at New York city again: a collection of boxes in the realistic sun. Carefully look at the corners.

Its actually kind of rare for corners to be darker in the real world. Every shadow must be calculated. Some corners are darker, while others are touched directly by the sun and have no darkening effect at all.

IMO, Ambient Occlusion "looks good" for the same reason that cartoons / anime "looks good", it instantly provides contrast in a slightly unrealistic fashion, which is more important for high-speed video games. The human eye can see the contrasts and better understand geometry with the "fake shadows" helping out.


The idea is, if the light is indirect or ambient, ambient occlusion will reduce indirect light. If the light is direct, then ambient occlusion will have no effect.

Which is exactly what you see in your picture of New York. If the corner is in direct light, then there is no difference from any other surface - or it is even more illuminated from radiance. If the corner is in indirect light, then yes, corners are less luminous.

It's not rare at all for corners to be darker in the real world. Compare a wide open, but shaded street, to a narrow alley. The alley will be much darker.

This is exactly the idea of modern AO with ray tracing. By raytracing AO, you can actually see how "open" each pixel is to the indirect light source. If the pixel is under direct light from some source, do not affect this component of illumination. If it is under indirect light from another source, be it the sky, or the walls, or some very large area light, reduce this indirect illumination.

So if the corner is directly lit by the sun, there is no darkening at all using RTAO and a PBR renderer.

It is indeed in the name. Occlude the ambient light component.

It's not a questions of "every shadow must be calculated". It's a question of approximating global illumination, or radiosity.


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.


For anyone else who was not born with the ability to instantly know what an acronym stands for, it appears that HBAO is horizon-based ambient occlusion while GTAO is ground-truth ambient occlusion.


Yes, sorry, that is correct. I guess we all get blind to the jargon we use in our daily lives.

For anyone interested the original GTAO article[0] is very well written and gives a really good insight into how these techniques work

[0]: http://iryoku.com/downloads/Practical-Realtime-Strategies-fo...


Is this the Quantum Foam wallpaper you were talking about awhile ago?

https://512pixels.net/downloads/os9-5k/Quantum-Foam.jpg


Hm, yes, about two years ago I believe. May I ask how you ended up following up on this now?


I googled something and found that old thread, but there was no other way to message you (that I know of).


Ok cool! Thanks for the tip.


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...


Lens flares in games were always stupid, because they imply that you're looking at the scene through a camera, which breaks the immersion. I mean, they might as well also have a boom mike occasionally pop in from the top of the screen while they're at it.


I absolutely agree with you—but I think the same about lens flares in cinema, and given how entrenched they are in that realm, I'd say the rest of the world disagrees.

Now, yes, unlike video games, movies are in fact (usually) filmed with cameras. However, lens flares are still an artifact—they don't exist in human vision, and we know how to get rid of them. We just choose not to.


Don't give them any ideas! Actually I can see that being funny as an easter egg in CS or something.

Also, speaking as someone who wears glasses and has a bit of astigmatism, flares/haloes around lights aren't necessarily stupid or unrealistic (although the classic TV camera lens flare, admittedly not so defensible).


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.


(2012)


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.


Not sure what exactly you have in mind, but maybe you'll find PBR relevant? http://www.pbr-book.org


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: