$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.
Note:All parameters in the following example must be specified in the material, otherwise the phong shader won't show up at all, except in
.
Eternifity (talk | contribs) mNo edit summary |
Deprecated (talk | contribs) (Added that $basemapalphaphongmask, $invertphongmask, $phongtint, and $phongalbedotint were introduced in EP2, rewrote $invertphongmask and $forcephong, added mat_phong console command) |
||
Line 27: | Line 27: | ||
{{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|$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|Use {{ent|$basetexture}}'s [[alpha channel]] as the Phong mask instead of <code>$bumpmap</code>'s. The phong will not be influenced by the bumpmap, however.}} | {{MatParam|$basemapalphaphongmask|bool|Use {{ent|$basetexture}}'s [[alpha channel]] as the Phong mask instead of <code>$bumpmap</code>'s. The phong will not be influenced by the bumpmap, however.|since=EP2}} | ||
{{MatParam|$basemapluminancephongmask|bool|Mask phong intensity based on the brightness of the <code>$basetexture</code>.|since=L4D}} | {{MatParam|$basemapluminancephongmask|bool|Mask phong intensity based on the brightness of the <code>$basetexture</code>.|since=L4D}} | ||
{{MatParam|$phongexponent|and=$phongexponent2|int|The numeric value overrides an exponent mask if present. | {{MatParam|$phongexponent|and=$phongexponent2|int|The numeric value overrides an exponent mask if present. | ||
Line 37: | Line 37: | ||
:* '''Alpha channel:''' {{ent|$rimlight}} mask. | :* '''Alpha channel:''' {{ent|$rimlight}} mask. | ||
:{{Note|<code>LightmappedGeneric</code> and <code>WorldVertexTransition</code> do not have support for <code>$phongexponenttexture</code>. You must use <code>$phongexponent</code> instead.}}}} | :{{Note|<code>LightmappedGeneric</code> and <code>WorldVertexTransition</code> do not have support for <code>$phongexponenttexture</code>. You must use <code>$phongexponent</code> instead.}}}} | ||
{{MatParam|$invertphongmask|bool| | {{MatParam|$invertphongmask|bool|Invert the value of the phong mask. {{todo|What types of mask does this work on?}}|since=EP2}} | ||
{{MatParam|$phongexponentfactor|int|Multiply the exponent texture by this amount. {{todo|Is this available in every engine branch?}}}} | {{MatParam|$phongexponentfactor|int|Multiply the exponent texture by this amount. {{todo|Is this available in every engine branch? Seems to be only in {{tf2}}.}}}} | ||
{{MatParam|$forcephong|bool|Force phong | {{MatParam|$forcephong|bool|Force phong shading on phong materials even at low GPU levels. This requires the convar mat_phong to be set to 1, otherwise it won't work.{{confirm}}|since=L4D}} | ||
{{MatParam|$shinyblood|int|only=L4ds}} | {{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|$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}} | ||
Line 54: | Line 54: | ||
{{MatParam|$phongalbedotint|bool|Allows the <code>$basetexture</code> to tint the color of the Phong highlight. The amount of tint is defined by the green channel of <code>$phongexponenttexture</code> (see above). | {{MatParam|$phongalbedotint|bool|Allows the <code>$basetexture</code> to tint 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>}}|since=EP2}} | ||
{{MatParam|$phongalbedoboost|float|Phong albedo overbrightening factor. Ranges 0-255. {{todo|Test and add a better description.}}|since=CSGO}} | {{MatParam|$phongalbedoboost|float|Phong albedo overbrightening factor. Ranges 0-255. {{todo|Test and add a better description.}}|since=CSGO}} | ||
[[File:Phongwarp example.png|thumb|200px|The Hunter without and with its $phongwarptexture, showing how it affects the Phong reflection.]] | [[File:Phongwarp example.png|thumb|200px|The Hunter without and with its $phongwarptexture, showing how it affects the Phong reflection.]] | ||
{{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). | {{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). | ||
: {{Warning|This will override <code>$phongalbedotint</code> if both are used.}} | : {{Warning|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>}}|since=EP2}} | ||
{{MatParam|$phongwarptexture|texture|Used to create an iridescence effect, as seen on Episode Two's [[npc_hunter|Hunters]]. {{Todo|How does $phongwarptexture actually work?}} | {{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.}}|since=EP2}} | ||
Line 71: | Line 71: | ||
: <code>$phongamount2</code> is for <code>WorldVertexTransition</code>'s second material.|only=CSGO}} | : <code>$phongamount2</code> is for <code>WorldVertexTransition</code>'s second material.|only=CSGO}} | ||
{{MatParam|$phongbasetint|and=$phongbasetint2|float|Tints the phong color by the diffuse texture|only=CSGO}} | {{MatParam|$phongbasetint|and=$phongbasetint2|float|Tints the phong color by the diffuse texture|only=CSGO}} | ||
== Console Commands == | |||
{{IO|mat_phong|param=bool|Disable or enable phong shading. Default 1.}} | |||
== See also == | == See also == |
Revision as of 16:15, 30 November 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 
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
$forcephong
$shinyblood
$shinybloodexponent
$diffuseexp
Brightness
$phongboost
$phongfresnelranges
$phongdisablehalflambert
$ambientocclusiontexture
Colours
$phongalbedotint
$phongalbedoboost
Brush Shader Parameters
$phongmaskcontrastbrightness
$phongamount
$phongbasetint
Console Commands
- mat_phong <boolean >
- Disable or enable phong shading. Default 1.
See also
- Phong materials
- $envmap (environment map)
- $lightwarptexture
- $rimlight