Ambient occlusion

AOMain

To implement this ambient occlusion effect, I followed the Image-Space Horizon-Based Ambient Occlusion slides from 2008 of Louis Bavoil and Miguel Sainz, from NVIDIA. I will be talking about how changing some of the parameters alters the results and showing it with screenshots because it is interesting to see how the AO is altered, but to get a proper understanding of how the method works, go to the source itself.

Radius of effect

This is the most basic attribute, and it mean until which distance around it will it check for geometry to compute the AO effect. Notice in the images above specially how the surface behind the leaves is mostly white at first, but darkens as the distance is increased.

Contrast

It basically is the intensity of the AO effect, since the darker the affected areas get, the higher the contrast with the rest will be. Notice that unlike with the radius, changing the contrast does not alter the areas that are affected by the AO, simply the ones that already where.

Bias angle

At some situations, specially low poly curves such as the arcs above, the jump from polygon to polygon that was not noticeable thank to the illumination working with interpolated normals, becomes apparent due to the AO. That is because AO works at a geometry level, and will understand changes from polygon to polygon as edges, which it will darken as expected. To avoid this we use the angle bias, which “elevates” the angle at which we are checking for the AO. This however, will get rid of soft AO effects that we might not have wanted to ignore.

Blur

The blur is useful to spread the darkness created by the ambient occlusion a bit and by doing so helps the result look smoother. The blur is created by using a 1D Gaussian Function first in rows and then in columns. While the image might seem a bit to blurred in the examples above, when that is then applied over the lit scene, it actually looks fine. See the examples below.

And here some more comparisons between with and without AO: