523_MASTER

Ambient Occlusion: What You Need to Know

‌‌

Updated 9/4/2019

Understanding Ambient Occlusion

In graphics, ambient occlusion is a shadowing technique used to make 3D objects look more realistic by simulating the soft shadows that should naturally occur when indirect or ambient lighting is cast out onto your scene. Ambient occlusion shading is actually fake indirect shadows that are added into the render by rays that get cast out from each surface on your geometry. If these rays come into contact with another surface, that area will become darker. If they don’t find another surface, the area will stay brighter.

These soft ambient occlusion shadows help to define and separate the objects in your scene and add another level of realism to your render.

Ambient Occlusion Shadowing Technique Example 3D Motorcycle

When Is Ambient Occlusion Used?

Let’s say you want to enhance the visible separation between individual bricks on a brick wall so they don’t seem to run together. You don’t want to use the same shadows you’d get from direct lighting because it wouldn’t give the effect you desire. 

You would want to use ambient occlusion because it shows subtle variations in lighting and helps your eyes detect surface details that would otherwise be washed out or unnoticeable. 

Ambient occlusion is great for softening the overall lighting in your scene if it’s too bright. There is no need to add additional lights because ambient occlusion does not work in the same way as “final gather” which must use a light source to cast out rays. 

Ambient occlusion is also great for visualizing a model that hasn’t even been textured yet.

Example of Ambient Occlusion Shading using Rays

How Does Ambient Occlusion Work?

In most 3D applications, ambient occlusion is calculated using a special ambient occlusion shader that is applied to your geometry. 

Since ambient occlusion is simulated by casting out rays to sample nearby geometry, any object with a transparency map applied to it won’t get calculated. That’s because ambient occlusion doesn’t look at the texture maps applied to geometry, but instead works by sampling nearby geometry that blocks or occludes light (since light passes through a transparent object). 

Once rendered, the ambient occlusion pass is typically something added onto the final render in a photo compositing software (like Photoshop) where further manipulating and fine-tuning of the ambient occlusion can be achieved.

4 Tips for Setting Up Ambient Occlusion

While it can take a bit of practice and experience to get your ambient occlusion just right, here are four tips to get you started:

  1. Use Integrated Ambient Occlusion Settings: Many 3D applications (such as 3ds Max, Maya, or Softimage) already have integrated ambient occlusion settings. For that reason, you should first check your architectural and design materials before you start setting up a separate render pass.
  2. Bake It Out: A great way to speed up render time when incorporating ambient occlusion is to bake out the ambient occlusion pass. This is especially important when rendering an animation. That’s because with every frame rendered, the computer will need to recalculate the ambient occlusion pass which can greatly increase the render time.
  3. Example of adjusting max distance in ambient occlusion settings for wider shadows

  4. Adjust the Max Distance: If you are getting undesirable results from your ambient occlusion pass (such as shadows that are much too wide or too shallow), you can adjust the max distance in the ambient occlusion settings. When this is adjusted, it determines how far the rays travel in order to find geometry. The further these rays travel, the wider the shadow will be. Therefore, increasing the distance will increase the amount of shadows cast onto your scene. If you decrease the distance, the rays don’t travel as far which creates a much tighter level of shadows that only appear when other geometry is very close to the surface.
  5. Utilize a Directional Ambient Occlusion Pass: You can add another level of realism by utilizing a directional ambient occlusion pass. This allows you to use the light’s position in the scene to add more directionality, and not have it based solely off of the surrounding geometry (which can often result in unrealistic shadows, depending on the lighting of the scene).

Example of directional ambient occlusion pass

Ambient occlusion can do wonders to make your renders look professional and more realistic. Find out more about ambient occlusion and other rendering techniques with the popular CG101: Rendering tutorial or other 3D Lighting tutorials from Pluralsight!