$ambientocclusion: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Upon testing in Alien Swarm and L4D, on/off made no difference.)
m (Further testing give better conclusions)
Line 3: Line 3:
Ambient occlusion is a shading method which helps add realism to local reflection models by taking into account attenuation of light due to occlusion {{clarify}}. Unlike local methods like Phong shading, ambient occlusion is a global method, meaning the illumination at each point is a function of other geometry in the scene. However, it is a very crude approximation to full global illumination. The soft appearance achieved by ambient occlusion alone is similar to the way an object appears on an overcast day.
Ambient occlusion is a shading method which helps add realism to local reflection models by taking into account attenuation of light due to occlusion {{clarify}}. Unlike local methods like Phong shading, ambient occlusion is a global method, meaning the illumination at each point is a function of other geometry in the scene. However, it is a very crude approximation to full global illumination. The soft appearance achieved by ambient occlusion alone is similar to the way an object appears on an overcast day.


{{note|Ambient Occlusion maps seem to be used exclusively for eyes and sometimes faces/heads.}}
{{note|Ambient Occlusion maps seem to be used exclusively for eyes and sometimes faces/heads, although they appear only to work on eyes.}}
:({{confirm|Does it actually work?}})
{{note|It also seems to only work on <code>EyeRefract</code>}}
 


== Using Ambient Occlusion ==
== Using Ambient Occlusion ==
Line 35: Line 36:
The following is a list of VMT parameters that are needed to enable the Ambient Occlusion:
The following is a list of VMT parameters that are needed to enable the Ambient Occlusion:
:<code>$AmbientOcclusion "0/1"</code> - Disable/Enable Ambient Occlusion. (1 = enabled, 0 = disabled)
:<code>$AmbientOcclusion "0/1"</code> - Disable/Enable Ambient Occlusion. (1 = enabled, 0 = disabled)
{{confirm|Does <code>$AmbientOcclusion</code> actually toggle the effect?}}
:<code>$AmbientOcclColor "[.n .n .n]"</code> - Replacing n with a number of the color (RGB format)
:<code>$AmbientOcclColor "[.n .n .n]"</code> - Replacing n with a number of the color (RGB format)
:<code>$AmbientOcclTexture "path/to/vtf"</code> - Filename of the ambient occlusion texture to use
:<code>$AmbientOcclTexture "path/to/vtf"</code> - Filename of the ambient occlusion texture to use

Revision as of 07:23, 13 June 2013

Various ambient occlusion maps found in Valve games for eyes and face.

Ambient occlusion is a shading method which helps add realism to local reflection models by taking into account attenuation of light due to occlusion [Clarify]. Unlike local methods like Phong shading, ambient occlusion is a global method, meaning the illumination at each point is a function of other geometry in the scene. However, it is a very crude approximation to full global illumination. The soft appearance achieved by ambient occlusion alone is similar to the way an object appears on an overcast day.

Note.pngNote:Ambient Occlusion maps seem to be used exclusively for eyes and sometimes faces/heads, although they appear only to work on eyes.
Note.pngNote:It also seems to only work on EyeRefract


Using Ambient Occlusion

Example VMT Syntax

The following example is taken from Left 4 Dead from the model material located in L4D root/materials/models/survivors/teenangst/teenangst_eyeball_l.vmt

EyeRefract
{
$Iris "models/survivors/green_iris2" 
$AmbientOcclTexture "models/survivors/survivor_eye_ao" 
$Envmap "Engine/eye-reflection-cubemap-" 
$CorneaTexture "Engine/eye-cornea" 
$EyeballRadius "0.6" 
$AmbientOcclColor "[.4 .4 .4]" Default 0.33, 0.33, 0.33
$Dilation ".5" 
$ParallaxStrength "0.25" 
$CorneaBumpStrength ".5" 
$halflambert 1
$nodecal 1
$ambientocclusion 1

$RaytraceSphere 1 
$SphereTexkillCombo 0 
}

VMT Parameters

The following is a list of VMT parameters that are needed to enable the Ambient Occlusion:

$AmbientOcclusion "0/1" - Disable/Enable Ambient Occlusion. (1 = enabled, 0 = disabled)
Confirm:Does $AmbientOcclusion actually toggle the effect?
$AmbientOcclColor "[.n .n .n]" - Replacing n with a number of the color (RGB format)
$AmbientOcclTexture "path/to/vtf" - Filename of the ambient occlusion texture to use
Todo: How does $ambientocclusiontexture fit in with all of this?

Source Filmmaker

$AmbientOcclusion "0" can be used to toggle SSAO off on a specific model; for example, a prop in a skybox.

See also