Screen Space Ambient Occlusion (SSAO)

From Valve Developer Community
Revision as of 07:26, 28 September 2010 by Thelonesoldier (talk | contribs) (Created page with '[[{{ns:6}}:Prop ragdoll.jpg|thumb|400px|SSAO in game - the shading effect is highly visible between Breen and the table, but also appears in the corners of the room. Note the edg…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
SSAO in game - the shading effect is highly visible between Breen and the table, but also appears in the corners of the room. Note the edge "glow" bug around Breen's arm.

Ambient Occlusion (AO) is a type of lighting technique applied in-game to create more realistic lighting. AO simulates soft shadows created by two surfaces that are close together. Ambient occlusion in games is normally accomplished through Screen Space Ambient Occlusion, which is a simplified way to fake realistic AO with shaders in a process fast enough for real-time rendering. SSAO is a Direct-X 10 shader, so it will only be available on fairly modern video cards.

SSAO works by examining an onscreen pixel, and then comparing its location in the depth buffer (i.e. how far it is away from the player) to the pixels around it. Pixels which are close together but not coplanar (on the same face) are shaded to simulate soft shadows. To maintain playable framerates, it is not possible to sample every pixel every frame, so random sampling is used, which will inevitably create noise/grain which may be more noticable when the player moves around.

Bug: SSAO often creates a small visual error where the very edge of an object is not shaded, causing an apparent glow.
Bug: SSAO is rendered on top of fog and smoke, even if the smoke is closer to the player than the source of the shading, causing the fog/smoke to look lumpy