Zh/$detail: Difference between revisions
(deepseek translation) Tag: Reverted |
(→参数和效果) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{LanguageBar}} | {{LanguageBar}} | ||
{{Source topicon}} | {{Source topicon}} | ||
{{toc-right}} | {{toc-right}} | ||
{{tabsBar|main=detail textures}} | {{tabsBar|main=detail textures}} | ||
[[File:Detail.jpg|frame|right| | [[File:Detail.jpg|frame|right|一个细节纹理(noise_detail_01),以及将其应用到材质(brickwall031a)后的效果。]] | ||
{{this is a|shader parameter|name=$detail}} | {{this is a|shader parameter|name=$detail}} 指定了一个{{L|texture|纹理}},当材质被近距离观察时,Source引擎将使用它通过适当地加深或减轻{{L|albedo|反照率}}来增加材质的高分辨率细节,具体取决于<tt>$detailblendmode</tt>。您还可以使用全彩色(而非灰度)图像,并通过{{Code|$detailblendmode 2}}进行混合。这种方法非常有效,可以增加纹理的表观分辨率,并广泛应用于{{L|hl2ep2|半衰期2:第二章}}以及{{L|portal2|传送门2}}中的白瓷砖纹理凸起效果。 | ||
{{Bug| {{Code|$detail}} | {{Bug| {{Code|$detail}}纹理在与某些参数结合时不起作用: | ||
* 在{{as}}{{csgo}}{{src13}}{{tf2}} | * 在{{as}}{{csgo}}{{src13}}{{tf2}}中,使用{{ent|LightmappedGeneric}}时,与{{ent|$seamless_scale}}不兼容。 | ||
* 在{{as}}{{csgo}}{{src13}}{{tf2}} | * 在{{as}}{{csgo}}{{src13}}{{tf2}}中,使用{{ent|VertexLitGeneric}}时,与{{ent|$selfillumfresnel}}不兼容(如果使用了{{ent|$bumpmap}})。 | ||
* 在{{as}}{{src13}}{{tf2}} | * 在{{as}}{{src13}}{{tf2}}中,使用{{ent|LightmappedGeneric}}时,与{{ent|$lightwarptexture}}不兼容。 | ||
}} | }} | ||
: {{Note|<span><!-- | : {{Note|<span><!-- 这是为了修正列表 --></span> | ||
:* 在{{csgo}}中,{{ent|LightmappedGeneric}} | :* 在{{csgo}}中,{{ent|LightmappedGeneric}}似乎根本没有{{ent|$lightwarptexture}}参数,因此不能“不起作用”。 | ||
:* 在{{as}}{{csgo}} | :* 在{{as}}{{csgo}}中,使用{{ent|VertexLitGeneric}}时,与{{ent|$desaturatewithbasealpha}}不兼容。 | ||
:* 在{{as}} | :* 在{{as}}中,与{{ent|$blendmodulatetexture}}'''和'''{{ent|$bumpmap}}不兼容。 | ||
}} | }} | ||
: {{Todo| | : {{Todo|记录其他Source分支的相关问题。}} | ||
: {{ModernConfirm| 在{{as}} | : {{ModernConfirm|在{{as}}中不起作用的内容,通常在{{l4d}}中也不起作用,反之亦然。但如果有人能确认这一点会更好。}} | ||
: {{bug| | : {{bug|在使用{{Code|$detail}}和{{ent|$blendmodulatetexture}}时会导致图形问题(表面出现条纹),仅在{{csgo}}和{{GMOD}}中能正常工作。}} | ||
== 语法 == | == 语法 == | ||
Line 29: | Line 28: | ||
$detail <texture> | $detail <texture> | ||
您可能需要至少使用<code>$detailscale</code>(详见下文)。 | |||
== | == 参数和效果 == | ||
{{ | {{MatParamDef | ||
| $detailtexturetransform|matrix|dx9 = 1 | | $detailtexturetransform|matrix|dx9 = 1 | ||
| | | 旋转、缩放等操作细节纹理。{{VMT UVtransform}} | ||
{{Bug| | {{Bug|此参数在{{ent|LightmappedGeneric}}、{{ent|WorldVertexTransition}}、{{ent|LightmappedTwoTexture}}、{{ent|WorldTwoTextureBlend}}以及仅限{{only|{{csgo}}}}的{{ent|Lightmapped_4WayBlend}}中不存在。}} | ||
{{Bug| | {{Bug|与{{ent|$treesway}}不兼容。}} | ||
}} | }} | ||
{{ | {{MatParamDef | ||
|$detailscale| float | |$detailscale| float | ||
| | | 将细节纹理缩放到材质上的次数(默认值为4)。通常会用一个值约为7或8代替<code>$detailtexturetransform</code>,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:<code>$detailscale "[ 4 8 ]"</code> | ||
}} | }} | ||
{{ | {{MatParamDef | ||
|$detailblendfactor|normal| | |$detailblendfactor|normal| | ||
控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于[[$alpha]]。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。 | |||
{{bug| | {{bug|对<code>$detailblendmode</code>为1或5的[[UnlitGeneric]]无效(在{{dods}}中测试)。}} | ||
}} | }} | ||
{{ | {{MatParamDef | ||
|$detailblendmode| int | |$detailblendmode|int|text=细节材质与漫反射或反照率的结合方式。 | ||
| | : 可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。 | ||
: | : 混合模式在{{Path|stdshaders/common_ps_fxc|h}}中实现。 | ||
: | |||
[[File:Detail_blend_modes_l4d2.jpg||320px|thumb|right|L4D2中的混合模式,系数为0.8(从左到右依次为模式0到11,仅基础纹理和仅细节纹理。顶部行细节不透明度100%,底部行50%)。]] | |||
{{Table | {{Table | ||
Line 65: | Line 64: | ||
| {{td| 0 |dark=1}} | | {{td| 0 |dark=1}} | ||
{{td| DecalModulate }} | {{td| DecalModulate }} | ||
{{td| | {{td| 此模式与{{L|DecalModulate|DecalModulate着色器}}功能相同——颜色低于128会使图像变暗,高于128会使图像变亮。 | ||
{{tip|使用{{vtex|2}}的{{mono|mipblend}} | {{tip|使用{{vtex|2}}的{{mono|mipblend}}选项,可以让使用此混合模式的细节纹理在远处“渐隐”,从而减少锯齿效果。}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 1 |dark=1}} | | {{td| 1 |dark=1}} | ||
{{td| | {{td| 加法模式 }} | ||
{{td| | {{td| 细节纹理的颜色会添加到基础纹理上。这与{{L|$additive}}类似,但它会受到光照的影响(参见模式5)。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 2 |dark=1}} | | {{td| 2 |dark=1}} | ||
{{td| 半透明细节 }} | {{td| 半透明细节 }} | ||
{{td| | {{td| 细节纹理作为半透明覆盖层应用于基础纹理之上。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 3 |dark=1}} | | {{td| 3 |dark=1}} | ||
{{td| | {{td| 混合因子渐隐 }} | ||
{{td| | {{td| 细节纹理作为半透明覆盖层应用,但忽略其Alpha通道,而是使用混合因子来决定基础纹理的显示程度。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 4(?) |dark=1}} | | {{td| 4(?) |dark=1}} | ||
{{td| | {{td| 半透明基础 }} | ||
{{td| | {{td| 实质上颠倒了两种纹理的正常叠加顺序。细节纹理显示在“下方”,基础纹理的Alpha通道控制其作为半透明覆盖层的效果。细节纹理的Alpha通道控制整体材质的Alpha值——用于半透明、遮罩或其他用途。{{modernConfirm|可能与[[VRAD]]纹理阴影不兼容,因为VRAD显式查找{{cmd|$basetexture}}。}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 5 |dark=1}} | | {{td| 5 |dark=1}} | ||
{{td| | {{td| 无光照加法 }} | ||
{{td| | {{td| 细节纹理的颜色与基础纹理以模式1相同的方式相加,但细节纹理的颜色不受光照影响,因此看起来会发光。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 6 |dark=1}} | | {{td| 6 |dark=1}} | ||
{{td| | {{td| 无光照加法阈值渐隐 }} | ||
{{td| | {{td| 类似于模式5,但首先根据混合因子是否高于0.5来以两种模式修改添加的颜色。{{clarify|如何修改?}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 7 |dark=1}} | | {{td| 7 |dark=1}} | ||
{{td| | {{td| 双模式DecalModulate }} | ||
{{td| | {{td| 仅使用细节纹理的红色和Alpha通道。与{{L|DecalModulate|DecalModulate着色器}}或模式0类似,但基础纹理的Alpha通道会在使用红色(0)或Alpha(255)细节通道作为调制源之间进行渐隐。这实质上允许两个细节材质,但两者都是灰度的。 | ||
{{tip| | {{tip|如果使用此混合模式的细节纹理需要存储为未压缩格式,建议使用{{L|VTF_(Valve_Texture_Format)#Image_data_formats|IA88}}代替BGRA8888,以减半文件大小且无质量损失。}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 8 |dark=1}} | | {{td| 8 |dark=1}} | ||
{{td| | {{td| 乘法模式 }} | ||
{{td| | {{td| 基础通道的颜色乘以细节纹理的颜色。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 9 |dark=1}} | | {{td| 9 |dark=1}} | ||
{{td| | {{td| 基础遮罩通过细节Alpha }} | ||
{{td| | {{td| 仅使用细节的Alpha通道,并将其与基础纹理的Alpha通道相乘,生成最终的Alpha值。{{tip|使用{{L|VTF_(Valve_Texture_Format)#Image_data_formats|A8}}代替DXT5,以在相同文件大小下提升质量。}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 10 |dark=1}} | | {{td| 10 |dark=1}} | ||
{{td| 自阴影凹凸贴图 }} | {{td| 自阴影凹凸贴图 }} | ||
{{td| | {{td| 细节纹理作为(可能额外的){{L|$ssbump}}凹凸贴图使用。忽略混合因子。 | ||
{{Note| | {{Note|可用于在同一材质上获得标准凹凸贴图和自阴影凹凸贴图。然而,这非常耗资源,应谨慎使用。}} | ||
{{ModernImportant| | {{ModernImportant|此模式需要一个$bumpmap!如果Detailtexture VTF标记了SSBump标志,并且存在$bumpmap,则会自动使用此模式!}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| 11 |dark=1}} | | {{td| 11 |dark=1}} | ||
{{td| SSBump反照率 }} | {{td| SSBump反照率 }} | ||
{{td| | {{td| 类似于环境光遮蔽纹理,使用SSBump纹理。通过计算SSBump的高于平均值的“亮度”实现。 | ||
计算公式为 <code>Basetexture * (DetailTexture.r * (2/3) + DetailTexture.g * (2/3) + DetailTexture.b * (2/3))</code> | |||
{{ModernImportant| | {{ModernImportant|此模式无法与$bumpmap一起使用。如果Detailtexture VTF标记了SSBump标志,此模式会自动使用!}} }} | ||
}} | }} | ||
}} | }} | ||
{{ModernImportant| | {{ModernImportant|以下列出了适用于特定游戏和着色器的各种模式限制。使用不支持的混合模式可能/将导致“Missing Shader Combo”错误充斥控制台,材质将无法渲染! | ||
{{Table | {{Table | ||
| {{tr | | {{tr | ||
Line 137: | Line 136: | ||
| {{td| {{csgo}} |dark=1}} | | {{td| {{csgo}} |dark=1}} | ||
{{td| {{ent|LightmappedGeneric}} }} | {{td| {{ent|LightmappedGeneric}} }} | ||
{{td| | {{td| 模式1-6和8不支持。<br> | ||
模式9无法与{{ent|$bumpmap}}、{{ent|$envmap}}、{{ent|$selfillum}} | 模式9无法与{{ent|$bumpmap}}、{{ent|$envmap}}、{{ent|$selfillum}}一起使用。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{csgo}} |dark=1}} | | {{td| {{csgo}} |dark=1}} | ||
{{td| {{ent|WorldVertexTransition}} }} | {{td| {{ent|WorldVertexTransition}} }} | ||
{{td| | {{td| 模式1-6、8-9不支持。<br> | ||
模式7无法与{{ent|$blendmodulatetexture}} | 模式7无法与{{ent|$blendmodulatetexture}}一起使用。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{csgo}} |dark=1}} | | {{td| {{csgo}} |dark=1}} | ||
{{td| {{ent|VertexLitGeneric}} }} | {{td| {{ent|VertexLitGeneric}} }} | ||
{{td| | {{td| 模式10和11不支持。<br>模式0-4和7始终有效(无论是否有{{ent|$bumpmap}})。<br>模式5和6仅在使用{{ent|$phong}}或没有{{ent|$bumpmap}}时有效。<br>模式8和9仅在没有{{ent|$bumpmap}}时有效。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{csgo}} |dark=1}} | | {{td| {{csgo}} |dark=1}} | ||
{{td| {{ent|Lightmapped_4WayBlend}} }} | {{td| {{ent|Lightmapped_4WayBlend}} }} | ||
{{td| | {{td| 模式1-6不支持。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{src13}} | | {{td| {{src13}} {{tf2}} |dark=1}} | ||
{{td| {{ent|LightmappedGeneric}}<br>{{ent|WorldVertexTransition}} }} | {{td| {{ent|LightmappedGeneric}}<br>{{ent|WorldVertexTransition}} }} | ||
{{td| | {{td| 模式2-9不支持。<br>模式0和1始终有效。<br>模式10无法与{{ent|$ssbump}}一起使用。{{expand|title=解决方法|对于模式2,使用{{ent|WorldTwoTextureBlend}}。<br>对于模式8,使用{{ent|LightmappedTwoTexture}}。}} }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{src13}} | | {{td| {{src13}} {{tf2}} {{as}} |dark=1}} | ||
{{td| {{ent|VertexLitGeneric}} }} | {{td| {{ent|VertexLitGeneric}} }} | ||
{{td| | {{td| 模式10和11不支持。<br>模式0-4始终有效(无论是否有{{ent|$bumpmap}})。<br>模式5和6仅在使用{{ent|$phong}}或没有{{ent|$bumpmap}}时有效。<br>模式7-9仅在没有{{ent|$bumpmap}}时有效。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{as}} |dark=1}} | | {{td| {{as}} |dark=1}} | ||
{{td| {{ent|LightmappedGeneric}}<br>{{ent|WorldVertexTransition}} }} | {{td| {{ent|LightmappedGeneric}}<br>{{ent|WorldVertexTransition}} }} | ||
{{td| | {{td| 模式6不支持。<br> | ||
模式7无法与{{ent|$bumpmap2}}、{{ent|$softedges}} | 模式7无法与{{ent|$bumpmap2}}、{{ent|$softedges}}和{{ent|$blendmodulatetexture}}一起使用。 }} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td| {{l4d2}} |dark=1}} | | {{td| {{l4d2}} |dark=1}} | ||
{{td| 所有着色器 }} | {{td| 所有着色器 }} | ||
{{td| | {{td| 模式1、4、6、9和10不支持。 }} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
}} | {{note|混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。}}}} | ||
{{ | |||
{{MatParamDef|$detailtint|RGB 矩阵|细节纹理的颜色染色。 | |||
{{Bug | {{Bug | ||
| 在{{src13}} {{tf2}} {{as}} {{csgo}} | | 在 {{src13}} {{tf2}} {{as}} {{csgo}} 中,应用于 {{ent|VertexLitGeneric}} 时,无法与 {{ent|$bumpmap}} 或 {{ent|$phong}} 一起工作。}} | ||
{{Bug|无法与{{ent|$blendtintbybasealpha}} | {{Bug|无法与 {{ent|$blendtintbybasealpha}} 一起工作。<br> | ||
{{Todo| | {{Todo|验证此问题在哪些游戏中存在(已知在 {{l4d2}} {{tf2}} {{portal2}} {{csgo}} {{as}} 和 {{src13}} 中有效)。}} | ||
}} | }} | ||
}} | }} | ||
{{ | {{MatParamDef|$detailframe|整数|dx9=1|启动动画的<code>$detail</code>纹理的帧。}} | ||
{{ | |||
{{MatParamDef|$detail_alpha_mask_base_texture|布尔|已移除={{csgo}}|{{ent|WorldVertexTransition}} 专用。启用后,细节的 alpha 通道将决定“基础纹理混合”。{{ModernImportant|至少从 {{src13}} 开始,此参数实际上并未执行任何功能!}}}} | |||
<br> | <br> | ||
=== {{csgo}} <tt>WorldVertexTransition</tt> 参数 === | === {{csgo}} <tt>WorldVertexTransition</tt> 参数 === | ||
{{Confirm| | {{Confirm|这些参数仅适用于 {{csgo}},还是在所有 {{csgobranch}} 分支的游戏中都可用?}} | ||
{{ | {{MatParamDef|$detail2|纹理|仅限={{csgo}}|着色器=WorldVertexTransition| | ||
{{ent|WorldVertexTransition}} | 用于 {{ent|WorldVertexTransition}} 第二层的细节纹理。 | ||
{{Note|{{ent|LightmappedGeneric}} | {{Note|{{ent|LightmappedGeneric}} 技术上支持这些参数以及其他 <code>WorldVertexTransition</code> 参数,但它们可能无法按预期工作。}} | ||
{{Note| | {{Note|没有 <code>$detailtransform2</code>,着色器将改用 {{ent|$basetexturetransform2}}!}} | ||
{{ModernImportant| | {{ModernImportant|需要同时存在 <code>$detail</code> 和 <code>$basetexture2</code>!}} | ||
{{Bug|无法与<code>$detailblendmode "9"</code> | {{Bug|无法与 <code>$detailblendmode "9"</code> 一起使用。}} | ||
}} | }} | ||
{{ | {{MatParamDef|$detailscale2|浮点数|<tt>$detail2</tt> 的细节缩放比例。|仅限={{csgo}}|着色器=WorldVertexTransition}} | ||
{{ | {{MatParamDef|$detailblendfactor2|正常值|<tt>$detail2</tt> 的细节混合因子。{{Note|<code>$detailblendfactor</code> 和 <code>$detailblendfactor2</code> 在与基础纹理组合之前会先被混合。}}|仅限={{csgo}}|着色器=WorldVertexTransition}} | ||
{{ | {{MatParamDef|$detailframe2|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}|着色器=WorldVertexTransition}} | ||
{{ | {{MatParamDef|$detailtint2|RGB 矩阵|<tt>$detail2</tt> 的颜色染色。|仅限={{csgo}}|着色器=WorldVertexTransition}} | ||
<br> | <br> | ||
=== {{csgo}}{{portal2}} <tt>SolidEnergy</tt> 参数 === | === {{csgo}}{{portal2}} <tt>SolidEnergy</tt> 参数 === | ||
{{Todo| | {{Todo|确认此信息是否完全适用于 {{portal2}}。}} | ||
{{ModernConfirm|{{ent|SolidEnergy}} 是否在 {{csgobranch}} 分支的游戏中可用?}} | |||
{{ | {{Note|<code>$detail1tint</code> 和 <code>$detail2tint</code> 在此着色器中不存在,因此故意未列出!}} | ||
{{ | {{ModernImportant|<code>$detail</code> 的参数名称非常相似,但实际不同!}} | ||
{{ | {{MatParamDef|$detail1|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第二层的细节纹理。}} | ||
{{ | {{MatParamDef|$detail1blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy| | ||
如何将细节材质与反照率合并。 | |||
有两种不同的细节混合方法可用: | |||
{{Table | {{Table | ||
| {{tr | | {{tr | ||
Line 229: | Line 230: | ||
| {{td|0|align=center|dark=1}} | | {{td|0|align=center|dark=1}} | ||
{{td|DecalModulate}} | {{td|DecalModulate}} | ||
{{td| | {{td|此功能与 {{ent|DecalModulate}} 着色器相同—颜色值低于 128 会使图像变暗,高于 128 会使图像变亮。}} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td|1|align=center|dark=1}} | | {{td|1|align=center|dark=1}} | ||
{{td| | {{td|Multiply}} | ||
{{td|$ | {{td|<code>$basetexture</code> 与 <code>$detail1</code> 相乘,<code>$basetexture</code> 的 alpha 通道控制效果的强度。黑色部分完全乘积,白色部分无乘积。}} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
{{ | |||
{{ | {{MatParamDef|$detail1scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | ||
{{ | |||
{{ModernImportant|{{csgo}}的{{ent|WorldVertexTransition}} | {{MatParamDef|$detail1blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | ||
{{ | |||
{{ | {{MatParamDef|$detail1frame|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|启动动画的 <code>$detail1</code> 纹理的帧。 | ||
{{ModernImportant|{{csgo}} 的 {{ent|WorldVertexTransition}} 着色器具有非常类似的 <code>$detail2</code> 参数名称,但实际不同!}}}} | |||
{{MatParamDef|$detail2|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第三层的细节纹理。}} | |||
{{MatParamDef|$detail2blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy| | |||
如何将细节材质与反照率合并。 | |||
有两种不同的细节混合方法可用: | |||
{{Table | {{Table | ||
| {{tr | | {{tr | ||
Line 252: | Line 258: | ||
{{tr | {{tr | ||
| {{td|0|align=center|dark=1}} | | {{td|0|align=center|dark=1}} | ||
{{td| | {{td|Additive}} | ||
{{td|将$ | {{td|将 <code>$detail2</code> 添加到 <code>$basetexture</code>。{{Note|使用 <code>$detail1</code> 时,<code>$detail2</code> 首先会与 <code>$detail2</code> 相乘!}}}} | ||
}} | }} | ||
{{tr | {{tr | ||
| {{td|1|align=center|dark=1}} | | {{td|1|align=center|dark=1}} | ||
{{td| | {{td|Multiply}} | ||
{{td|$ | {{td|<code>$basetexture</code> 与 <code>$detail2</code> 相乘。{{Note|无法控制效果的强度。}}}} | ||
}} | }} | ||
}} | }} | ||
}} | }} | ||
== | {{MatParamDef|$detail2scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | ||
{{MatParamDef|$detail2blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | |||
{{MatParamDef|$detail2frame|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | |||
== Valve 的细节纹理 == | |||
Valve 的库存细节纹理(仅限 OB 使用)最好与以下预配置值一起使用: | |||
$detail detail\'''noise_detail_01''' ''// 例如,用于砖墙、混凝土等...'' | |||
$detailscale 7.74 | |||
$detailblendfactor 0.8 | |||
$detailblendmode 0 | |||
$detail detail\'''metal_detail_01''' | |||
$detailscale 4.283 | |||
$detailblendfactor 0.65 | |||
$detailblendmode 0 | |||
$detail detail\''' | $detail detail\'''rock_detail_01''' | ||
$detailscale | $detailscale 11 | ||
$detailblendfactor | $detailblendfactor 1 | ||
$detailblendmode 0 | $detailblendmode 0 | ||
$detail detail\''' | $detail detail\'''plaster_detail_01''' | ||
$detailscale | $detailscale 6.783 | ||
$detailblendfactor . | $detailblendfactor 0.8 | ||
$detailblendmode 0 | $detailblendmode 0 | ||
以下参数来自 <tt>models\props_forest\LadderWood.vmt</tt>。这是 '''唯一''' Valve 股票纹理 VMT 文件使用此特定细节纹理的文件。由于细节纹理(<tt>detail\wood_detail_01</tt>)为高分辨率(1024×1024),因此 <code>$detailscale</code> 低于其他纹理,除非是 <tt>rock_detail_01</tt>。 | |||
$detail detail\''' | $detail detail\'''wood_detail_01''' | ||
$detailscale | $detailscale 2.563 | ||
$detailblendfactor .8 | $detailblendfactor 0.8 | ||
$detailblendmode 0 | $detailblendmode 0 | ||
此外,还有 2 个其他的库存细节纹理。{{Code|detail\detailash001a}} 和 {{Code|detail\detaildirt001a}}。这些文件在《泄露版 HL2|2》中以及《HL2 EP1|2》中使用,并且使用以下参数。 | |||
{{Code|Concrete/concretefloor009a}} 在 ''Episode One'' 材料中: | |||
$detail detail/'''detaildirt001a''' | |||
$detailscale 0.27 | |||
{{Code|Metal/metalfloor005a}} 在 ''Episode One'' 材料中: | |||
$detail detail/'''detailash001a''' | |||
$detail detail/'''detailash001a''' | $detailscale 0.50 | ||
$detailscale 0.50 | |||
== | == 另请参阅 == | ||
[https://web.archive.org/web/20191215081655/https://blog.maxofs2d.net/post/83154062767/hiding-large-scale-tiling-with-detail-textures | [https://web.archive.org/web/20191215081655/https://blog.maxofs2d.net/post/83154062767/hiding-large-scale-tiling-with-detail-textures 隐藏大规模重复图案的细节纹理] - 使用 $detail 使纹理重复现象不那么明显的技巧 | ||
[[Category:Shader parameters|d]] |
Latest revision as of 12:09, 23 August 2025
$detail
是一个材质着色器 参数,可在所有的 起源 游戏中使用。 指定了一个纹理 ,当材质被近距离观察时,Source引擎将使用它通过适当地加深或减轻反照率 来增加材质的高分辨率细节,具体取决于$detailblendmode。您还可以使用全彩色(而非灰度)图像,并通过$detailblendmode 2进行混合。这种方法非常有效,可以增加纹理的表观分辨率,并广泛应用于半衰期2:第二章 以及传送门2 中的白瓷砖纹理凸起效果。

- 在
中,使用LightmappedGeneric时,与$seamless_scale不兼容。
- 在
中,使用VertexLitGeneric时,与$selfillumfresnel不兼容(如果使用了$bumpmap)。
- 在
中,使用LightmappedGeneric时,与$lightwarptexture不兼容。
注意:
- 在
中,LightmappedGeneric似乎根本没有$lightwarptexture参数,因此不能“不起作用”。
- 在
中,使用VertexLitGeneric时,与$desaturatewithbasealpha不兼容。
- 在
中,与$blendmodulatetexture和$bumpmap不兼容。
- 在
- 待完善: 记录其他Source分支的相关问题。
错误:在使用$detail和$blendmodulatetexture时会导致图形问题(表面出现条纹),仅在
和
中能正常工作。 [todo tested in ?]
语法
$detail <texture>
您可能需要至少使用$detailscale
(详见下文)。
参数和效果
- The default position is center .5 .5 scale 1 1 rotate 0 translate 0 0.
- center defines the point of rotation. Only useful if rotate is being used.
- scale fits the texture into the material the given number of times. 2 1 is a 50% scale in the horizontal X axis while the vertical Y axis is still at original scale.
- rotate rotates the texture counter-clockwise in degrees. Accepts any number, including negatives.
- translate shifts the texture by the given numbers. .5 will shift it half-way. 1 will shift it once completely over, which is the same as not moving it at all.
注意:All values must be included!
错误:Scaling the texture may cause odd issues where the Texture Lock tool in Hammer will not actually lock the texture in place. [todo tested in ?]
错误:Rotating textures applied on brushes will rotate around the map origin (confirm: Orangebox engine only?). A fix for this is to change the center position in the VMT to the brush's origin. [todo tested in ?]


$detailtexturetransform
,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:$detailscale "[ 4 8 ]"

$detailblendmode
为1或5的UnlitGeneric无效(在
- 可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。
- 混合模式在
stdshaders/common_ps_fxc.h
中实现。
模式 | 效果 | 描述 |
---|---|---|
0 | DecalModulate | 此模式与DecalModulate着色器 功能相同——颜色低于128会使图像变暗,高于128会使图像变亮。
![]() ![]() |
1 | 加法模式 | 细节纹理的颜色会添加到基础纹理上。这与$additive 类似,但它会受到光照的影响(参见模式5)。 |
2 | 半透明细节 | 细节纹理作为半透明覆盖层应用于基础纹理之上。 |
3 | 混合因子渐隐 | 细节纹理作为半透明覆盖层应用,但忽略其Alpha通道,而是使用混合因子来决定基础纹理的显示程度。 |
4(?) | 半透明基础 | 实质上颠倒了两种纹理的正常叠加顺序。细节纹理显示在“下方”,基础纹理的Alpha通道控制其作为半透明覆盖层的效果。细节纹理的Alpha通道控制整体材质的Alpha值——用于半透明、遮罩或其他用途。![]() |
5 | 无光照加法 | 细节纹理的颜色与基础纹理以模式1相同的方式相加,但细节纹理的颜色不受光照影响,因此看起来会发光。 |
6 | 无光照加法阈值渐隐 | 类似于模式5,但首先根据混合因子是否高于0.5来以两种模式修改添加的颜色。 澄清: 如何修改? |
7 | 双模式DecalModulate | 仅使用细节纹理的红色和Alpha通道。与DecalModulate着色器 或模式0类似,但基础纹理的Alpha通道会在使用红色(0)或Alpha(255)细节通道作为调制源之间进行渐隐。这实质上允许两个细节材质,但两者都是灰度的。
![]() |
8 | 乘法模式 | 基础通道的颜色乘以细节纹理的颜色。 |
9 | 基础遮罩通过细节Alpha | 仅使用细节的Alpha通道,并将其与基础纹理的Alpha通道相乘,生成最终的Alpha值。![]() |
10 | 自阴影凹凸贴图 | 细节纹理作为(可能额外的)$ssbump 凹凸贴图使用。忽略混合因子。
![]() ![]() |
11 | SSBump反照率 | 类似于环境光遮蔽纹理,使用SSBump纹理。通过计算SSBump的高于平均值的“亮度”实现。
计算公式为 ![]() |

分支 | 着色器 | 限制 |
---|---|---|
![]() |
LightmappedGeneric | 模式1-6和8不支持。 模式9无法与$bumpmap、$envmap、$selfillum一起使用。 |
![]() |
WorldVertexTransition | 模式1-6、8-9不支持。 模式7无法与$blendmodulatetexture一起使用。 |
![]() |
VertexLitGeneric | 模式10和11不支持。 模式0-4和7始终有效(无论是否有$bumpmap)。 模式5和6仅在使用$phong或没有$bumpmap时有效。 模式8和9仅在没有$bumpmap时有效。 |
![]() |
Lightmapped_4WayBlend | 模式1-6不支持。 |
![]() ![]() |
LightmappedGeneric WorldVertexTransition |
模式2-9不支持。 模式0和1始终有效。 模式10无法与$ssbump一起使用。 {| class="mw-collapsible mw-collapsed" style="background:rgba(0,0,0,0.05) ;float:no;margin-bottom:1em;margin-left:0;padding-right:0.5em;border:1px solid rgba(255,255,255,0.1); border-left:solid 1px #8bb9e0; padding-left:1em;" |+ style="text-align:left; white-space:nowrap; font-weight:bold; color:#ddd; " | 解决方法
| 对于模式2,使用WorldTwoTextureBlend。 |
![]() ![]() ![]() |
VertexLitGeneric | 模式10和11不支持。 模式0-4始终有效(无论是否有$bumpmap)。 模式5和6仅在使用$phong或没有$bumpmap时有效。 模式7-9仅在没有$bumpmap时有效。 |
![]() |
LightmappedGeneric WorldVertexTransition |
模式6不支持。 模式7无法与$bumpmap2、$softedges和$blendmodulatetexture一起使用。 |
![]() |
所有着色器 | 模式1、4、6、9和10不支持。 |







[todo tested in ?]
$detail
纹理的帧。
WorldVertexTransition 参数

WorldVertexTransition
参数,但它们可能无法按预期工作。
$detailtransform2
,着色器将改用 $basetexturetransform2!
$detail
和 $basetexture2
!
$detailblendmode "9"
一起使用。 [todo tested in ?]
$detailblendfactor
和 $detailblendfactor2
在与基础纹理组合之前会先被混合。$detail2
纹理的帧。

SolidEnergy 参数



$detail1tint
和 $detail2tint
在此着色器中不存在,因此故意未列出!
$detail
的参数名称非常相似,但实际不同!有两种不同的细节混合方法可用:
模式 | 效果 | 描述 |
---|---|---|
0 | DecalModulate | 此功能与 DecalModulate 着色器相同—颜色值低于 128 会使图像变暗,高于 128 会使图像变亮。 |
1 | Multiply | $basetexture 与 $detail1 相乘,$basetexture 的 alpha 通道控制效果的强度。黑色部分完全乘积,白色部分无乘积。 |


$detail1
纹理的帧。


$detail2
参数名称,但实际不同!有两种不同的细节混合方法可用:
模式 | 效果 | 描述 |
---|---|---|
0 | Additive | 将 $detail2 添加到 $basetexture 。![]() $detail1 时,$detail2 首先会与 $detail2 相乘! |
1 | Multiply | $basetexture 与 $detail2 相乘。![]() |


$detail2
纹理的帧。Valve 的细节纹理
Valve 的库存细节纹理(仅限 OB 使用)最好与以下预配置值一起使用:
$detail detail\noise_detail_01 // 例如,用于砖墙、混凝土等... $detailscale 7.74 $detailblendfactor 0.8 $detailblendmode 0
$detail detail\metal_detail_01 $detailscale 4.283 $detailblendfactor 0.65 $detailblendmode 0
$detail detail\rock_detail_01 $detailscale 11 $detailblendfactor 1 $detailblendmode 0
$detail detail\plaster_detail_01 $detailscale 6.783 $detailblendfactor 0.8 $detailblendmode 0
以下参数来自 models\props_forest\LadderWood.vmt。这是 唯一 Valve 股票纹理 VMT 文件使用此特定细节纹理的文件。由于细节纹理(detail\wood_detail_01)为高分辨率(1024×1024),因此 $detailscale
低于其他纹理,除非是 rock_detail_01。
$detail detail\wood_detail_01 $detailscale 2.563 $detailblendfactor 0.8 $detailblendmode 0
此外,还有 2 个其他的库存细节纹理。detail\detailash001a 和 detail\detaildirt001a。这些文件在《泄露版 HL2|2》中以及《HL2 EP1|2》中使用,并且使用以下参数。
Concrete/concretefloor009a 在 Episode One 材料中:
$detail detail/detaildirt001a $detailscale 0.27
Metal/metalfloor005a 在 Episode One 材料中:
$detail detail/detailash001a $detailscale 0.50
另请参阅
隐藏大规模重复图案的细节纹理 - 使用 $detail 使纹理重复现象不那么明显的技巧