$phong: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
* '''For a full explanation see [[Phong materials]].'''
[[Image:Alyx phong closeup.jpg|thumb|Phong shading provides Alyx's skin, hairband and lip highlights.]]
* Supported in CS:S, DoD:S, EP1, EP2, Portal, TF2 and any mod based off of SDK Base (AppID 215)


==Basic VMT syntax==
The '''<code>$phong</code>''' [[VMT]] command provides diffuse reflections. For a full explanation, see [[Phong materials]].


{{note|The Phong shader should use the default values for parameters that you omit from your VMT. However it appears that in some cases this doesn't happen and the shader doesn't work. Therefore it is recommended that you include all the parameters and specify the default values yourself.}}
{{note|Phong shading is only available with [[VertexLitGeneric]].}}
* Eg phong shader with default values (where available):
"[[vertexlitgeneric]]"
{
"$phong" "1"
  "$phongexponenttexture" "path/to/vtf"
  "$phongexponent" "5"
  "$phongboost" "1.0"
  "$phongfresnelranges" "[0 0.5 1]"
}


==Available values==
==VMT syntax==


=====$phong=====
  $phong <[[bool]]>
  "$phong" "1"
* Values: "0" Disable or "1" Enable a Phong pass for this material.


The Phong shader ''should'' use the default values for parameters that you omit from your VMT. However it appears that in some cases this doesn't happen and the shader doesn't work. Therefore it is recommended that you include all the parameters and specify the default values yourself.


=====$phongexponenttexture=====
  [[VertexLitGeneric]]
  "$phongexponenttexture" "path/to/vtf"
{
* Values: Filename of texture which defines Phong exponent per texel. See [[Phong materials#Phong mask and exponent texture]]
$phong 1
 
   
 
$phongexponent 5 ''// Either/or''
=====$phongexponent=====
$phongexponenttexture <texture> ''// Either/or''
  "$phongexponent" "5"
$phongboost 1.0
* Values: <code>0 - 255</code> Default <code>5</code>.
$phongfresnelranges "[0 0.5 1]"
* Phong exponent for local specular lights. See [[Phong materials#Phong mask and exponent texture]]
}
* Overides $phongexponenttexture applying a defined constant exponent value over the whole texture.
 
 
=====$phongboost=====
"$phongboost" "1.0"
* Values: are unbound and can even be negative although this would probably provide worthless results.
* Phong overbrightening factor. The phong mask channel should be authored to account for this.
* The Phong boost value is an overbrightening factor applied to the Phong mask channel. The Phong mask channel should be authored to take the Phong boost value into account for this.
 
 
=====$phongfresnelranges=====
"$phongfresnelranges" "[0 0.5 1]"  
* Values: Default [0 0.5 1].
* Parameters for remapping Fresnel output. See [[Phong materials#Phong Fresnel ranges]]
 


===Currently unsupported parameters===
== Additional parameters ==


=====$lightwarptexture=====
; <code>$phongexponent <[[int]]></code>
* 1D ramp texture for tinting scalar diffuse term. Mentioned in the SDK samples.
; <code>$phongexponenttexture <texture></code>
: See [[Phong materials#Phong mask and exponent texture|Phong mask and exponent texture]]. The texture value is overridden by the numeric value (if the latter is present).
; <code>$phongboost <int></code>
: Phong overbrightening factor. The phong mask channel should be authored to account for this.
; <code>$phongfresnelranges <matrix></code>
: See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>.
; <code>$lightwarptexture <texture></code>
: A 1-dimensional ramp texture for defining the sharpness of shadows. Used to create TF2's quasi-illustrated character lighting.
: {{todo|Needs documentation.}}
; <code>$phongalbedotint <?></code>
: Allow the [[albedo]] (i.e. [[$basetexture]]) to affect the colour tint of the Phong highlight? Possibly related to the green channel of the Phong exponent mask. Seen in some Day of Defeat: Source player model VMTs.
: {{todo|Needs documentation.}}
;<code>$ambientocclusiontexture <texture></code>
: A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face.
: {{todo|Needs documentation.}}


=====$phongalbedotint=====
== See also ==
* Allow the base/albedo texture to affect the colour tint of the Phong highlight? Possibly related to the green channel of the Phong exponent mask. Seen in some Day of Defeat: Source player model VMTs.


=====$ambientocclusiontexture=====
* [[Phong materials]]
* Ambient occlusion texture or "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face.  
* <code>[[$envmap]]</code>, for specular reflections.


[[Category:List of Shader Parameters]]
[[Category:List of Shader Parameters]]
[[Category:VMT Lighting]]
[[Category:VMT Lighting]]

Revision as of 05:45, 12 July 2008

Phong shading provides Alyx's skin, hairband and lip highlights.

The $phong VMT command provides diffuse reflections. For a full explanation, see Phong materials.

Note.pngNote:Phong shading is only available with VertexLitGeneric.

VMT syntax

$phong <bool>

The Phong shader should use the default values for parameters that you omit from your VMT. However it appears that in some cases this doesn't happen and the shader doesn't work. Therefore it is recommended that you include all the parameters and specify the default values yourself.

VertexLitGeneric
{
	$phong			1

	$phongexponent		5		// Either/or
	$phongexponenttexture	<texture>	// Either/or
	$phongboost		1.0
	$phongfresnelranges	"[0 0.5 1]"
}

Additional parameters

$phongexponent <int>
$phongexponenttexture <texture>
See Phong mask and exponent texture. The texture value is overridden by the numeric value (if the latter is present).
$phongboost <int>
Phong overbrightening factor. The phong mask channel should be authored to account for this.
$phongfresnelranges <matrix>
See Phong Fresnel ranges. Default is "[0 0.5 1]".
$lightwarptexture <texture>
A 1-dimensional ramp texture for defining the sharpness of shadows. Used to create TF2's quasi-illustrated character lighting.
Todo: Needs documentation.
$phongalbedotint <?>
Allow the albedo (i.e. $basetexture) to affect the colour tint of the Phong highlight? Possibly related to the green channel of the Phong exponent mask. Seen in some Day of Defeat: Source player model VMTs.
Todo: Needs documentation.
$ambientocclusiontexture <texture>
A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face.
Todo: Needs documentation.

See also