Ambient Occlusion

From Valve Developer Community
< SFM
Jump to navigation Jump to search
Warning.pngWarning:This page is under construction and requires a lot more information before acting as an essential resource.

About Ambient Occlusion

An example of traditional prerendered ambient occlusion in Blender 3D. SSAO attempts to mimic this look in real-time.

Valve's Source engine uses SSAO which stands for Screen Space Ambient Occlusion. It works by examining an onscreen pixel then comparing its location in a depth buffer to the pixels around it. Pixels which are close together but not coplanar (on the same face) are shaded to simulate soft shadows. To maximize efficiency and speed, random sampling is used which will inevitably create noise/grain. This is avoided by blurring the SSAO pass.

What Visual Difference Ambient Occlusion Makes

The most significant affect of ambient occlusion is that geometry appears much more three-dimensional.
Parts of a model which are meant to be shaded but aren't reached by dynamic shadows receive proper attenuation.
Picture the roots of ambient occlusion as little points of shading. All these little points group together to form radial shadows. The settings such as bias, radius, and strength (explained below) determine how each of those points work together to create realistic shadows in places of geometry where light would be occluded.
Below are some examples of shading using ambient occlusion.

Enabling Ambient Occlusion

Enabling Ambient Occlusion is as easy as right-clicking the viewport and heading to your render settings. In the dialog box for your render settings, check the box adjacent from the Ambient Occlusion setting which reads "enable". Make sure that the drop-down menu next to the AO setting reads "AO Only" and not "Outline(link) Only" or "AO & Outline" (edit for proof, add pictures).

Note.pngNote:If there's ugly black speckles frequenting the scene upon enabling AO, that is normal. All this means is that you are not looking through your scene camera with at least 8 samples of depth of field rendered in the viewport (you must be in the Clip Editor).
Note.pngNote:Enabling ambient occlusion can slow down Source Filmmaker.
Comparison of different DOF sample rates

Camera Settings

SSAO Bias: Determines the threshold for visible ambient occlusion
SSAO Strength: Determines the intensity of the shadows cast by ambient occlusion
SSAO Radius: Determines the filtersize (spread) of shadows cast by ambient occlusion

Tip.pngTip:In almost all situations, you will find that increasing your bias while restricting your radius will produce the most realistic ambient occlusion. In order to refine your AO to a precise level, go into your viewport render settings and check "Show AO". Your viewport will only show your ambient occlusion shading and you'll be able to know exactly where it's affecting your scene.