$phong/zh

From Valve Developer Community
Jump to: navigation, search
冯氏着色器为爱莉克斯的皮肤、发带和嘴唇提供了高光。

它提供低强度的 Wikipedia icon 漫反射 和顶点强度的 Wikipedia icon 镜面高光,由控制每个纹素强度的纹理遮罩。有关完整解释,请参见 冯氏材质

Note.png注意:LightmappedGenericWorldVertexTransition 的冯氏着色功能只在 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注意:Mapbase Mapbase中也提供了 LightmappedGeneric 的冯氏着色功能,但实现方式有所不同。

语法

$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.
Blank image.png待完善: Other games that don't require all phong parameters present (likely Portal 2 and up)
VertexLitGeneric
{
	$phong 1

	$bumpmap				[贴图]
	$phongexponent			5			// either/or
	$phongexponenttexture	[贴图]	// either/or
	$phongboost				1.0
	$phongfresnelranges		"[0 0.5 1]"
}


参数

蒙版

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


Phong requires mask. The alpha channel of a bump map acts as a Phong mask by default.
$basemapalphaphongmask <boolean> | 布尔值 (存在于自 起源2007 以来)
Shader(s): VertexLitGeneric
Use $basetexture's alpha channel as the Phong mask instead of $bumpmap's alpha channel.
Warning.png警告:Using this with $normalmapalphaenvmapmask will override the mask used for $envmap to be the contents of the $basetexture's alpha channel!
Warning.png警告:Garry's Mod Garry's Mod Using this with $normalmapalphaenvmapmask and $envmap renders in $envmap and $phong be masked by both $basemapalphaphongmask alpha channel and $normalmapalphaenvmapmask alpha channel.
$basemapluminancephongmask <boolean> | 布尔值 (存在于自 求生之路 以来)
Shader(s): VertexLitGeneric
Mask phong intensity based on the brightness of the $basetexture.
Icon-Bug.png错误:Basetexture Luminance will replace the mask used for $envmap, if $normalmapalphaenvmapmask is used.
Icon-Bug.png错误:Doesn't work in Garry's Mod Garry's Mod.
A global exponent value. Overrides an exponent mask if present.
$phongexponent2 is for WorldVertexTransition's second material in CS:GO 引擎分支 CS:GO 引擎分支.
Shader(s): VertexLitGeneric
A per-texel exponent map. In an exponent map:
  • Red channel: Exponent mask (size of highlight, 0-255, where a value of 0 is a large highlight, 255 small.)
  • Green channel: Albedo tint mask (only if $phongalbedotint 1, 0-255, where a value of 0 is no tint, 255 full tint.)
  • Blue channel: Nothing.
  • Alpha channel: $rimlight mask (only if $rimmask 1.)
Note.png注意:LightmappedGeneric and WorldVertexTransition do not have support for $phongexponenttexture. You must use $phongexponent instead.
$phongexponentfactor <float> | 浮点型 (存在于 起源2013 多人分支军团要塞2 之中)
Shader(s): VertexLitGeneric
Multiply the exponent from the $phongexponenttexture by this amount.
Tip.png提示: The default value of this parameter is "0.0". However, a more reasonable default value would be "149.0"
$invertphongmask <boolean> | 布尔值 (存在于自 起源2007 以来)
Shader(s): VertexLitGeneric
Invert the value of the phong mask.
Icon-Bug.png错误:In 异形丛生s and 起源2013s Shadercode, using this parameter will invert the mask used for $envmap, not the one used for $phong!
证实: Is this the case for all branches?
$forcephong <boolean> | 布尔值 (存在于自 传送门2 以来)
Shader(s): VertexLitGeneric
Force phong shading on phong-using materials even at low GPU levels when mat_phong is disabled.
$diffuseexp <float> | 浮点型 (存在于 Left 4 Dead series 之中)
Shader(s): VertexLitGeneric, Infected
Diffuse exponent used for dynamic lights only.
Note.png注意:have this with $halflambert greatly decrease it effect.
$shinyblood <integer> | 整数 (存在于 Left 4 Dead series 之中)
Shader(s): VertexLitGeneric, Infected
Derive phong mask from areas that are more red than others. Only when variation is disabled.
$shinybloodexponent <integer> | 整数 (存在于 Left 4 Dead series 之中)
Shader(s): VertexLitGeneric, Infected
Exponent for the above.

