This article's documentation is for "Source Filmmaker". Click here for more information.
This article's documentation is for anything that uses the Source engine. Click here for more information.

$ambientocclusion: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Typo)
 
(26 intermediate revisions by 18 users not shown)
Line 1: Line 1:
Ambient occlusion is a shading method which helps add realism to local reflection models by taking into account attenuation of light due to occlusion. 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.
{{Source topicon}}{{SFM topicon}}
[[File:valveao.jpg|thumb|200px|Various WrinkleMaps maps found in Valve games for eyes and face.]]


== Using Ambient Occlusion ==
'''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 materials|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. It is globally supported on the [[EyeRefract]] shader. The [[Source Filmmaker|IFM]] module, when loaded, makes the '''<code>$ambientocclusion</code>''' parameter function on other shaders such as [[VertexLitGeneric]] as a means of controlling the intensity of [[Screen Space Ambient Occlusion (SSAO)|SSAO]].
{{ClassicConfirm|Does this just apply to the IFM version or the current release of [[Source Filmmaker]]? }}


=== Example VMT Syntax ===
{{TODO|How does using a dedicated ambient occlusion texture differ from just baking it into the base texture (and possibly also the phong/specular mask)?}}
 
{{Bug|When used on transparent materials (either <code>[[$translucent]]</code> or <code>[[$alphatest]]</code>, or all materials on a model where a transparent material has been used without compiling with either <code>$Opaque</code> or <code>$MostlyOpaque</code> in the QC file), <code>$ambientocclusion</code> also causes the material to render the effect for any objects behind the material. ''(Tested in Source Filmmaker)''}}
 
==Using Ambient Occlusion==
===Example VMT Syntax===
The following example is taken from [[Left 4 Dead]] from the model material located in <code>L4D root/materials/models/survivors/teenangst/teenangst_eyeball_l.vmt</code>
The following example is taken from [[Left 4 Dead]] from the model material located in <code>L4D root/materials/models/survivors/teenangst/teenangst_eyeball_l.vmt</code>


<pre>
{{CodeBlock|lines=18|src=teenangst_eyeball_l.vmt|[[EyeRefract]]<nowiki>
EyeRefract
{
{
$Iris "models/survivors/green_iris2"  
$Iris "models/survivors/green_iris2"  
$AmbientOcclTexture "models/survivors/survivor_eye_ao"  
$AmbientOcclTexture "models/survivors/survivor_eye_ao"  
$Envmap "Engine/eye-reflection-cubemap-"  
$Envmap "Engine/eye-reflection-cubemap-"  
$CorneaTexture "Engine/eye-cornea"  
$CorneaTexture "Engine/eye-cornea"  
$EyeballRadius "0.6"  
$EyeballRadius "0.6"  
$AmbientOcclColor "[.4 .4 .4]" Default 0.33, 0.33, 0.33
$AmbientOcclColor "[.4 .4 .4]" Default 0.33, 0.33, 0.33
$Dilation ".5"  
$Dilation ".5"  
$ParallaxStrength "0.25"  
$ParallaxStrength "0.25"  
$CorneaBumpStrength ".5"  
$CorneaBumpStrength ".5"  
$halflambert 1
$halflambert 1
$nodecal 1
$nodecal 1
$ambientocclusion 1
$ambientocclusion 1
 
$RaytraceSphere 1  
$RaytraceSphere 1  
$SphereTexkillCombo 0  
$SphereTexkillCombo 0  
}
}</nowiki>}}
</pre>


=== VMT Paremeters ===
===VMT Parameters===
The following is a list of VMT parameters that are needed to enable the Ambient Occlusion:
;<code>$AmbientOcclusion <[[float]]></code>  
:<code>$AmbientOcclusion "0/1"</code> - Disable/Enable Ambient Occlusion. (1 = enabled, 0 = disabled)
: Controls strength of Ambient Occlusion. (1 = fully enabled, 0 = fully disabled)
:<code>$AmbientOcclColor "[.n .n .n]"</code> - Replacing n with a number of the color (RGB format)
{{note|Used to control the strength of the SSAO for models in Source Filmmaker.}}
:<code>$AmbientOcclTexture "path/to/vtf"</code> - Filename of the ambient occlusion texture to use
;<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
{{TODO|How does <code>$ambientocclusiontexture</code> fit in with all of this?}}


== See also ==
== See also ==


* [[Phong materials]]
* [[Phong materials|Phong Materials]]
* [[$phong]]
* [[$basetexture]]
* [[$basetexture]]
* [[$envmapmask]] (specular mask)
* [[$envmapmask]] (specular mask)
Line 41: Line 51:
* [[$selfillum]]
* [[$selfillum]]


[[Category:List of Shader Parameters|A]]
[[Category:Shader parameters|a]]
[[Category:VMT Lighting]]
[[Category:VMT Lighting]]

Latest revision as of 01:41, 25 November 2024

Various WrinkleMaps 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. It is globally supported on the EyeRefract shader. The IFM module, when loaded, makes the $ambientocclusion parameter function on other shaders such as VertexLitGeneric as a means of controlling the intensity of SSAO.

Confirm:Does this just apply to the IFM version or the current release of Source Filmmaker?
Todo: How does using a dedicated ambient occlusion texture differ from just baking it into the base texture (and possibly also the phong/specular mask)?
Icon-Bug.pngBug:When used on transparent materials (either $translucent or $alphatest, or all materials on a model where a transparent material has been used without compiling with either $Opaque or $MostlyOpaque in the QC file), $ambientocclusion also causes the material to render the effect for any objects behind the material. (Tested in Source Filmmaker)  [todo tested in ?]

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

teenangst_eyeball_l.vmt
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
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

$AmbientOcclusion <float>
Controls strength of Ambient Occlusion. (1 = fully enabled, 0 = fully disabled)
Note.pngNote:Used to control the strength of the SSAO for models in Source Filmmaker.
$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?

See also