Screen Space Ambient Occlusion (SSAO): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Undo revision 140722 by Thelonesoldier (Talk))
No edit summary
Line 3: Line 3:
[[{{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.]]
[[{{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.]]


'''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.
'''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. Typically AO is accomplished through '''[[Wikipedia:Screen Space Ambient Occlusion|SSAO]]''', which is a simplified way to fake realistic AO with shaders in a process fast enough for real-time rendering.


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.
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.


{{Note|Enabling ambient occlusion can cause significant performance penalties.}}
{{Note|Enabling SSAO can cause significant performance penalties.}}


This method of driver forced SSAO causes several rendering bugs in the Source Engine. Most notably, the SSAO shader does not take fog into account in it's AO calculations, producing visual artifacts in scenes with heavy fog.
This method of driver forced SSAO causes several rendering bugs in the Source Engine. Most notably, the SSAO shader does not take fog into account in it's AO calculations, producing visual artifacts in scenes with heavy fog.
[[{{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.]]
==Enabling Nvidia's Screen Space Ambient Occlusion==
[[{{ns:6}}:EnableAO.png|thumb|right|300px|Enabling AO in Nvidia control panel]]
SSAO cannot be controlled through the video options within a Source game, because Source does not have a built in SSAO shader. Instead, SSAO must be enabled by Nvidia's video drivers in the Nvidia Control Panel.


==Supported games==
==Supported games==
All [[Source]] engine games except [[Portal]] have driver profiles to enable Nvidia's Ambient Occlusion. SSAO in Portal can be forced on by editing Portal's driver profile with an external application.
All [[Source]] engine games except [[Portal]] have driver profiles to enable Nvidia's SSAO. SSAO in Portal can be forced on by editing Portal's driver profile with an external application.
==Enabling Nvidia's Ambient Occlusion==
[[{{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 is controlled by Nvidia's video drivers in the Nvidia Control Panel.

Revision as of 14:49, 22 December 2010

Note.pngNote:This is a feature of Nvidia's drivers and not of the Source Engine. If you want to use this effect in your mod, you need to make your own shader.
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. Typically AO is accomplished through SSAO, which is a simplified way to fake realistic AO with shaders in a process fast enough for real-time rendering.

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.

Note.pngNote:Enabling SSAO can cause significant performance penalties.

This method of driver forced SSAO causes several rendering bugs in the Source Engine. Most notably, the SSAO shader does not take fog into account in it's AO calculations, producing visual artifacts in scenes with heavy fog.

File:Ao renderbug trees.jpg
The shadows being rendered on top of fog are noticable on distant trees.

Enabling Nvidia's Screen Space Ambient Occlusion

Enabling AO in Nvidia control panel

SSAO cannot be controlled through the video options within a Source game, because Source does not have a built in SSAO shader. Instead, SSAO must be enabled by Nvidia's video drivers in the Nvidia Control Panel.

Supported games

All Source engine games except Portal have driver profiles to enable Nvidia's SSAO. SSAO in Portal can be forced on by editing Portal's driver profile with an external application.