# What is ambient occlusion?

I've heard about ambient occlusion and it looks nice, but what exactly is it?

-
I suggested opening a Stack Exchange site dedicated to Computer Graphics, and selected this question as an example question. Follow computergraphics.stackexchange.com if you're interested in seeing the site being launched! –  wil Dec 10 '13 at 4:53

Ambient occlusion is a method to approximate how bright light should be shining on any specific part of a surface, based on the light and it's environment. This is used to add realism.

Wikipedia has a nice paragraph that explains what is done.

Ambient occlusion is most often calculated by casting rays in every direction from the surface. Rays which reach the background or “sky” increase the brightness of the surface, whereas a ray which hits any other object contributes no illumination. As a result, points surrounded by a large amount of geometry are rendered dark, whereas points with little geometry on the visible hemisphere appear light.

Here is a highly technical article about it.

-
While I realize you are quoting something, it describes ambient illumination, not ambient occlusion. While extremely similar, the logic is inverted (you remove light when rays hit nearby objects to achieve ambient occlusion) –  MickLH Feb 21 '14 at 18:49

Ambient light is a light type in computer graphics that is used to simulate global illumination. Ambient occlusion is simply a simulation of the shadowing caused by objects blocking the ambient light, because ambient light is environmental, unlike other types of shadowing, ambient occlusion does not depend on light direction, so it can be pre-computed for static objects.

Without AO (left) Note that the shadow in the left image is caused by directional light , with AO (right).

In traditional Ray Tracing ambient occlusion is simulated by sampling rays from a certain point, which takes a shape of a hemisphere, and then is checked for intersection with the scene (also called object space AO).

Notice how ray samples are used to simulate AO integration.

Notice the aliasing (dots) caused by ambient occlusion under-sampling.

Because the ray tracing sampling technique is too slow to be used in real time computer graphics. Other methods emerged that simulates this behavior, one notable approach is called Screen Space Ambient Occlusion (SSAO).

SSAO, is a screen space technique, developed by Crytek. The ambient occlusion is computed in a full-screen pass, using the Z-buffer as the only input.

The ambient occlusion factor kA of each pixel is estimated by testing a set of points distributed in a hemi-sphere around the pixel's location this effectively simulates the traditional ray tracing approach in screen space.

The value of kA depends on the samples that are in front of the value in the Z-buffer. If half or more of the samples pass, then kA receives a value of l. A smaller number of samples result kA less than 1.

SSAO component of a typical game scene

-

Ambient Occlusion.. for those who are not really familiar with gaming graphics technology, ambient occlusion adds specific amount of light in every object in the scene. every polygons are rendered in different angle, in that case the amount of light is uneven that makes the game more realistic and appealing to eye

-
I don't think you are contributing anything new worth mentioning. –  Lasse Dec 1 '13 at 14:03

http://en.wikipedia.org/wiki/Ambient_occlusion

Ambient occlusion usually means applying data that represents how much ambient light hits a surface. That data is usually a gray scale texture or vertex colors depending on the implementation.

To compute the data the most common way is the render the scene with with a solid white texture and 1 point light multiple times, moving the point light each time to a different location on a sphere or hemisphere. The results of all the renders are averaged and that gives you the data about each particular location in the scene and how much light hits that location.

For example a place in the scene that in always bright no matter where you put the light will be bright where as a place that is dark no matter where you put the light will be dark. The result is that you get something that will put dark shadows in crevices and cracks and soft lighting where objects would generally cast a shadow.

-

Ambient occlusion is a method to compute lighting on a surface of an object that takes into account light brightness due to occlusion of the surface in relation to light source.

That is, ambient occlusion is a shading method that is global in nature which means light/illumination from each point in a scene can influence other points in a scene. In contrast with local shading methods like Phong/Blinn, this means shading with ambient occlusion adds more realism.

Here is a bit of a simplified explanation. Ambient occlusion is a neat trick way of simulating global lighting which is faster than other methods we have so far. Rays are cast from every direction from a surface point 'up' in relation to the surface. Rays that do not reach any object in its path, that is they reach the background void threshold (the 'sky'), increase the brightness of the surface. Rays which, on the other hand, hit geometry when cast from surface, add no brightness to surface. So surface points which are surrounded by lots of other geometry are kind of in a shade.

SSAO is just one way of doing ambient occlusion.

-
"...in relation to light source" When you mention light sources it suggests direct illumination. Although ambient light comes from a source, like any other light, it is considered to be coming from all directions. –  muhuk Dec 2 '13 at 7:02