$phong: Difference between revisions
Jump to navigation
Jump to search
Note:Phong shading for
. It requires the material to be lit by a env_cascade_light entity to work properly, and uses the dynamic shadows generated by it as a mask on top of the traditional phong masking.
Deprecated (talk | contribs) (Added phongwarp example image, added note that $phongtint overrides $phongalbedotint, misc changes) |
Deprecated (talk | contribs) (Rewritten, changed to use Shaderparam and MatParam templates) |
||
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.]] | ||
{{Shaderparam|$phong|since=Source 2006|shader1=VertexLitGeneric|shader2=LightmappedGeneric|shader3=WorldVertexTransition}} It provides diffuse reflections, masked by a texture to control its intensity per-texel. For a full explanation, see [[Phong materials]]. | |||
{{Note|Phong shading for <code>LightmappedGeneric</code> and <code>WorldVertexTransition</code> is only available in {{csgo}}. It requires the material to be lit by a {{ent|env_cascade_light}} entity to work properly, and uses the dynamic shadows generated by it as a mask on top of the traditional phong masking.}} | |||
==VMT syntax== | ==VMT syntax== | ||
Line 26: | Line 26: | ||
=== Masking === | === Masking === | ||
{{MatParam|$bumpmap|texture|There must be a Phong mask. The [[alpha channel]] of a [[$bumpmap|bump map]] acts as a Phong mask by default.}} | |||
{{MatParam|$basemapalphaphongmask|bool|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.}} | |||
{{MatParam|$basemapluminancephongmask|bool|Phong intensity is based on the brightness of <code>$basetexture</code>.|since=L4D}} | |||
{{MatParam|$phongexponent|int|The numeric value overrides an exponent mask if present.}} | |||
{{MatParam|$phongexponenttexture|texture|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.) | ||
:* '''Green channel:''' Albedo tint (if <code>$phongalbedotint 1</code>, higher is more tint) | :* '''Green channel:''' Albedo tint (if <code>$phongalbedotint 1</code>, higher is more tint) | ||
:* '''Blue channel:''' Nothing | :* '''Blue channel:''' Nothing | ||
:* '''Alpha channel:''' <code>[[$rimlight]]</code> mask | :* '''Alpha channel:''' <code>[[$rimlight]]</code> mask.}} | ||
{{MatParam|$invertphongmask|bool|Appears to invert the value of the phong mask, as the name suggests. {{todo|What types of mask does this work on?}}}} | |||
{{MatParam|$phongexponentfactor|int|This number will be used to multiply the exponent texture. {{todo|Is this available in every engine branch?}}}} | |||
{{MatParam|$shinyblood|int|only=L4ds}} | |||
{{MatParam|$shinybloodexponent|int|{{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]''.}}|only=L4ds}} | |||
{{MatParam|$diffuseexp|float|{{todo|Does this have something to do with the <code>$phongexponent</code>, <code>$phongexponenttexture</code> or both? Confirm engine branches, likely Left 4 Dead series only.}}}} | |||
=== Brightness === | === Brightness === | ||
{{MatParam|$phongboost|float|Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.}} | |||
{{MatParam|$phongfresnelranges|matrix|See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>.}} | |||
{{MatParam|$phongDisableHalfLambert|bool|Used in [[Portal 2]] on the Personality Cores such as Wheatley, disables functionality of $halflambert. MAY need <code>$halflambert 0</code>!|since=AS}} | |||
{{MatParam|$ambientocclusiontexture|texture|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 === | ||
{{MatParam|$phongalbedotint|bool|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>}}}} | |||
: {{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>}} | {{MatParam|$phongalbedoboost|float|Phong albedo overbrightening factor. Ranges 0-255. {{todo|Test and add a better description.}}}} | ||
[[File:Phongwarp example.png|thumb|200px|The Hunter with and without its $phongwarptexture, showing how it ]] | |||
{{MatParam|$phongtint|RGB matrix|Color tint of the phong reflection. The channels are interpreted relative to each other (so "[0 0 0]" and "[1 1 1]" are the same). | |||
: {{Note|This will override <code>$phongalbedotint</code> if both are used.}} | : {{Note|This will override <code>$phongalbedotint</code> if both are used.}} | ||
: {{bug|This does not work with <code>$basemapalphaphongmask.</code>}} | : {{bug|This does not work with <code>$basemapalphaphongmask.</code>}}}} | ||
{{MatParam|$phongwarptexture|texture|Used to create an iridescence effect, as seen on Episode Two's [[npc_hunter|Hunters]]. {{Todo|How does $phongwarptexture actually work?}} | |||
: {{note|Does not work in {{l4d2}}, despite the game being released in 2009.}}|since=EP2}} | |||
: {{note|Does not work in {{l4d2}}, despite the game being released in 2009.}} | |||
= | |||
=== | === Brush Shader Parameters === | ||
{{MatParam|$phongmaskcontrastbrightness|vector2|<code>LightmappedGeneric</code> and <code>WorldVertexTransition</code> only. The first value controls the contrast level between light and dark areas in the mask, and the second value controls the overall brightness. | |||
: {{todo|Find out the range of both values, and whether or not <code>VertexLitGeneric</code> can support this parameter.}}|since=CSGO}} | |||
{{MatParam|$phongamount|vector4|<code>LightmappedGeneric</code> and <code>WorldVertexTransition</code> only. The first 3 values control the color tint, and the fourth value controls the brightness. The fourth value can go beyond 1, but affects the brightness of the whole texture, not just the highlight.|since=CSGO}} | |||
== See also == | == See also == |
Revision as of 10:52, 17 July 2019
Template:Shaderparam It provides diffuse reflections, masked by a texture to control its intensity per-texel. For a full explanation, see Phong materials.

LightmappedGeneric
and WorldVertexTransition
is only available in 
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
$basemapalphaphongmask
$basemapluminancephongmask
$phongexponent
$phongexponenttexture
$invertphongmask
$phongexponentfactor
$shinyblood
$shinybloodexponent
$diffuseexp
Brightness
$phongboost
$phongfresnelranges
$phongDisableHalfLambert
$ambientocclusiontexture
Colours
$phongalbedotint
$phongalbedoboost
Brush Shader Parameters
$phongmaskcontrastbrightness
$phongamount
See also
- Phong materials
- $envmap (environment map)
- $lightwarptexture
- $rimlight