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

Zh/VertexLitGeneric: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(Created page with "{{subst:#if: Translation of 'VertexLitGeneric' to '中文' via Template:LanguageBar buttons * * * * * * * * * * * * * * * * * * * * * * * * * * * *...")
 
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{subst:#if:|||{{LAuto/t}}
{{LanguageBar}}


--- DON'T JUST BLINDLY DELETE THIS PART. DO REPLACE THE LINKS AND CATEGORIES. THE PICTURE SHOWS HOW TO USE IT ! ---
{{this is a|vertex shader|name=VertexLitGeneric}} 这是渲染{{L|models|模型}}最常用的着色器,支持多种特效效果。请勿用于世界几何体,否则可能引发光照错误。


SEARCH FOR:
== 支持参数 ==
\[\[(?!#|File(?:[ _]talk)?:|Image(?:[ _]talk)?:|Media:|Template(?:[ _]talk)?:|MediaWiki(?:[ _]talk)?:|Talk:|Category[ _]talk:|Project[ _]talk:|Valve[ _]Developer[ _]Community[ _]talk:|Help[ _]talk:|User(?:[ _]talk)?:|c:|commons:|Dictionary:|Google:|GoogleGroups:|IMDB:|M:|Meta:|Metawikipedia:|MW:|SdkBug:|SourceForge:|Steampowered:|W:|Wiki:|WikiBooks:|Wikipedia:|Wikiquote:|Wiktionary:|WP:)(:?(?:Category|Category|Help|Project|Valve[ _]Developer[ _]Community|Special|)(?:[^\|\]]+))(\|?.*?)\]\]


REPLACE WITH:
=== 基础参数 ===
{{subst:LAuto|$1$2}}
{{MatParamDef|$basetexture|texture|{{L|$basetexture}}定义{{L|diffuse|漫反射}}纹理。}}
{{MatParamDef|$detail|texture|{{L|$detail|细节}}纹理混合。}}
{{MatParamDef|$decaltexture|texture|使用第二UV通道支持高分辨率贴花。|only={{csgo}}}}


}}{{wip}}{{translating}}
=== 调整参数 ===
{{LanguageBar}}{{this is a|vertex shader|name=VertexLitGeneric}} It is the shader most commonly used to render [[models|models]], and supports a variety of effects. Do not use this on world geometry, else you may encounter lighting bugs.
{{MatParamDef|$color2|RGB matrix|{{L|$color#Models|颜色染色}}效果。}}
{{MatParamDef|$basetexturetransform|matrix|{{L|$basetexture#.24basetexturetransform|变换}}{{L|$basetexture}}的对齐、缩放、旋转和位置。}}
{{MatParamDef|$allowdiffusemodulation|bool|阻止模型材质被{{L|$color2}}或<code>rendercolor</code>染色。|since={{l4d}}}}
{{MatParamDef|$seperatedetailuvs|bool|{{todo|''确认是否使用texcoord1处理{{L|$detail|细节}}纹理''}}|since={{src07}}}}
{{MatParamDef|$desaturatewithbasealpha|float|使用基础alpha通道对基础纹理去色。非零值启用,该值在去色前与alpha通道相乘。|since={{as}}}}
{{MatParamDef|$notint|bool|阻止模型材质被{{L|$color2}}或<code>rendercolor</code>染色。|only={{csgo}}|also={{P2CE}}}}


== Supported Parameters ==
=== 透明参数 ===
'''VertexLitGeneric'''支持多种透明处理方式:
{{MatParamDef|$alpha|bool|{{L|$alpha}}通过{{L|Cheap|低开销}}方式整体调节材质透明度。{{confirm|该参数在所有引擎分支是否有效?在{{src13mp}}中无效}}}}
{{MatParamDef|$alphatest|bool|{{L|$alphatest}}使用{{L|Cheap}}二值化透明遮罩。}}
{{MatParamDef|$nocull|bool|{{L|$nocull}}禁用背面剔除优化。}}
{{MatParamDef|$translucent|bool|{{L|$translucent}}通过完整{{L|Alpha|透明通道}}实现{{L|Expensive|高开销}}半透明,适用于精细渐变。<br/>{{note|可能引发材质排序问题}}}}
{{MatParamDef|$additive|bool|{{L|$additive}}类似{{L|$translucent}}但采用加法混合,始终呈现更亮效果。}}
{{MatParamDef|$distancealpha|bool|{{L|$distancealpha}}实现矢量式边缘过滤。|since={{src07}}}}


=== Basics ===
=== 光照参数 ===
{{MatParam|$basetexture|texture|[[$basetexture]] defines [[diffuse]] texture.}}
{{MatParamDef|$bumpmap|texture| {{L|Bump_map|法线贴图}}。}}
{{MatParam|$detail|texture|[[$detail|Detail]] texturing.}}
{{MatParamDef|$lightwarptexture|texture|通过一维{{L|$lightwarptexture|扭曲纹理}}实现逐像素颜色调整。|since={{src06}}}}
{{MatParam|$decaltexture|texture|Use a 2nd UV channel for high-resolution decal support.|only={{csgo}}}}
{{MatParamDef|$halflambert|bool|启用{{L|$halflambert|半兰伯特}}着色。}}
{{MatParamDef|$selfillum|bool|启用{{L|Glowing_Textures#.24selfillum|自发光}}效果(不受环境光照影响)。}}
{{MatParamDef|$emissiveblendenabled|bool|{{L|Glowing_Textures#.24emissiveblend|高级流动自发光}}效果,曾用于{{Game link|Half-Life 2: Episode Two}}中的{{L|Vortigaunt|弗提冈}}。|since={{src07}}}}
{{MatParamDef|$lightmap|texture|预烘焙{{L|lightmap|光照贴图}};受{{L|$lightmap#Limitations_and_caveats|限制条件}}约束。|only={{src13mp}}|also={{gmod}}}}


=== Adjustment ===
=== 反射参数 ===
{{MatParam|$color2|RGB matrix|[[$color#Models|Color tinting]].}}
{{MatParamDef|$envmap|texture|{{L|$envmap|镜面反射}}效果。}}
{{MatParam|$basetexturetransform|matrix|[[$basetexture#.24basetexturetransform|Transform]] [[$basetexture]]'s alignment, scale, rotation and position.}}
{{MatParamDef|$phong|bool|{{L|$phong|漫反射}}效果。|since={{src06}}}}
{{MatParam|$allowdiffusemodulation|bool|Prevents the model's material from being tinted by [[$color2]] or <code>rendercolor.</code>|since={{l4d}}}}
{{MatParamDef|$rimlight|bool|基于{{L|phong}}和环境光的恒定{{L|$rimlight|边缘光}}|since={{src07}}}}
{{MatParam|$seperatedetailuvs|bool|{{todo|''Confirm use of texcoord1 for [[$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 [[$color2]] or <code>rendercolor.</code>|only={{csgo}}|also={{P2CE}}}}


=== Transparency ===
=== 特效参数 ===
'''VertexLitGeneric''' support a few different methods for transparency, each for different purposes
{{MatParamDef|$compress|texture|角色面部的{{L|Wrinkle_maps#Materials_and_textures|皱纹贴图}}。|since={{src07}}}}
{{MatParam|$alpha|bool|[[$alpha]] [[Cheap|Cheaply]] scales the opacity of an entire material.{{confirm|Does this work in any engine branch? It does not in {{src13mp}}.}}}}
{{MatParamDef|$stretch|texture|角色面部的{{L|Wrinkle_maps#Materials_and_textures|皱纹贴图}}。|since={{src07}}}}
{{MatParam|$alphatest|bool|[[$alphatest]] is a [[Cheap]] transparency using a binary opacity mask.}}
{{MatParamDef|$flesh|bool|用于《半衰期2:第二章》艾丽克斯的{{L|$flesh|皮肤}}特效。|since={{src07}}}}
{{MatParam|$nocull|bool|[[$nocull]] disables backface culling optimization.}}
{{MatParamDef|$treeSway|bool|通过顶点操作实现{{L|$treeSway|树木随风摆动}}效果。|since={{l4d}}|also={{tf2}}{{mapbase}}{{gmod}}{{bms}}}}
{{MatParam|$translucent|bool|[[$translucent]] is a [[Expensive|expensive]] translucency using a full [[Alpha]] mask, for very fine gradients.<br/>{{note|Add material sorting issues}}}}
{{MatParam|$additive|bool|[[$additive]] alike [[$translucent]] perform full [[Alpha]] mask, however it add colors instead of performing a multiplication. This renders in a always brighter material.}}
{{MatParam|$distancealpha|bool|[[$distancealpha]] is a vector-like edge filtering.|since={{src07}}}}


=== Lighting ===
=== 技术调整 ===
{{MatParam|$bumpmap|texture| [[Bump_map|Normal map]].}}
{{MatParamDef|$flashlightnolambert|bool|使{{L|env_projectedtexture|投影纹理}}(如手电筒)忽略模型表面法线。适用于{{ent|$nocull}}模型(如植被)。默认0。|since={{src07}}}}
{{MatParam|$lightwarptexture|texture|1 dimension Per-texel color modification via a [[$lightwarptexture|warp texture]].|since={{src06}}}}
{{MatParamDef|$lowqualityflashlightshadows|bool|强制低质量手电筒/投影纹理阴影以提升性能。|since={{portal2}}}}
{{MatParam|$halflambert|bool|Use [[$halflambert|Half-lambertian]] shading.}}
{{MatParamDef|$allowfencerenderstatehack|bool|针对级联阴影映射的栅栏渲染修正。|since={{csgo}}}}
{{MatParam|$selfillum|bool|Determines whether the surface is [[Glowing_Textures#.24selfillum|self-illuminated]] independent of environment lighting.}}
{{MatParamDef|$disablecsmlookup|bool|禁用级联阴影映射查询/过滤,适用于密集植被。|since={{csgo}}}}
{{MatParam|$emissiveblendenabled|bool|[[Glowing_Textures#.24emissiveblend|Advanced flowing self-illumination]], used on the [[Vortigaunt|Vortigaunts]] in {{Game link|Half-Life 2: Episode Two}}.|since={{src07}}}}
{{MatParamDef|$noshadowpass|bool|禁用该材质的阴影渲染阶段。|only={{lw}}}}
{{MatParam|$lightmap|texture|Pre-baked [[lightmap]]; subject to [[$lightmap#Limitations_and_caveats|limitations]].|only={{src13mp}}|also={{gmod}}}}
{{MatParamDef|$nodeferredlight|bool|禁用延迟光照输入。|only={{lw}}}}
{{MatParamDef|$modelglobalnormal|bool|为所有模型顶点使用全局光源方向作为法线。|only={{lw}}}}


=== Reflection ===
=== 隐身效果 ===
{{MatParam|$envmap|texture|[[$envmap|Specular reflections]].}}
{{MatParam|$phong|bool|[[$phong|Diffuse reflections]].|since={{src06}}}}
{{MatParam|$rimlight|bool|Constant [[$rimlight|rimlight]] based on [[phong]] and the ambient lighting.|since={{src07}}}}


=== Effect ===
<code>VertexLitGeneric</code>原生支持{{Game link|Team Fortress 2}}中间谍隐身特效。结合正弦波{{L|Material Proxies|材质代理}}可实现完整效果。
{{MatParam|$compress|texture|[[Wrinkle_maps#Materials_and_textures|Wrinklemaps]] for character faces.|since={{src07}}}}
{{MatParam|$stretch|texture|[[Wrinkle_maps#Materials_and_textures|Wrinklemaps]] for character faces.|since={{src07}}}}
{{MatParam|$flesh|bool|The [[$flesh|flesh]] effect used for Alyx in Half-Life 2: Episode Two.|since={{src07}}}}
{{MatParam|$treeSway|bool|Vertex manipulation to give the effect of [[$treeSway|trees swaying]] in the wind.|since={{l4d}}|also={{tf2}}{{mapbase}}{{gmod}}{{bms}}}}


=== Technical Workarounds ===
{{MatParamDef|$cloakpassenabled|bool|启用隐身效果。{{warning|在静态道具上启用会导致严重性能损耗,即使未实际使用隐身效果!}}}}
{{MatParam|$flashlightnolambert|bool|Tell [[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}}}}
{{MatParamDef|$cloakfactor|normal|0.00 {{=}} 完全可见,<br/>
{{MatParam|$lowqualityflashlightshadows|bool|Force low quality flashlight/projected texture shadows for faster performance.|since={{portal2}}}}
1.00 {{=}} 完全不可见。}}
{{MatParam|$allowfencerenderstatehack|bool|Fence render hack for cascade shadow maps, allows shadow maps to work properly with fences.|since={{csgo}}}}
{{MatParamDef|$cloakcolortint|RGB matrix|折射效果染色。默认值"[1 1 1]"。}}
{{MatParam|$disablecsmlookup|bool|Disable cascade shadow map lookup/filtering, useful on dense foilage.|since={{csgo}}}}
{{MatParamDef|$refractamount|float|部分隐身时的折射强度。默认值2。}}
{{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===
== 注意事项 ==


<code>VertexLitGeneric</code> natively supports the Spy cloak effect from {{Game link|Team Fortress 2}}. Combine it with a sine wave [[Material Proxies|proxy]] for the full effect.
=== Mapbase扩展 ===
{{L|Mapbase}}中的VertexLitGeneric材质应使用'''<code>SDK_VertexLitGeneric</code>'''着色器。


{{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!}}}}
== 相关链接 ==
{{MatParam|$cloakfactor|normal|0.00 {{=}} fully visible,<br/>
* {{L|Materials_for_models#Compiling_your.VMT_:_Valve_Material_Type|模型材质指南}}
1.00 {{=}} fully invisible.}}
*{{ent|EyeRefract}}(眼球折射着色器)
{{MatParam|$cloakcolortint|RGB matrix|Colors the refraction effect. ''Default " [ 1 1 1 ] "''.}}
*{{ent|Teeth}}(牙齿着色器)
{{MatParam|$refractamount|float|How strong the refraction effect should be when the material is partially cloaked. ''Default 2''.}}
 
== Caveats ==
 
=== Mapbase ===
VertexLitGeneric materials in [[Mapbase]] should have the shader '''<code>SDK_VertexLitGeneric</code>'''.
 
== See also ==
* [[Materials_for_models#Compiling_your.VMT_:_Valve_Material_Type|Materials for models]]
*{{ent|EyeRefract}}, the shader for modeled eyes.
*{{ent|Teeth}}, the shader for modeled teeth.

Latest revision as of 12:10, 23 August 2025

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)最常用的着色器,支持多种特效效果。请勿用于世界几何体,否则可能引发光照错误。

支持参数

基础参数

细节(en)纹理混合。
$decaltexture(en) <texture(en)> (存在于 反恐精英:全球攻势 之中)
使用第二UV通道支持高分辨率贴花。

调整参数

变换(en)$basetexture(en)的对齐、缩放、旋转和位置。
$allowdiffusemodulation(en) <布尔值(en)> (存在于自 求生之路 以来)
阻止模型材质被$color2(en)rendercolor染色。
$seperatedetailuvs(en) <布尔值(en)> (存在于自 起源2007 以来)
待完善: 确认是否使用texcoord1处理细节(en)纹理
$desaturatewithbasealpha(en) <浮点型(en)> (存在于自 异形丛生 以来)
使用基础alpha通道对基础纹理去色。非零值启用,该值在去色前与alpha通道相乘。
$notint(en) <布尔值(en)> (存在于 反恐精英:全球攻势 之中) (也存在于 传送门 2:社区特供版 之中)
阻止模型材质被$color2(en)rendercolor染色。

透明参数

VertexLitGeneric支持多种透明处理方式:

$alpha(en)通过低开销(en)方式整体调节材质透明度。
证实:该参数在所有引擎分支是否有效?在起源2013 多人分支中无效
$alphatest(en)使用Cheap(en)二值化透明遮罩。
$nocull(en)禁用背面剔除优化。
$translucent(en)通过完整透明通道(en)实现高开销(en)半透明,适用于精细渐变。
Note.png注意:可能引发材质排序问题
$additive(en)类似$translucent(en)但采用加法混合,始终呈现更亮效果。
$distancealpha(en) <布尔值(en)> (存在于自 起源2007 以来)
$distancealpha(en)实现矢量式边缘过滤。

光照参数

$lightwarptexture(en) <texture(en)> (存在于自 起源2006 以来)
通过一维扭曲纹理(en)实现逐像素颜色调整。
启用半兰伯特(en)着色。
启用自发光(en)效果(不受环境光照影响)。
$emissiveblendenabled(en) <布尔值(en)> (存在于自 起源2007 以来)
$lightmap(en) <texture(en)> (存在于 起源2013 多人分支 之中) (也存在于 Garry's Mod 之中)
预烘焙光照贴图(en);受限制条件(en)约束。

反射参数

$phong(en) <布尔值(en)> (存在于自 起源2006 以来)
漫反射(en)效果。
$rimlight(en) <布尔值(en)> (存在于自 起源2007 以来)
基于phong(en)和环境光的恒定边缘光(en)

特效参数

$compress(en) <texture(en)> (存在于自 起源2007 以来)
角色面部的皱纹贴图(en)
$stretch(en) <texture(en)> (存在于自 起源2007 以来)
角色面部的皱纹贴图(en)
$flesh(en) <布尔值(en)> (存在于自 起源2007 以来)
用于《半衰期2:第二章》艾丽克斯的皮肤(en)特效。
$treeSway(en) <布尔值(en)> (存在于自 求生之路 以来) (也存在于 军团要塞2MapbaseGarry's Mod黑山 之中)
通过顶点操作实现树木随风摆动(en)效果。

技术调整

$flashlightnolambert(en) <布尔值(en)> (存在于自 起源2007 以来)
使投影纹理(en)(如手电筒)忽略模型表面法线。适用于$nocull模型(如植被)。默认0。
$lowqualityflashlightshadows(en) <布尔值(en)> (存在于自 传送门2 以来)
强制低质量手电筒/投影纹理阴影以提升性能。
$allowfencerenderstatehack(en) <布尔值(en)> (存在于自 反恐精英:全球攻势 以来)
针对级联阴影映射的栅栏渲染修正。
$disablecsmlookup(en) <布尔值(en)> (存在于自 反恐精英:全球攻势 以来)
禁用级联阴影映射查询/过滤,适用于密集植被。
$noshadowpass(en) <布尔值(en)> (存在于 Lambda Wars 之中)
禁用该材质的阴影渲染阶段。
$nodeferredlight(en) <布尔值(en)> (存在于 Lambda Wars 之中)
禁用延迟光照输入。
$modelglobalnormal(en) <布尔值(en)> (存在于 Lambda Wars 之中)
为所有模型顶点使用全局光源方向作为法线。

隐身效果

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

启用隐身效果。
Warning.png警告:在静态道具上启用会导致严重性能损耗,即使未实际使用隐身效果!
0.00 = 完全可见,
1.00 = 完全不可见。
折射效果染色。默认值"[1 1 1]"。
部分隐身时的折射强度。默认值2。

注意事项

Mapbase扩展

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

相关链接