Zh/$phong: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
No edit summary
Line 60: Line 60:
{{MatParam|$shinybloodexponent|int|Exponent for the above.|only={{L4ds}}|shaders=VertexLitGeneric, Infected}}
{{MatParam|$shinybloodexponent|int|Exponent for the above.|only={{L4ds}}|shaders=VertexLitGeneric, Infected}}


=== Brightness ===
=== 亮度 ===
{{MatParam|$phongboost|float|Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.|shaders=VertexLitGeneric, LightmappedGeneric({{mapbase|only}})}}
{{MatParam|$phongboost|float|Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.|shaders=VertexLitGeneric, LightmappedGeneric({{mapbase|only}})}}
{{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>.
Line 67: Line 67:
{{MatParam|$phongdisablehalflambert|bool|Disables forced [[$halflambert|half-lambertian]] shading on Phong materials. {{note|This parameter is effectively forced on in {{csgobranch|4}} due to <code>$halflambert</code> being disabled.}}|since={{as}}|also={{Mapbase}}|shaders=VertexLitGeneric}}
{{MatParam|$phongdisablehalflambert|bool|Disables forced [[$halflambert|half-lambertian]] shading on Phong materials. {{note|This parameter is effectively forced on in {{csgobranch|4}} due to <code>$halflambert</code> being disabled.}}|since={{as}}|also={{Mapbase}}|shaders=VertexLitGeneric}}


=== Colors ===
=== 色彩 ===
{{MatParam|$phongalbedotint|bool|Tints the phong reflection by the color of the <code>$basetexture</code>. The amount of tint is defined by the green channel of <code>$phongexponenttexture</code>. A <code>$phongexponenttexture</code> must be specified in order for <code>$phongalbedotint</code> to work.
{{MatParam|$phongalbedotint|bool|Tints the phong reflection by the color of the <code>$basetexture</code>. The amount of tint is defined by the green channel of <code>$phongexponenttexture</code>. A <code>$phongexponenttexture</code> must be specified in order for <code>$phongalbedotint</code> to work.
: {{Warning|<code>$phongalbedotint</code> cannot be used with <code>$phongtint</code>. The later will disable the effect.}}
: {{Warning|<code>$phongalbedotint</code> cannot be used with <code>$phongtint</code>. The later will disable the effect.}}
Line 101: Line 101:
== 另见 ==
== 另见 ==
* [[Phong materials]]
* [[Phong materials]]
* {{ent|$envmap}} (environment map)
* {{ent|$envmap}}(环境贴图)
* {{ent|$lightwarptexture}}
* {{ent|$lightwarptexture}}
* {{ent|$rimlight}}
* {{ent|$rimlight}}
* [https://tf2maps.net/threads/phong-on-brushes-the-hacky-way.26765 $Phong on brushes*: The Hacky Way (a TF2maps.net guide on how to fake $Phong on brushes for games prior to CS:GO)]
* [https://tf2maps.net/threads/phong-on-brushes-the-hacky-way.26765 $Phong on brushes*: The Hacky Way (a TF2maps.net guide on how to fake $Phong on brushes for games prior to CS:GO)]
*[https://share.substance3d.com/libraries/6595 SubstancePainter Source Engine Complex Phong Shader]
*[https://share.substance3d.com/libraries/6595 SubstancePainter Source Engine Complex Phong Shader]

Revision as of 04:00, 25 April 2023

English (en)Español (es)Русский (ru)中文 (zh)Translate (Translate)
Phong shading provides Alyx's skin, hairband and lip highlights.

Template:Shaderparam It provides diffuse reflections at low intensity and specular highlights at apex intensity, masked by a texture which control per-texel its intensity. For a full explanation, see Phong materials.

Note.png注意:Phong shading for LightmappedGeneric and WorldVertexTransition is only available in CS:GO 引擎分支 CS:GO 引擎分支. It requires the material to be lit by the sunlight from 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.png注意:Phong shading for LightmappedGeneric is also available in Mapbase Mapbase, but it is implemented differently.

语法

$phong <bool>
Note.png注意:All parameters in the following example must be specified in the material, otherwise Phong shading won't show up at all, except in Insurgency Insurgency.
待完善: 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]"
}


参数

蒙版

Warning.png警告:There are some caveats regarding $normalmapalphaenvmapmask and $selfillumfresnel when using $phong!


$bumpmap $basemapalphaphongmask $basemapluminancephongmask $phongexponent $phongexponenttexture $phongexponentfactor $invertphongmask $forcephong $diffuseexp $shinyblood $shinybloodexponent

亮度

$phongboost $phongfresnelranges $phongdisablehalflambert

色彩

$phongalbedotint $phongalbedoboost

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

$phongtint

Breakdown of the $phongwarptexture: computed coordinates, texture and result

$phongwarptexture

Brush phong in 反恐精英:全球攻势 反恐精英:全球攻势 using tile/hr_t/inferno/tile_a. Note the complete absence of the reflection in the shaded area.

Brush Shader Parameters (存在于 CS:GO 引擎分支 之中)

$phongmaskcontrastbrightness $phongamount $phongbasetint

控制台命令

mat_phong <布尔值(en)>
禁用或启用冯氏反射渲染。默认为 1。

另见