$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 Phong shading won't show up at all, except in
.
m (Added $phongdisablehalflambert is also in Mapbase) |
Deprecated (talk | contribs) (Removed $ambientocclusiontexture as that does nothing for $phong in any branch, confirmed engine branches for $diffuseexp and $phongexponentfactor, misc improvements) |
||
Line 7: | Line 7: | ||
$phong <[[bool]]> | $phong <[[bool]]> | ||
{{note|All parameters in the following example must be specified in the material, otherwise | {{note|All parameters in the following example must be specified in the material, otherwise Phong shading won't show up at all, except in {{insurgency}}.}} | ||
:{{todo|Other games that don't require all phong parameters present (likely Portal 2 and up)}} | :{{todo|Other games that don't require all phong parameters present (likely Portal 2 and up)}} | ||
<syntaxhighlight lang=php> | <syntaxhighlight lang=php> | ||
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 | {{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 bump map, 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| | {{MatParam|$phongexponent|and=$phongexponent2|int|A global [[Phong materials#Phong mask and exponent texture|exponent]] value. Overrides an exponent mask if present. | ||
: <code>$phongexponent2</code> is for <code>WorldVertexTransition</code>'s second material in {{csgo}}.}} | : <code>$phongexponent2</code> is for <code>WorldVertexTransition</code>'s second material in {{csgo}}.}} | ||
{{MatParam|$phongexponenttexture|texture|A | {{MatParam|$phongexponenttexture|texture|A per-texel exponent 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 mask (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>, | :* '''Green channel:''' Albedo tint mask (only if <code>$phongalbedotint 1</code>, 0-255, where a value of 0 is no tint, 255 full tint.) | ||
:* '''Blue channel:''' Nothing | :* '''Blue channel:''' Nothing. | ||
:* '''Alpha channel:''' {{ent|$rimlight}} mask. | :* '''Alpha channel:''' {{ent|$rimlight}} mask (only if <code>$rimmask 1</code>.) | ||
:{{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|$phongexponentfactor|int|Multiply the exponent texture by this amount.|only=2013MP}} | |||
{{MatParam|$invertphongmask|bool|Invert the value of the phong mask. {{todo|What types of mask does this work on?}}|since=EP2}} | {{MatParam|$invertphongmask|bool|Invert the value of the phong mask. {{todo|What types of mask does this work on?}}|since=EP2}} | ||
{{MatParam|$forcephong|bool|Force phong shading on phong materials even at low GPU levels. This requires the convar <code>mat_phong</code> to be set to 1, otherwise it won't work.{{confirm}}|since=L4D}} | |||
{{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|$diffuseexp|float|{{todo|Does this have something to do with the $phongexponent, $phongexponenttexture or both?}}|only=L4ds}} | ||
{{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}} | ||
=== Brightness === | === Brightness === | ||
Line 49: | Line 49: | ||
{{MatParam|$phongfresnelranges|matrix|See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>.}} | {{MatParam|$phongfresnelranges|matrix|See [[Phong materials#Phong Fresnel ranges|Phong Fresnel ranges]]. Default is <code>"[0 0.5 1]"</code>.}} | ||
{{MatParam|$phongdisablehalflambert|bool|Disables forced [[$halflambert|half-lambertian]] shading on Phong materials.|since=AS|also=Mapbase}} | {{MatParam|$phongdisablehalflambert|bool|Disables forced [[$halflambert|half-lambertian]] shading on Phong materials.|since=AS|also=Mapbase}} | ||
=== | === Colors === | ||
{{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). | ||
Line 67: | Line 66: | ||
{{MatParam|$phongmaskcontrastbrightness|and=$phongmaskcontrastbrightness2|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. | {{MatParam|$phongmaskcontrastbrightness|and=$phongmaskcontrastbrightness2|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. | ||
: <code>$phongmaskcontrastbrightness2</code> is for <code>WorldVertexTransition</code>'s second material. | : <code>$phongmaskcontrastbrightness2</code> is for <code>WorldVertexTransition</code>'s second material. | ||
: {{todo|Find out the range of both values | : {{todo|Find out the range of both values.}}|only=CSGO}} | ||
{{MatParam|$phongamount|and=$phongamount2|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. | {{MatParam|$phongamount|and=$phongamount2|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. | ||
: <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| | {{MatParam|$phongbasetint|and=$phongbasetint2|float|<code>LightmappedGeneric</code> and <code>WorldVertexTransition</code> only. Allows the <code>$basetexture</code> and/or <code>$basetexture2</code> to tint the color of the Phong highlight.|only=CSGO}} | ||
== Console Commands == | == Console Commands == |
Revision as of 19:58, 8 December 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
$phongexponentfactor
$invertphongmask
$forcephong
$diffuseexp
$shinyblood
$shinybloodexponent
Brightness
$phongboost
$phongfresnelranges
$phongdisablehalflambert
Colors
$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