亮度

$phongboost <float> | 浮点型
Shader(s): VertexLitGeneric, LightmappedGeneric((only in Mapbase))
Phong brightness factor. Larger values create a more intense highlight, useful for surfaces like metal and glass.
Shader(s): VertexLitGeneric, LightmappedGeneric((only in Mapbase))
See Phong Fresnel ranges. Default is "[0 0.5 1]".
Note.png注意:$envmap is also affected by these fresnel ranges if both it and Phong are enabled in a material.
Note.png注意: drives the x component of a phongwarptexture if specified.
$phongdisablehalflambert <boolean> | 布尔值 (存在于自 异形丛生 以来) (也存在于 Mapbase 之中)
Shader(s): VertexLitGeneric
Disables forced half-lambertian shading on Phong materials.
Note.png注意:This parameter is effectively forced on in CS:GO 引擎分支 CS:GO 引擎分支 due to $halflambert being disabled.

色彩

$phongalbedotint <boolean> | 布尔值 (存在于自 起源2007 以来)
Shader(s): VertexLitGeneric
Tints the phong reflection by the color of the $basetexture. The amount of tint is defined by the green channel of $phongexponenttexture. A $phongexponenttexture must be specified in order for $phongalbedotint to work.
Warning.png警告:$phongalbedotint cannot be used with $phongtint. The later will disable the effect.
Note.png注意:$phongalbedotint works by multiplying the $basetexture over the reflection, without darkening the albedo. The reflection will get dimmer as a result, so account for this in the phong mask or with $phongboost.
Note.png注意:$phongalbedotint will tint highlights by the original color of the $basetexture even when the material is tinted by $color2 or rendercolor.
$phongalbedoboost <float> | 浮点型 (存在于自 反恐精英:全球攻势 以来)
Shader(s): VertexLitGeneric
Phong albedo overbrightening factor. Ranges 0-255.
Note.png注意: This will multiply the tint that is being applied to phong from $phongalbedotint.
Icon-Bug.png错误:This does not work when using $detail.
The Hunter without and with its $phongwarptexture, showing how it affects the Phong reflection.
$phongtint <RGB matrix> (存在于自 起源2007 以来)
Shader(s): VertexLitGeneric
Color tint of the phong reflection.
Warning.png警告:This will override $phongalbedotint if both are used.
Note.png注意: Also tints $rimlight
Breakdown of the $phongwarptexture: computed coordinates, texture and result
$phongwarptexture <texture> (存在于自 起源2007 以来)
Shader(s): VertexLitGeneric
Used to create an iridescence effect, as seen on Episode Two's Hunters.
The highlight is multiplied with a texture. The coordinates of the sampled pixel are as follows:
x: 1 - (distance to the center of the highlight)
y: 1 - (fresnel component as computed by Phong Fresnel ranges)
Note.png注意:Disables the initial phongfresnelranges masking
Icon-Bug.png错误:求生之路2 求生之路2 中不起作用。
Brush phong in 反恐精英:全球攻势 反恐精英:全球攻势 using tile/hr_t/inferno/tile_a. Note the complete absence of the reflection in the shaded area.

笔刷/固体着色器参数(only in CS:GO 引擎分支)

Shader(s): LightmappedGeneric, WorldVertexTransition
The first value controls the contrast level between light and dark areas in the mask, and the second value controls the overall brightness.
$phongmaskcontrastbrightness2 is for WorldVertexTransition's second material.
Blank image.png待完善: Find out the range of both values.
Shader(s): LightmappedGeneric, WorldVertexTransition
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.
$phongamount2 is for WorldVertexTransition's second material.
$phongbasetint and $phongbasetint2 <float> | 浮点型
Shader(s): LightmappedGeneric, WorldVertexTransition
Allows the $basetexture and/or $basetexture2 to tint the color of the Phong highlight.

控制台命令

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

另见