这篇条目有关 Source引擎。如需详情,点击这里。

Zh/VertexLitGeneric: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
(deepseek translation)
Line 1: Line 1:
{{wip}}{{translating}}
{{Machine Translation}}
{{LanguageBar}}{{this is a|vertex shader|name=VertexLitGeneric}} It is the shader most commonly used to render {{L|models}}, and supports a variety of effects. Do not use this on world geometry, else you may encounter lighting bugs.
{{LanguageBar}}


== Supported Parameters ==
{{this is a|vertex shader|name=VertexLitGeneric}} 这是渲染{{L|models|模型}}最常用的着色器,支持多种特效效果。请勿用于世界几何体,否则可能引发光照错误。


=== Basics ===
== 支持参数 ==
{{MatParam|$basetexture|texture|{{L|$basetexture}} defines {{L|diffuse}} texture.}}
{{MatParam|$detail|texture|{{L|$detail|Detail}} texturing.}}
{{MatParam|$decaltexture|texture|Use a 2nd UV channel for high-resolution decal support.|only={{csgo}}}}


=== Adjustment ===
=== 基础参数 ===
{{MatParam|$color2|RGB matrix|{{L|$color#Models|Color tinting}}.}}
{{MatParam|$basetexture|texture|{{L|$basetexture}}定义{{L|diffuse|漫反射}}纹理。}}
{{MatParam|$basetexturetransform|matrix|{{L|$basetexture#.24basetexturetransform|Transform}} {{L|$basetexture}}'s alignment, scale, rotation and position.}}
{{MatParam|$detail|texture|{{L|$detail|细节}}纹理混合。}}
{{MatParam|$allowdiffusemodulation|bool|Prevents the model's material from being tinted by {{L|$color2}} or <code>rendercolor.</code>|since={{l4d}}}}
{{MatParam|$decaltexture|texture|使用第二UV通道支持高分辨率贴花。|only={{csgo}}}}
{{MatParam|$seperatedetailuvs|bool|{{todo|''Confirm use of texcoord1 for {{L|$detail|detail}} texture''}}|since={{src07}}}}
{{MatParam|$desaturatewithbasealpha|float|Use the base alpha to desaturate the base texture. Set to non-zero to enable, value gets multiplied into the alpha channel before desaturating.|since={{as}}}}
{{MatParam|$notint|bool|Prevents the model's material from being tinted by {{L|$color2}} or <code>rendercolor.</code>|only={{csgo}}|also={{P2CE}}}}


=== Transparency ===
=== 调整参数 ===
'''VertexLitGeneric''' support a few different methods for transparency, each for different purposes
{{MatParam|$color2|RGB matrix|{{L|$color#Models|颜色染色}}效果。}}
{{MatParam|$alpha|bool|{{L|$alpha}} {{L|Cheap|Cheaply}} scales the opacity of an entire material.{{confirm|Does this work in any engine branch? It does not in {{src13mp}}.}}}}
{{MatParam|$basetexturetransform|matrix|{{L|$basetexture#.24basetexturetransform|变换}}{{L|$basetexture}}的对齐、缩放、旋转和位置。}}
{{MatParam|$alphatest|bool|{{L|$alphatest}} is a {{L|Cheap}} transparency using a binary opacity mask.}}
{{MatParam|$allowdiffusemodulation|bool|阻止模型材质被{{L|$color2}}或<code>rendercolor</code>染色。|since={{l4d}}}}
{{MatParam|$nocull|bool|{{L|$nocull}} disables backface culling optimization.}}
{{MatParam|$seperatedetailuvs|bool|{{todo|''确认是否使用texcoord1处理{{L|$detail|细节}}纹理''}}|since={{src07}}}}
{{MatParam|$translucent|bool|{{L|$translucent}} is a {{L|Expensive|expensive}} translucency using a full {{L|Alpha}} mask, for very fine gradients.<br/>{{note|Add material sorting issues}}}}
{{MatParam|$desaturatewithbasealpha|float|使用基础alpha通道对基础纹理去色。非零值启用,该值在去色前与alpha通道相乘。|since={{as}}}}
{{MatParam|$additive|bool|{{L|$additive}} alike {{L|$translucent}} perform full {{L|Alpha}} mask, however it add colors instead of performing a multiplication. This renders in a always brighter material.}}
{{MatParam|$notint|bool|阻止模型材质被{{L|$color2}}或<code>rendercolor</code>染色。|only={{csgo}}|also={{P2CE}}}}
{{MatParam|$distancealpha|bool|{{L|$distancealpha}} is a vector-like edge filtering.|since={{src07}}}}


=== Lighting ===
=== 透明参数 ===
{{MatParam|$bumpmap|texture| {{L|Bump_map|Normal map}}.}}
'''VertexLitGeneric'''支持多种透明处理方式:
{{MatParam|$lightwarptexture|texture|1 dimension Per-texel color modification via a {{L|$lightwarptexture|warp texture}}.|since={{src06}}}}
{{MatParam|$alpha|bool|{{L|$alpha}}通过{{L|Cheap|低开销}}方式整体调节材质透明度。{{confirm|该参数在所有引擎分支是否有效?在{{src13mp}}中无效}}}}
{{MatParam|$halflambert|bool|Use {{L|$halflambert|Half-lambertian}} shading.}}
{{MatParam|$alphatest|bool|{{L|$alphatest}}使用{{L|Cheap}}二值化透明遮罩。}}
{{MatParam|$selfillum|bool|Determines whether the surface is {{L|Glowing_Textures#.24selfillum|self-illuminated}} independent of environment lighting.}}
{{MatParam|$nocull|bool|{{L|$nocull}}禁用背面剔除优化。}}
{{MatParam|$emissiveblendenabled|bool|{{L|Glowing_Textures#.24emissiveblend|Advanced flowing self-illumination}}, used on the {{L|Vortigaunt|Vortigaunts}} in {{Game link|Half-Life 2: Episode Two}}.|since={{src07}}}}
{{MatParam|$translucent|bool|{{L|$translucent}}通过完整{{L|Alpha|透明通道}}实现{{L|Expensive|高开销}}半透明,适用于精细渐变。<br/>{{note|可能引发材质排序问题}}}}
{{MatParam|$lightmap|texture|Pre-baked {{L|lightmap}}; subject to {{L|$lightmap#Limitations_and_caveats|limitations}}.|only={{src13mp}}|also={{gmod}}}}
{{MatParam|$additive|bool|{{L|$additive}}类似{{L|$translucent}}但采用加法混合,始终呈现更亮效果。}}
{{MatParam|$distancealpha|bool|{{L|$distancealpha}}实现矢量式边缘过滤。|since={{src07}}}}


=== Reflection ===
=== 光照参数 ===
{{MatParam|$envmap|texture|{{L|$envmap|Specular reflections}}.}}
{{MatParam|$bumpmap|texture| {{L|Bump_map|法线贴图}}}}
{{MatParam|$phong|bool|{{L|$phong|Diffuse reflections}}.|since={{src06}}}}
{{MatParam|$lightwarptexture|texture|通过一维{{L|$lightwarptexture|扭曲纹理}}实现逐像素颜色调整。|since={{src06}}}}
{{MatParam|$rimlight|bool|Constant {{L|$rimlight|rimlight}} based on {{L|phong}} and the ambient lighting.|since={{src07}}}}
{{MatParam|$halflambert|bool|启用{{L|$halflambert|半兰伯特}}着色。}}
{{MatParam|$selfillum|bool|启用{{L|Glowing_Textures#.24selfillum|自发光}}效果(不受环境光照影响)。}}
{{MatParam|$emissiveblendenabled|bool|{{L|Glowing_Textures#.24emissiveblend|高级流动自发光}}效果,曾用于{{Game link|Half-Life 2: Episode Two}}中的{{L|Vortigaunt|弗提冈}}。|since={{src07}}}}
{{MatParam|$lightmap|texture|预烘焙{{L|lightmap|光照贴图}};受{{L|$lightmap#Limitations_and_caveats|限制条件}}约束。|only={{src13mp}}|also={{gmod}}}}


=== Effect ===
=== 反射参数 ===
{{MatParam|$compress|texture|{{L|Wrinkle_maps#Materials_and_textures|Wrinklemaps}} for character faces.|since={{src07}}}}
{{MatParam|$envmap|texture|{{L|$envmap|镜面反射}}效果。}}
{{MatParam|$stretch|texture|{{L|Wrinkle_maps#Materials_and_textures|Wrinklemaps}} for character faces.|since={{src07}}}}
{{MatParam|$phong|bool|{{L|$phong|漫反射}}效果。|since={{src06}}}}
{{MatParam|$flesh|bool|The {{L|$flesh|flesh}} effect used for Alyx in Half-Life 2: Episode Two.|since={{src07}}}}
{{MatParam|$rimlight|bool|基于{{L|phong}}和环境光的恒定{{L|$rimlight|边缘光}}|since={{src07}}}}
{{MatParam|$treeSway|bool|Vertex manipulation to give the effect of {{L|$treeSway|trees swaying}} in the wind.|since={{l4d}}|also={{tf2}}{{mapbase}}{{gmod}}{{bms}}}}


=== Technical Workarounds ===
=== 特效参数 ===
{{MatParam|$flashlightnolambert|bool|Tell {{L|env_projectedtexture|projected textures}} such as the flashlight to ignore the surface normal of the model. Useful for models with {{ent|$nocull}} such as foilage. Otherwise, lighting the face with a flashlight from behind will not affect it. ''Default 0''.|since={{src07}}}}
{{MatParam|$compress|texture|角色面部的{{L|Wrinkle_maps#Materials_and_textures|皱纹贴图}}|since={{src07}}}}
{{MatParam|$lowqualityflashlightshadows|bool|Force low quality flashlight/projected texture shadows for faster performance.|since={{portal2}}}}
{{MatParam|$stretch|texture|角色面部的{{L|Wrinkle_maps#Materials_and_textures|皱纹贴图}}。|since={{src07}}}}
{{MatParam|$allowfencerenderstatehack|bool|Fence render hack for cascade shadow maps, allows shadow maps to work properly with fences.|since={{csgo}}}}
{{MatParam|$flesh|bool|用于《半衰期2:第二章》艾丽克斯的{{L|$flesh|皮肤}}特效。|since={{src07}}}}
{{MatParam|$disablecsmlookup|bool|Disable cascade shadow map lookup/filtering, useful on dense foilage.|since={{csgo}}}}
{{MatParam|$treeSway|bool|通过顶点操作实现{{L|$treeSway|树木随风摆动}}效果。|since={{l4d}}|also={{tf2}}{{mapbase}}{{gmod}}{{bms}}}}
{{MatParam|$noshadowpass|bool|Allows turning off the shadow pass of this material.|only={{lw}}}}
{{MatParam|$nodeferredlight|bool|No deferred light input.|only={{lw}}}}
{{MatParam|$modelglobalnormal|bool|Use global light direction as normal for all model vertices.|only={{lw}}}}


===Cloak===
=== 技术调整 ===
{{MatParam|$flashlightnolambert|bool|使{{L|env_projectedtexture|投影纹理}}(如手电筒)忽略模型表面法线。适用于{{ent|$nocull}}模型(如植被)。默认0。|since={{src07}}}}
{{MatParam|$lowqualityflashlightshadows|bool|强制低质量手电筒/投影纹理阴影以提升性能。|since={{portal2}}}}
{{MatParam|$allowfencerenderstatehack|bool|针对级联阴影映射的栅栏渲染修正。|since={{csgo}}}}
{{MatParam|$disablecsmlookup|bool|禁用级联阴影映射查询/过滤,适用于密集植被。|since={{csgo}}}}
{{MatParam|$noshadowpass|bool|禁用该材质的阴影渲染阶段。|only={{lw}}}}
{{MatParam|$nodeferredlight|bool|禁用延迟光照输入。|only={{lw}}}}
{{MatParam|$modelglobalnormal|bool|为所有模型顶点使用全局光源方向作为法线。|only={{lw}}}}


<code>VertexLitGeneric</code> natively supports the Spy cloak effect from {{Game link|Team Fortress 2}}. Combine it with a sine wave {{L|Material Proxies|proxy}} for the full effect.
=== 隐身效果 ===


{{MatParam|$cloakpassenabled|bool|Enables cloaking effects. {{warning|Enabling this on static props causes a heavy performance penalty, even if the cloak effect itself isn't being used!}}}}
<code>VertexLitGeneric</code>原生支持{{Game link|Team Fortress 2}}中间谍隐身特效。结合正弦波{{L|Material Proxies|材质代理}}可实现完整效果。
{{MatParam|$cloakfactor|normal|0.00 {{=}} fully visible,<br/>
1.00 {{=}} fully invisible.}}
{{MatParam|$cloakcolortint|RGB matrix|Colors the refraction effect. ''Default " [ 1 1 1 ] "''.}}
{{MatParam|$refractamount|float|How strong the refraction effect should be when the material is partially cloaked. ''Default 2''.}}


== Caveats ==
{{MatParam|$cloakpassenabled|bool|启用隐身效果。{{warning|在静态道具上启用会导致严重性能损耗,即使未实际使用隐身效果!}}}}
{{MatParam|$cloakfactor|normal|0.00 {{=}} 完全可见,<br/>
1.00 {{=}} 完全不可见。}}
{{MatParam|$cloakcolortint|RGB matrix|折射效果染色。默认值"[1 1 1]"。}}
{{MatParam|$refractamount|float|部分隐身时的折射强度。默认值2。}}


=== Mapbase ===
== 注意事项 ==
VertexLitGeneric materials in {{L|Mapbase}} should have the shader '''<code>SDK_VertexLitGeneric</code>'''.


== See also ==
=== Mapbase扩展 ===
* {{L|Materials_for_models#Compiling_your.VMT_:_Valve_Material_Type|Materials for models}}
{{L|Mapbase}}中的VertexLitGeneric材质应使用'''<code>SDK_VertexLitGeneric</code>'''着色器。
*{{ent|EyeRefract}}, the shader for modeled eyes.
 
*{{ent|Teeth}}, the shader for modeled teeth.
== 相关链接 ==
* {{L|Materials_for_models#Compiling_your.VMT_:_Valve_Material_Type|模型材质指南}}
*{{ent|EyeRefract}}(眼球折射着色器)
*{{ent|Teeth}}(牙齿着色器)

Revision as of 03:25, 24 April 2025

Info content.png
This page is Machine translated
It is not recommended to use machine translation without any corrections.
If the article is not corrected in the long term, it will be removed.
Also, please make sure the article complies with the alternate languages guide.(en)
English (en)Français (fr)中文 (zh)Translate (Translate)
Info content.png
This page is Machine translated
It is not recommended to use machine translation without any corrections.
If the article is not corrected in the long term, it will be removed.
Also, please make sure the article complies with the alternate languages guide.(en)
This notice is put here by LanguageBar template and if you want to remove it after updating the translation you can do so on this page.


VertexLitGeneric是一个顶点着色器(en),可在所有的 起源 起源 游戏中使用。 这是渲染模型(en)最常用的着色器,支持多种特效效果。请勿用于世界几何体,否则可能引发光照错误。

支持参数

基础参数

$basetexture $detail $decaltexture

调整参数

$color2 $basetexturetransform $allowdiffusemodulation $seperatedetailuvs $desaturatewithbasealpha $notint

透明参数

VertexLitGeneric支持多种透明处理方式: $alpha $alphatest $nocull $translucent $additive $distancealpha

光照参数

$bumpmap $lightwarptexture $halflambert $selfillum $emissiveblendenabled $lightmap

反射参数

$envmap $phong $rimlight

特效参数

$compress $stretch $flesh $treeSway

技术调整

$flashlightnolambert $lowqualityflashlightshadows $allowfencerenderstatehack $disablecsmlookup $noshadowpass $nodeferredlight $modelglobalnormal

隐身效果

VertexLitGeneric原生支持军团要塞2 Team Fortress 2 中间谍隐身特效。结合正弦波材质代理(en)可实现完整效果。

$cloakpassenabled $cloakfactor $cloakcolortint $refractamount

注意事项

Mapbase扩展

Mapbase(en)中的VertexLitGeneric材质应使用SDK_VertexLitGeneric着色器。

相关链接