Zh/$phong: Difference between revisions
< Zh
Jump to navigation
Jump to search
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|镜面高光}},由控制每个纹素强度的纹理遮罩。有关完整解释,请参见 | 它提供低强度的 {{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 < | $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 | {{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 | {{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 | {{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 | : {{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 | {{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: | ||
== 另见 == | == 另见 == | ||
* | * {{L|Phong materials|冯氏材质}} | ||
* {{ent|$envmap}}(环境贴图) | * {{ent|$envmap}}(环境贴图) | ||
* {{ent|$lightwarptexture}} | * {{ent|$lightwarptexture}} |
Revision as of 09:41, 11 July 2024
它提供低强度的 漫反射 和顶点强度的
镜面高光,由控制每个纹素强度的纹理遮罩。有关完整解释,请参见 冯氏材质 。

LightmappedGeneric
和 WorldVertexTransition
的冯氏着色功能只在 


LightmappedGeneric
的冯氏着色功能,但实现方式有所不同。语法
$phong <bool >


- 待完善: 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]"
}
参数
蒙版

- Using $selfillumfresnel without $normalmapalphaenvmapmask will mask the $envmap using the $basetexture's alpha channel.
- Using $selfillumfresnel with $normalmapalphaenvmapmask will multiply the $envmap by
0.0f
. Effectively disabling the effect! - When not using $selfillumfresnel. The mask used for $envmap will be the $basetexture's alpha channel unless $normalmapalphaenvmapmask is also used.
- If $normalmapalphaenvmapmask is used, the $bumpmap's alpha channel will be used for Phong masking. Using either
$basemapalphaphongmask
or$basemapluminancephongmask
will override it.
$bumpmap
$basemapalphaphongmask
$basemapluminancephongmask
$phongexponent
$phongexponenttexture
$phongexponentfactor
$invertphongmask
$forcephong
$diffuseexp
$shinyblood
$shinybloodexponent
亮度
$phongboost
$phongfresnelranges
$phongdisablehalflambert
色彩
$phongalbedotint
$phongalbedoboost

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

笔刷/固体着色器参数(仅存在于
之中)
$phongmaskcontrastbrightness
$phongamount
$phongbasetint
控制台命令
- mat_phong <布尔值 >
- 禁用或启用冯氏反射渲染。默认为 1。