Screen Space Ambient Occlusion (SSAO): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (not in portal)
(restored per talk; some additional info)
Line 1: Line 1:
{{delete}}
[[{{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 edge "glow" bug around Breen's arm.]]
{{note|This is not a feature of the Source Engine, it is a shader which can be activated for nVidia cards using nVidia drivers. It will cause a dramatic reduction in framerate. Not supported in Portal.}}
See '''[[Wikipedia:Screen Space Ambient Occlusion|Screen Space Ambient Occlusion]]'''.
[[{{ns:6}}:Prop ragdoll.jpg|thumb|400px|AO in game - the shading effect is highly visible between Breen and the table, but also appears in the corners of the room.]]


'''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 '''[[Wikipedia:Screen Space Ambient Occlusion|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 [[DirectX]] 9.0c shader, so it will only be available on fairly modern video cards.


<!--'''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 '''[[Wikipedia:Screen Space Ambient Occlusion|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 [[DirectX]] 9.0c shader, so it will only be available on fairly modern video cards.-->
The [[Source]] engine does not directly support ambient occlusion, so it is not found in Source's video options; it currently can only be enabled for nVidia graphics cards via the nVidia drivers.


<!--Ambient occlusion is currently only available for NVidia cards using the NVidia drivers. It is very resource-intensive and will cause a significant reduction in framerate on older 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.
 
Enabling ambient occlusion will generally cause a significant drop in performance, particularly on older cards - framerates may be reduced by more than half.


SSAO causes several rendering bugs which are common to nearly all games which offer SSAO.
SSAO causes several rendering bugs which are common to nearly all games which offer SSAO.
[[{{ns:6}}:Ao_renderbug_trees.jpg|thumb|right|300px|The shadows being rendered on top of fog are noticable on distant trees.]]
[[{{ns:6}}:Ao_renderbug_trees.jpg|thumb|right|300px|The shadows being rendered on top of fog are noticable on distant trees.]]
{{bug|SSAO often creates a small visual error where the very edge of an object is not shaded, causing an apparent glow.}}
{{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. This may give distant trees a frosted look.}}
{{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. This may give distant trees a frosted look, and in some cases allows the player to discern objects that would normally be completely obscured by fog.}}


==Supported games==
==Supported games==
All [[Source]] engine games except [[Portal]] support ambient occlusion. This may be because AO would not render correctly through Portals.-->
All [[Source]] engine games except [[Portal]] support nVidia's ambient occlusion. This may be because AO would not render correctly through Portals.


<!--
==Enabling ambient occlusion==
==Enabling ambient occlusion==
[[{{ns:6}}:EnableAO.png|thumb|right|300px|Enabling AO in NVidia control panel]]
[[{{ns:6}}:EnableAO.png|thumb|right|300px|Enabling AO in nVidia control panel]]
Ambient occlusion cannot be controlled through the video options within a Source game. AO can be turned on with NVidia cards using the NVidia drivers.
Ambient occlusion cannot be controlled through the video options within a Source game. AO is controlled by video drivers. For NVidia users, this is found in the NVidia Control Panel. ATI Catalyst Control Center does not currently offer a driver-based AO option.
-->

Revision as of 06:52, 18 December 2010

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 DirectX 9.0c shader, so it will only be available on fairly modern video cards.

The Source engine does not directly support ambient occlusion, so it is not found in Source's video options; it currently can only be enabled for nVidia graphics cards via the nVidia drivers.

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.

Enabling ambient occlusion will generally cause a significant drop in performance, particularly on older cards - framerates may be reduced by more than half.

SSAO causes several rendering bugs which are common to nearly all games which offer SSAO.

File:Ao renderbug trees.jpg
The shadows being rendered on top of fog are noticable on distant trees.
Icon-Bug.pngBug:SSAO often creates a small visual error where the very edge of an object is not shaded, causing an apparent glow.  [todo tested in ?]
Icon-Bug.pngBug: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. This may give distant trees a frosted look, and in some cases allows the player to discern objects that would normally be completely obscured by fog.  [todo tested in ?]

Supported games

All Source engine games except Portal support nVidia's ambient occlusion. This may be because AO would not render correctly through Portals.

Enabling ambient occlusion

Enabling AO in nVidia control panel

Ambient occlusion cannot be controlled through the video options within a Source game. AO is controlled by video drivers. For NVidia users, this is found in the NVidia Control Panel. ATI Catalyst Control Center does not currently offer a driver-based AO option.