$phong: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Combined some "2" parameters with their counterpart parameters, changed brush shader parameters to CSGO only as they aren't in any other games)
mNo edit summary
Line 70: Line 70:
{{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|{{todo|What are these?}}|only=CSGO}}
{{MatParam|$phongbasetint|and=$phongbasetint2|float|Tints the phong color by the diffuse texture|only=CSGO}}


== See also ==
== See also ==

Revision as of 15:38, 28 November 2019

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

Template:Shaderparam It provides diffuse reflections, masked by a texture to control its intensity per-texel. For a full explanation, see Phong materials.

Note.pngNote:Phong shading for LightmappedGeneric and WorldVertexTransition is only available in Counter-Strike: Global Offensive. 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.

Syntax

$phong <bool>
Note.pngNote:All parameters in the following example must be specified in the material, otherwise the phong shader 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)
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

The Hunter without and with its $phongwarptexture, showing how it affects the Phong reflection.

$phongtint $phongwarptexture

Brush Shader Parameters

$phongmaskcontrastbrightness $phongamount $phongbasetint

See also