I've heard about ambient occlusion and it looks nice, but what exactly is it?
6 Answers
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.
-
7\$\begingroup\$ 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) \$\endgroup\$– MickLHCommented Feb 21, 2014 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 lighting, ambient occlusion does not depend on light direction. As such, 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 simulate 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 a depth test (that is, they arec closer to the camera than the center pixel), then kA
receives a value of 1. A smaller number of samples result kA
less than 1.
SSAO component of a typical game scene
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.
-
1\$\begingroup\$ "...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. \$\endgroup\$– muhukCommented Dec 2, 2013 at 7:02
Ambient occlusion means where the light doesn't reach. Creases, and crevices don't get any ambient light bouncing around so they are usually absent of most light creating "darkest darks" usually depending on the atmosphere.
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
-
12\$\begingroup\$ I don't think you are contributing anything new worth mentioning. \$\endgroup\$– LasseCommented Dec 1, 2013 at 14:03
-
1\$\begingroup\$ This answer appears to be describing "ambient light" not "ambient occlusion." Ambient occlusion reduces the light added by ambient lighting. \$\endgroup\$– DMGregory ♦Commented Nov 26, 2018 at 18:06