Zh/$phong: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
m (Nesciuse moved page $phong/zh to Zh/$phong over redirect: Language prefixes)
m (-Using L template for links)
Line 1: Line 1:
{{langsp|title=冯氏反射}}
{{langsp|title=冯氏反射}}
[[File:Alyx phong closeup.jpg|thumb|200px|冯氏着色器为爱莉克斯的皮肤、发带和嘴唇提供了高光。]]
[[File:Alyx phong closeup.jpg|thumb|200px|冯氏着色器为爱莉克斯的皮肤、发带和嘴唇提供了高光。]]
它提供低强度的 {{w|Diffuse_reflection|漫反射}} 和顶点强度的 {{W|Specular_highlights|镜面高光}},由控制每个纹素强度的纹理遮罩。有关完整解释,请参见 [[Phong materials|冯氏材质]]
它提供低强度的 {{w|Diffuse_reflection|漫反射}} 和顶点强度的 {{W|Specular_highlights|镜面高光}},由控制每个纹素强度的纹理遮罩。有关完整解释,请参见 {{L|Phong materials|冯氏材质}}
{{Note|<code>LightmappedGeneric</code> 和 <code>WorldVertexTransition</code> 的冯氏着色功能只在 {{csgobranch|4}} 中可用。It requires the material to be lit by the sunlight from a {{ent|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|<code>LightmappedGeneric</code> 和 <code>WorldVertexTransition</code> 的冯氏着色功能只在 {{csgobranch|4}} 中可用。It requires the material to be lit by the sunlight from a {{ent|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|在{{mapbase|4}}中也提供了 <code>LightmappedGeneric</code> 的冯氏着色功能,但实现方式有所不同。}}
{{Note|在{{mapbase|4}}中也提供了 <code>LightmappedGeneric</code> 的冯氏着色功能,但实现方式有所不同。}}
== 语法 ==
== 语法 ==


  $phong <[[bool]]>
  $phong <{{L|bool}}>


{{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|4}}.}}
{{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|4}}.}}
Line 32: Line 32:
* '''If''' {{ent|$normalmapalphaenvmapmask}} is used, the {{ent|$bumpmap}}'s alpha channel will be used for Phong masking. Using either <code>$basemapalphaphongmask</code> or <code>$basemapluminancephongmask</code> will override it.
* '''If''' {{ent|$normalmapalphaenvmapmask}} is used, the {{ent|$bumpmap}}'s alpha channel will be used for Phong masking. Using either <code>$basemapalphaphongmask</code> or <code>$basemapluminancephongmask</code> will override it.
<br>
<br>
{{MatParam|$bumpmap|texture|Phong requires mask. The [[alpha channel]] of a [[$bumpmap|bump map]] acts as a Phong mask by default.}}
{{MatParam|$bumpmap|texture|Phong requires mask. The {{L|alpha channel}} of a {{L|$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 [[alpha channel]].
{{MatParam|$basemapalphaphongmask|bool|Use {{ent|$basetexture}}'s {{L|alpha channel}} as the Phong mask instead of <code>$bumpmap</code>'s {{L|alpha channel}}.
{{warning|Using this with {{ent|$normalmapalphaenvmapmask}} will override the mask used for {{ent|$envmap}} to be the contents of the {{ent|$basetexture}}'s alpha channel!}}
{{warning|Using this with {{ent|$normalmapalphaenvmapmask}} will override the mask used for {{ent|$envmap}} to be the contents of the {{ent|$basetexture}}'s alpha channel!}}
{{warning|{{gmod|4}} Using this with {{ent|$normalmapalphaenvmapmask}} and {{ent|$envmap}} renders in {{ent|$envmap}} and '''<code>$phong</code>''' be masked by both '''<code>$basemapalphaphongmask</code>''' alpha channel and {{ent|$normalmapalphaenvmapmask}} alpha channel.}} |since={{src07}}|shaders=VertexLitGeneric}}
{{warning|{{gmod|4}} Using this with {{ent|$normalmapalphaenvmapmask}} and {{ent|$envmap}} renders in {{ent|$envmap}} and '''<code>$phong</code>''' be masked by both '''<code>$basemapalphaphongmask</code>''' alpha channel and {{ent|$normalmapalphaenvmapmask}} alpha channel.}} |since={{src07}}|shaders=VertexLitGeneric}}
Line 64: Line 64:
:{{note|<code>$envmap</code> is also affected by these fresnel ranges if both it and Phong are enabled in a material.}}
:{{note|<code>$envmap</code> is also affected by these fresnel ranges if both it and Phong are enabled in a material.}}
:{{note| drives the x component of a phongwarptexture if specified.}}|shaders=VertexLitGeneric, LightmappedGeneric({{mapbase|only}})}}
:{{note| drives the x component of a phongwarptexture if specified.}}|shaders=VertexLitGeneric, LightmappedGeneric({{mapbase|only}})}}
{{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 {{L|$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}}


=== 色彩 ===
=== 色彩 ===
Line 73: Line 73:
{{MatParam|$phongalbedoboost|float|Phong albedo overbrightening factor. Ranges 0-255.
{{MatParam|$phongalbedoboost|float|Phong albedo overbrightening factor. Ranges 0-255.
: {{note| This will multiply the tint that is being applied to phong from $phongalbedotint.}}
: {{note| This will multiply the tint that is being applied to phong from $phongalbedotint.}}
: {{bug| This does not work when using [[$detail]]. }}|since={{csgo}}|shaders=VertexLitGeneric}}
: {{bug| This does not work when using {{L|$detail}}. }}|since={{csgo}}|shaders=VertexLitGeneric}}
[[File:Phongwarp example.png|thumb|200px|The Hunter without and with its <code>$phongwarptexture</code>, showing how it affects the Phong reflection.]]
[[File:Phongwarp example.png|thumb|200px|The Hunter without and with its <code>$phongwarptexture</code>, showing how it affects the Phong reflection.]]
{{MatParam|$phongtint|RGB matrix|Color tint of the phong reflection.
{{MatParam|$phongtint|RGB matrix|Color tint of the phong reflection.
Line 79: Line 79:
: {{note| Also tints {{ent|$rimlight}}}}|since={{src07}}|shaders=VertexLitGeneric}}
: {{note| Also tints {{ent|$rimlight}}}}|since={{src07}}|shaders=VertexLitGeneric}}
[[File:Phongwarp_coordinate_guide.png|thumb|200px|Breakdown of the $phongwarptexture: computed coordinates, texture and result]]
[[File:Phongwarp_coordinate_guide.png|thumb|200px|Breakdown of the $phongwarptexture: computed coordinates, texture and result]]
{{MatParam|$phongwarptexture|texture|Used to create an iridescence effect, as seen on Episode Two's [[npc_hunter|Hunters]].
{{MatParam|$phongwarptexture|texture|Used to create an iridescence effect, as seen on Episode Two's {{L|npc_hunter|Hunters}}.
: The highlight is multiplied with a texture. The coordinates of the sampled pixel are as follows:
: 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)
:x: 1 - (distance to the center of the highlight)
Line 99: Line 99:


== 另见 ==
== 另见 ==
* [[Phong materials|冯氏材质]]
* {{L|Phong materials|冯氏材质}}
* {{ent|$envmap}}(环境贴图)
* {{ent|$envmap}}(环境贴图)
* {{ent|$lightwarptexture}}
* {{ent|$lightwarptexture}}

Revision as of 09:41, 11 July 2024

English (en)Español (es)Русский (ru)中文 (zh)Translate (Translate)
冯氏着色器为爱莉克斯的皮肤、发带和嘴唇提供了高光。

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

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(en)>
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				[贴图]
	$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!


$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.

笔刷/固体着色器参数(存在于 CS:GO 引擎分支 之中)

$phongmaskcontrastbrightness $phongamount $phongbasetint

控制台命令

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

另见