Site icon

Ambient Occlusion: A comprehensive look

What is Ambient occlusion?
Ambient occlusion is a shading method which can help add realism and depth to your render. In simple words it’s a preferred method over GI when you are pressed for time. This occlusion is also known as the ‘dirtpass’ or ‘dirtmap’. The pass renders quite quickly and since it is a Global Illumination (GI) solution, it is an excellent tool when time is of the essence, and GI quality is required.

Lets see how the shader works

It shoots out rays from the pixels that have been shaded depending on the normal of the pixel. Then it projects these rays into the scene, bound by a particular distance and if it hits geometry, the ray occults. However it is a crude substitute to actual Global Illumination.

Specifically talking, in mental ray(3ds Max or Maya) the new Ambient Occlusion shader has opened a whole new method giving you the flexibility on how you generate your GI, unlike the traditional method of using GI and final gather (expensive render time). Hence Ambient Occlusion has been used extensively and widely of late.

Let’s take a few examples:

The first pass Is only a diffuse pass, 2nd is Ambient occlusion, 3rd is a composition of AO and diffuse pass,done in Photoshop.
A short experiment:

Below is a scene rendered in 3ds max and rendered in mental ray. It has 3 objects and plane, all of which have been shaded with Ambient Occlusion. There are no lights in the scene. You can see that the strength of AO is highly dependent on the distance of the object from the plane. Also careful observation shows that the pots are casting occlusion on each other.

3ds max AO test

Studying some of the shader parameters:

Now I would take a simple scene. I have rendered it in 3ds max, but you may use any 3d software package that has Mental Ray.

Case one:

Look at this render.It is grainy due to low sample rate

Sample rate=5

Spread=0.5

Lets try and improve it.To reduce the noise, I increased the shader sample rate to 128 and this is the result. Spread again at 0.5.AA kept to 1/4

We still lack the �Ambient feel’ So what do we do?
We would increase the spread to 0.95. And now notice the soft ambient feel with dramatic softer shadows!

VERY IMPORTANTLY, increasing the samples and spread will definitely hit higher render times.

Reducing the grain wont be that important for still renders but for animation, if not taken care of, it can cause severe blotchy areas and jitter issues.

nullMapped bright and dark values

One more feature about ambient occlusion is that you can use a bitmap to define what color should be used for each ray sample. In our first example the rays could return only one of two colours, which were BLACK or WHITE. So instead we will use a bitmap set to environment, to define what the bright color will be for each ray sample. One drawback here could be that since the bitmap contains its own dark and bright areas, in the occlusion process it will shoot out rays with a considerable difference in luma and chroma values.
Lets see this with an example

A bitmap is used in the slot against BRIGHT. Samples=32, Spread=0.75

Now we will blur the bitmap in photoshop or any photo editing program to take care of the artifacts and also give it a more ambient feel. Here’s the result with the same sample rate and spread.

null

To get rid of those scary shadows which also blotch the sphere we will increase the samples to 128 and spread to 0.9.Lets hit render and see the result

This is the soft GI feel that we were looking for!(though faked)

Let me brief through other parameters of the shader (some of them are seldom used)

Reflective:

When this option is enabled, it helps us use the shader as Reflection occlusion instead of Ambient occlusion, and especially used when a hybrid scanline / raytrace feel is required.

Dark:
As discussed above, this colour is used for the occluded rays. Again it can be mapped for better control or for a special effect.

The Ambient Occlusion plugin for vray:

Interestingly, Marc Lorentz released a script that does 1-click ambient occlusion rendering for Vray

You can get the free script and the needed information here:

plugins.angstraum.at/vrayao/index.htm

Some test renders that I performed using this script..

Skydome ,subdivisions 8 Environment, subdivisions 8

AMBIENT OCCLUSION: VRAY

connect@animationxpress.com

Exit mobile version