$phong: Difference between revisions
Jump to navigation
Jump to search
Deprecated (talk | contribs) (Removed $allowdiffusemodulation, doesn't seem to be related to phong if the $allowdiffusemodulation article is any indication) |
Deprecated (talk | contribs) (Unified parameter naming, added note about $phongalbedotint and $color2, added further todos) |
||
Line 1: | Line 1: | ||
[[File:Alyx phong closeup.jpg|thumb|200px|Phong shading provides Alyx's skin, hairband and lip highlights.]] | [[File:Alyx phong closeup.jpg|thumb|200px|Phong shading provides Alyx's skin, hairband and lip highlights.]] | ||
The '''<code>$phong</code>''' [[VMT]] command provides diffuse reflections. In most engine branches it is only available | The '''<code>$phong</code>''' [[VMT]] command provides diffuse reflections. In most engine branches it is only available on <code>[[VertexLitGeneric]]</code>; {{csgo}} '''[[Counter-Strike: Global Offensive]]''' (as of early 2015) allows it to a limited extent on <code>[[LightmappedGeneric]]</code> and <code>[[WorldVertexTransition]].</code> For a full explanation, see [[Phong materials]]. | ||
==VMT syntax== | ==VMT syntax== | ||
Line 28: | Line 28: | ||
; <code>$bumpmap <[[texture]]></code> | ; <code>$bumpmap <[[texture]]></code> | ||
: There must be a Phong mask. The [[alpha channel]] of a [[$bumpmap|bump map]] acts as a Phong mask by default. | : There must be a Phong mask. The [[alpha channel]] of a [[$bumpmap|bump map]] acts as a Phong mask by default. | ||
;<code>$ | ;<code>$basemapalphaphongmask <bool></code> | ||
: Uses <code>[[$basetexture]]</code>'s [[alpha channel]] as the Phong mask instead of <code>$bumpmap</code>'s. The phong will not be influenced by the bumpmap, however. | : Uses <code>[[$basetexture]]</code>'s [[alpha channel]] as the Phong mask instead of <code>$bumpmap</code>'s. The phong will not be influenced by the bumpmap, however. | ||
; {{L4D add|<code>$ | ; {{L4D add|<code>$basemapluminancephongmask <[[bool]]></code>}} | ||
: Phong intensity is based on the brightness of <code>$basetexture</code>. | : Phong intensity is based on the brightness of <code>$basetexture</code>. | ||
; <code>$ | ; <code>$phongexponent <[[int]]></code> | ||
: The numeric value overrides an exponent mask if present. | : The numeric value overrides an exponent mask if present. | ||
; <code>$ | ; <code>$phongexponenttexture <texture></code> | ||
: A global [[Phong materials#Phong mask and exponent texture|exponent]] value, or a per-texel exponent texture map. In an exponent map: | : A global [[Phong materials#Phong mask and exponent texture|exponent]] value, or a per-texel exponent texture map. In an exponent map: | ||
:* '''Red channel:''' Exponent (size of highlight, 0-255, where a value of 0 is a large highlight, 255 small.) | :* '''Red channel:''' Exponent (size of highlight, 0-255, where a value of 0 is a large highlight, 255 small.) | ||
Line 40: | Line 40: | ||
:* '''Blue channel:''' Nothing | :* '''Blue channel:''' Nothing | ||
:* '''Alpha channel:''' <code>[[$rimlight]]</code> mask | :* '''Alpha channel:''' <code>[[$rimlight]]</code> mask | ||
; <code>$ | ; <code>$invertphongmask <bool></code> | ||
: Appears to invert the value of the phong mask, as the name suggests. {{todo|1=What types of mask does this work on?}} | : Appears to invert the value of the phong mask, as the name suggests. {{todo|1=What types of mask does this work on?}} | ||
; <code>$ | ; <code>$phongexponentfactor <[[int]]></code> | ||
: This number will be used to multiply the exponent texture. | : This number will be used to multiply the exponent texture. | ||
; {{L4D add|<code>$shinyblood <[[int]]></code>}} | ; {{L4D add|<code>$shinyblood <[[int]]></code>}} | ||
; {{L4D add|<code>$shinybloodexponent <int></code>}} | ; {{L4D add|<code>$shinybloodexponent <int></code>}} | ||
: {{todo|1=See ''[https://steamcdn-a.akamaihd.net/apps/valve/2010/GDC10_ShaderTechniquesL4D2.pdf#page=33 Shading a Bigger, Better Sequel: Techniques in Left 4 Dead 2]''.}} | : {{todo|1=See ''[https://steamcdn-a.akamaihd.net/apps/valve/2010/GDC10_ShaderTechniquesL4D2.pdf#page=33 Shading a Bigger, Better Sequel: Techniques in Left 4 Dead 2]''.}} | ||
; <code>$ | ; <code>$diffuseexp</code> | ||
: {{todo|Does this have something to do with the | : {{todo|Does this have something to do with the <code>$phongexponent</code>, <code>$phongexponenttexture</code> or both? Confirm engine branches.}} | ||
=== Brightness === | === Brightness === | ||
Line 54: | Line 54: | ||
; <code>$phongboost <[[float]]></code> | ; <code>$phongboost <[[float]]></code> | ||
: Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass. | : Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass. | ||
; <code>$ | ; <code>$phongfresnelranges <matrix></code> | ||
: See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>. | : See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>. | ||
; <code>$ | ; <code>$phongDisableHalfLambert <bool></code> {{P2 add}} | ||
: Used in [[Portal 2]] on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need <code>$halflambert 0</code>! | : Used in [[Portal 2]] on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need <code>$halflambert 0</code>! | ||
;<code>$ | ;<code>$ambientocclusiontexture <texture></code> | ||
: A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face. [[$ambientocclusion|Ambient Occlusion]] is generally used for the eyes and face. | : A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face. [[$ambientocclusion|Ambient Occlusion]] is generally used for the eyes and face. {{Todo|Does this actually do anything?}} | ||
=== Colours === | === Colours === | ||
; <code>$ | ; <code>$phongalbedotint <bool></code> | ||
: Allows the <code>[[$basetexture]]</code> to affect the | : Allows the <code>[[$basetexture]]</code> to affect the color of the Phong highlight. The amount of tint is defined by the green channel of <code>$phongexponenttexture</code> (see above). | ||
: {{Note|<code>$phongalbedotint</code> will tint highlights by the original color of the <code>$basetexture</code> even when the material is tinted by <code>$color2</code> or <code>rendercolor.</code>}} | |||
; <code>$phongtint "[<red [[float]]> <green float> <blue float>]"</code> | ; <code>$phongtint "[<red [[float]]> <green float> <blue float>]"</code> | ||
: Modifies the colour of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same). | : Modifies the colour of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same). | ||
:{{bug|This does not work with $basemapalphaphongmask.}} | : {{bug|This does not work with <code>$basemapalphaphongmask.</code>}} | ||
; <code>$ | ; <code>$phongwarptexture <texture></code> {{EP2 add}} | ||
: | : Used to create an iridescence effect, as seen on [[npc_hunter]]s. {{Todo|How does $phongwarptexture actually work?}} | ||
: {{note|Does not work in {{l4d2}}, despite the game being released in 2009}} | : {{note|Does not work in {{l4d2}}, despite the game being released in 2009}} | ||
== Phong shading on brush faces == | == Phong shading on brush faces == | ||
A May 2015 update to {{csgo}} '''[[Counter-Strike: Global Offensive]]''' added limited support for Phong-based highlights on <code>[[LightmappedGeneric]]</code> materials. Currently it only works when the material is directly lit by an env_cascade_lighting, using the dynamic shadows as a mask (although traditional Phong masking is supported on top of this). It is known to work on displacements as well as <code>[[WorldVertexTransition]]</code> materials, but not water or <code>[[Lightmapped_4WayBlend]]</code>. | A May 2015 update to {{csgo}} '''[[Counter-Strike: Global Offensive]]''' added limited support for Phong-based highlights on <code>[[LightmappedGeneric]]</code> materials. Currently it only works when the material is directly lit by an env_cascade_lighting, using the dynamic shadows as a mask (although traditional Phong masking is supported on top of this). It is known to work on displacements as well as <code>[[WorldVertexTransition]]</code> materials, but not on water or <code>[[Lightmapped_4WayBlend]]</code>. | ||
=== New Parameters === | === New Parameters === |
Revision as of 00:00, 24 April 2019
The $phong
VMT command provides diffuse reflections. In most engine branches it is only available on VertexLitGeneric
; Counter-Strike: Global Offensive (as of early 2015) allows it to a limited extent on
LightmappedGeneric
and WorldVertexTransition.
For a full explanation, see Phong materials.
VMT syntax
$phong <bool>
- Todo: Other games that don't require all phong parameters present (likely Portal 2 and up)
VertexLitGeneric
{
$phong 1
$bumpmap [texture]
$phongexponent 5 // either/or
$phongexponenttexture [texture] // either/or
$phongboost 1.0
$phongfresnelranges "[0 0.5 1]"
}
Parameters
Masking
$bumpmap <texture>
- There must be a Phong mask. The alpha channel of a bump map acts as a Phong mask by default.
$basemapalphaphongmask <bool>
- Uses
$basetexture
's alpha channel as the Phong mask instead of$bumpmap
's. The phong will not be influenced by the bumpmap, however. - Template:L4D add
- Phong intensity is based on the brightness of
$basetexture
. $phongexponent <int>
- The numeric value overrides an exponent mask if present.
$phongexponenttexture <texture>
- A global exponent value, or a per-texel exponent texture map. In an exponent map:
- Red channel: Exponent (size of highlight, 0-255, where a value of 0 is a large highlight, 255 small.)
- Green channel: Albedo tint (if
$phongalbedotint 1
, higher is more tint) - Blue channel: Nothing
- Alpha channel:
$rimlight
mask
$invertphongmask <bool>
- Appears to invert the value of the phong mask, as the name suggests. Todo: What types of mask does this work on?
$phongexponentfactor <int>
- This number will be used to multiply the exponent texture.
- Template:L4D add
- Template:L4D add
$diffuseexp
- Todo: Does this have something to do with the
$phongexponent
,$phongexponenttexture
or both? Confirm engine branches.
Brightness
$phongboost <float>
- Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.
$phongfresnelranges <matrix>
- See Phong Fresnel ranges. Default is
"[0 0.5 1]"
. $phongDisableHalfLambert <bool>
Template:P2 add- Used in Portal 2 on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need
$halflambert 0
! $ambientocclusiontexture <texture>
- A "dirtmap". Mentioned in the SDK samples and seen in the VMT for Alyx's face. Ambient Occlusion is generally used for the eyes and face. Todo: Does this actually do anything?
Colours
$phongalbedotint <bool>
- Allows the
$basetexture
to affect the color of the Phong highlight. The amount of tint is defined by the green channel of$phongexponenttexture
(see above). Note:
$phongalbedotint
will tint highlights by the original color of the$basetexture
even when the material is tinted by$color2
orrendercolor.
$phongtint "[<red float> <green float> <blue float>]"
- Modifies the colour of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same).
Bug:This does not work with
$basemapalphaphongmask.
[todo tested in ?]$phongwarptexture <texture>
Template:EP2 add- Used to create an iridescence effect, as seen on npc_hunters. Todo: How does $phongwarptexture actually work?
Phong shading on brush faces
A May 2015 update to Counter-Strike: Global Offensive added limited support for Phong-based highlights on
LightmappedGeneric
materials. Currently it only works when the material is directly lit by an env_cascade_lighting, using the dynamic shadows as a mask (although traditional Phong masking is supported on top of this). It is known to work on displacements as well as WorldVertexTransition
materials, but not on water or Lightmapped_4WayBlend
.
New Parameters
$phongMaskContrastBrightness "[<float> <float>]"
- Defines the contrast level between light and dark areas in the mask, and the overall brightness, respectively. Added along with support for phong-shaded lightmapped textures. Todo: Find out the range of both values, and whether or not it can be used on models.
$phongAmount "[<red float> <green float> <blue float> <brightness> float]"
- Controls the tint and brightness. The fourth value can go beyond 1, but affects the brightness of the whole texture, not just the highlight.
See also
- Phong materials
- $envmap (environment map)
- $lightwarptexture
- $rimlight