How did I invent the SSAO effect?

How did I invent the SSAO effect?


I originally wanted to write this in the spirit of “no, I don’t want to criticise anyone with it”. But then I realised that I’d rather write it in the spirit of “but, I do want to criticise some people”.) :P
This writing is for graphic designers and game developers.

So… I work as a graphic designer in game development. One of the things about game development is that you have to make “realtime” graphics, that is, graphics that are rendered in “real time” on the hardware you have. The essence of such graphics is that you have to use all kinds of tricks to get the right look and speed (frame rate). And the tricks are not perfect, but they are fast, i.e. they can be used in real-time rendering.

The SSAO (Screen Space Ambient Occlusion) effect is all about getting less light into the “corners” (ambient occlusion). Simulating light is one of the most difficult tasks in 3d graphics, especially for scattered light. In realtime graphics, it is still not very possible to use scattered light based on “real” calculations, i.e. raytracing (unless we are talking about baked lights, which are fortunately becoming more and more extinct in the industry.)

About 15 years ago we were working on a AAA game engine, I was working as a “technical artist” with the programmers. I really missed this particular “ambient occlusion” lighting effect, but unfortunately it was not possible to do in real time. So I started thinking about how to trick it… Everyone in the industry knows about a thing called zbuffer. The idea is to store a distance value for each pixel of the image, which can then be used for all sorts of purposes. It’s a bit like a fog, and the further away something is, the more foggy it is. (Side note, hang on: zbuffer was first mentioned in an 1884 science fiction novel. To help you out, the author was a mathematician. He essentially invented the zbuffer! Yes, in 1884!!!)

This is a zbuffer:

So, given the zbuffer, which gives us the solution: it can be used to calculate where the “concave” parts are in the picture! So if you darken the image a bit there, you get an effect similar to ambient occlusion! The question was whether this trick could be displayed in real time. Well, as it turned out, even though video cards weren’t usually powerful enough to do this trick back then, it could work on more powerful machines!

Well, inspired by this discovery, I told my idea to the programmers (who liked me and I had a good relationship with them. :)) Well, their attitude was quite depressing. Some of them didn’t really want to understand, not because they were stupid, but because they probably didn’t care. Another part of them understood, but said “ah, that’s no good because it doesn’t give the perfect result”. There was only one coder who understood and said it could be done, although he was working on something else, so he didn’t bother.

This is an SSAO:

After that, a few months later, the famous game Crysis came out, in which they used the SSAO effect for the first time (if I remember correctly, it was invented by one of their russian coder). Needless to say, it took a few weeks for our engine to get SSAO hahaha… Well, no one can be a prophet in his own country… :) (Interesting fact: the programmer I mentioned, who understood what I told him, was already working at Crytek a few months later…).

The lesson: one of the biggest diseases of Hungarian game developers is the quest for perfection… “I’d rather not do anything, it won’t be perfect anyway.” :(

Addendum: by the way, it’s not true that Crytek invented SSAO, for two reasons. On the one hand I invented it :), on the other hand when I was searching the web for something similar, I found a scientific visualization method where it was used to visualize molecules, true, it was not realtime, but it was actually SSAO, i.e. it worked on the basis of zbuffer.

Today, SSAO is in almost all games, about all the serious ones, and all the engines. Plus, there are now video cards so powerful that they can do it in such high quality. I really like that kind of trickery, by the way.
Well, that’s it. :)