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

Zh/$detail: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(deepseek translation)
Tag: Reverted
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar}}
{{translate}}
{{Source topicon}}
{{Source topicon}}
{{toc-right}}
{{toc-right}}
{{tabsBar|main=detail textures}}
{{tabsBar|main=detail textures}}
[[File:Detail.jpg|frame|right|应用细节贴图(noise_detail_01)及其在材质(brickwall031a)上的效果。]]
[[File:Detail.jpg|frame|right|一个细节纹理(noise_detail_01),以及将其应用到材质(brickwall031a)后的效果。]]
{{this is a|shader parameter|name=$detail}} 指定一个[[texture]],当近距离观察时,Source引擎会根据<tt>$detailblendmode</tt>通过适当调整[[albedo]]的明暗来为材质添加高分辨率细节。您也可以使用全彩色图像(而非灰度图)并通过{{Code|$detailblendmode 2}}进行混合。该参数能显著提升纹理的视觉分辨率,在{{hl2ep2|4}}{{portal2|4}}的白瓷砖表面凹凸效果中被广泛使用。
{{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}}{{ent|LightmappedGeneric}}中,无法与{{ent|$seamless_scale}}共同使用。
* 在{{as}}{{csgo}}{{src13}}{{tf2}}中,使用{{ent|LightmappedGeneric}}时,与{{ent|$seamless_scale}}不兼容。
* 在{{as}}{{csgo}}{{src13}}{{tf2}}{{ent|VertexLitGeneric}}中,若使用{{ent|$bumpmap}}则无法与{{ent|$selfillumfresnel}}共同使用。
* 在{{as}}{{csgo}}{{src13}}{{tf2}}中,使用{{ent|VertexLitGeneric}}时,与{{ent|$selfillumfresnel}}不兼容(如果使用了{{ent|$bumpmap}})。
* 在{{as}}{{src13}}{{tf2}}{{ent|LightmappedGeneric}}中,无法与{{ent|$lightwarptexture}}共同使用。
* 在{{as}}{{src13}}{{tf2}}中,使用{{ent|LightmappedGeneric}}时,与{{ent|$lightwarptexture}}不兼容。
}}
}}


: {{Note|<span><!-- 修复列表显示 --></span>
: {{Note|<span><!-- 这是为了修正列表 --></span>
:* 在{{csgo}}中,{{ent|LightmappedGeneric}}似乎并未将{{ent|$lightwarptexture}}作为参数... 因此不存在"无法使用"的情况。
:* 在{{csgo}}中,{{ent|LightmappedGeneric}}似乎根本没有{{ent|$lightwarptexture}}参数,因此不能“不起作用”。
:* 在{{as}}{{csgo}}{{ent|VertexLitGeneric}}中,无法与{{ent|$desaturatewithbasealpha}}共同使用。
:* 在{{as}}{{csgo}}中,使用{{ent|VertexLitGeneric}}时,与{{ent|$desaturatewithbasealpha}}不兼容。
:* 在{{as}}中,无法同时使用{{ent|$blendmodulatetexture}} '''和''' {{ent|$bumpmap}}
:* 在{{as}}中,与{{ent|$blendmodulatetexture}}'''和'''{{ent|$bumpmap}}不兼容。
   }}
   }}


: {{Todo| 记录其他Source分支中的兼容性问题。}}
: {{Todo|记录其他Source分支的相关问题。}}


: {{ModernConfirm| 在{{as}}中无法使用的功能,通常也无法在{{l4d}}中使用,反之亦然。建议进行实际验证。}}
: {{ModernConfirm|在{{as}}中不起作用的内容,通常在{{l4d}}中也不起作用,反之亦然。但如果有人能确认这一点会更好。}}


: {{bug| 在{{as}}中同时使用{{Code|$detail}}和{{ent|$blendmodulatetexture}}会导致图形问题(表面条纹),仅在{{csgo}}和{{GMOD}}中正常。}}
: {{bug|在使用{{Code|$detail}}和{{ent|$blendmodulatetexture}}时会导致图形问题(表面出现条纹),仅在{{csgo}}和{{GMOD}}中能正常工作。}}


== 语法 ==
== 语法 ==
Line 29: Line 28:
  $detail <texture>
  $detail <texture>


通常需同时使用至少<code>$detailscale</code>参数(见下文)。
您可能需要至少使用<code>$detailscale</code>(详见下文)。


== 参数与效果 ==
== 参数和效果 ==
{{MatParam
{{MatParamDef
| $detailtexturetransform|matrix|dx9 = 1
| $detailtexturetransform|matrix|dx9 = 1
| 对细节贴图进行旋转、缩放等变换。{{VMT UVtransform}}
| 旋转、缩放等操作细节纹理。{{VMT UVtransform}}
{{Bug|该参数不适用于{{ent|LightmappedGeneric}}、{{ent|WorldVertexTransition}}、{{ent|LightmappedTwoTexture}}、{{ent|WorldTwoTextureBlend}}以及{{only|{{csgo}}}}的{{ent|Lightmapped_4WayBlend}}}}
{{Bug|此参数在{{ent|LightmappedGeneric}}、{{ent|WorldVertexTransition}}、{{ent|LightmappedTwoTexture}}、{{ent|WorldTwoTextureBlend}}以及仅限{{only|{{csgo}}}}的{{ent|Lightmapped_4WayBlend}}中不存在。}}
{{Bug|无法与{{ent|$treesway}}共同使用。}}
{{Bug|{{ent|$treesway}}不兼容。}}
}}
}}


{{MatParam
{{MatParamDef
|$detailscale| float
|$detailscale| float
| 设置细节贴图在材质上的重复次数(默认值{{=}}4)。通常替代<code>$detailtexturetransform</code>使用,对于128px细节贴图推荐值约为7或8。如需独立缩放X/Y轴,请使用括号格式:<code>$detailscale "[4 8]"</code>
| 将细节纹理缩放到材质上的次数(默认值为4)。通常会用一个值约为7或8代替<code>$detailtexturetransform</code>,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:<code>$detailscale "[ 4 8 ]"</code>
}}
}}


{{MatParam
{{MatParamDef
|$detailblendfactor|normal|
|$detailblendfactor|normal|
控制细节贴图对基础贴图的影响程度。具体效果取决于混合模式,多数情况下类似[[$alpha]]。值0通常使细节贴图无效,值1应用完整效果。
控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于[[$alpha]]。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。
{{bug|在[[UnlitGeneric]]上对<code>$detailblendmode</code>1或5无效(测试于{{dods}})。}}
{{bug|<code>$detailblendmode</code>为1或5的[[UnlitGeneric]]无效(在{{dods}}中测试)。}}
}}
}}


{{MatParam
{{MatParamDef
|$detailblendmode| int
|$detailblendmode|int|text=细节材质与漫反射或反照率的结合方式。
| 细节材质与漫反射/albedo的混合方式。
: 可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。
: 共有12种混合模式,但并非所有着色器都支持全部模式(见下文)。
: 混合模式在{{Path|stdshaders/common_ps_fxc|h}}中实现。
: 混合模式实现于{{Path|stdshaders/common_ps_fxc|h}}
 
[[File:Detail_blend_modes_l4d2.jpg||320px|thumb|right|L4D2中的混合模式,系数为0.8(从左到右依次为模式0到11,仅基础纹理和仅细节纹理。顶部行细节不透明度100%,底部行50%)。]]


[[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| 功能同{{ent|DecalModulate}}着色器——低于128的色值使图像变暗,高于则变亮。
  {{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| 将细节贴图颜色叠加到基础贴图(类似{{ent|$additive}},但受光照影响,参见模式5)。 }}
  {{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| 以半透明覆盖应用细节贴图,忽略其alpha通道,改用混合因子控制基础贴图显示量。 }}
  {{td| 细节纹理作为半透明覆盖层应用,但忽略其Alpha通道,而是使用混合因子来决定基础纹理的显示程度。 }}
}}
}}
{{tr
{{tr
| {{td| 4(?) |dark=1}}
| {{td| 4(?) |dark=1}}
  {{td| 半透明基底 }}
  {{td| 半透明基础 }}
  {{td| 反转常规层级关系:细节贴图位于"下层",通过基础alpha通道作为半透明覆盖控制。细节alpha通道控制整体材质alpha(用于透明度/遮罩等)。{{note|与依赖{{cmd|$basetexture}}的[[VRAD]]纹理阴影不兼容。}} }}
  {{td| 实质上颠倒了两种纹理的正常叠加顺序。细节纹理显示在“下方”,基础纹理的Alpha通道控制其作为半透明覆盖层的效果。细节纹理的Alpha通道控制整体材质的Alpha值——用于半透明、遮罩或其他用途。{{modernConfirm|可能与[[VRAD]]纹理阴影不兼容,因为VRAD显式查找{{cmd|$basetexture}}}} }}
}}
}}
{{tr
{{tr
| {{td| 5 |dark=1}}
| {{td| 5 |dark=1}}
  {{td| 无光叠加 }}
  {{td| 无光照加法 }}
  {{td| 类似模式1的叠加效果,但颜色不受光照影响(发光效果)。 }}
  {{td| 细节纹理的颜色与基础纹理以模式1相同的方式相加,但细节纹理的颜色不受光照影响,因此看起来会发光。 }}
}}
}}
{{tr
{{tr
| {{td| 6 |dark=1}}
| {{td| 6 |dark=1}}
  {{td| 无光叠加阈值淡出 }}
  {{td| 无光照加法阈值渐隐 }}
  {{td| 类似模式5的无光叠加,但根据混合因子是否高于0.5分两种模式添加颜色。{{clarify|具体如何调整?}} }}
  {{td| 类似于模式5,但首先根据混合因子是否高于0.5来以两种模式修改添加的颜色。{{clarify|如何修改?}} }}
}}
}}
{{tr
{{tr
| {{td| 7 |dark=1}}
| {{td| 7 |dark=1}}
  {{td| 双图案DecalModulate }}
  {{td| 双模式DecalModulate }}
  {{td| 仅使用细节贴图的红色和alpha通道。功能类似模式0,但基础alpha通道控制使用红色(0)或alpha(255)通道作为调制源,可实现两种灰度细节材质。
  {{td| 仅使用细节纹理的红色和Alpha通道。与{{L|DecalModulate|DecalModulate着色器}}或模式0类似,但基础纹理的Alpha通道会在使用红色(0)或Alpha(255)细节通道作为调制源之间进行渐隐。这实质上允许两个细节材质,但两者都是灰度的。
{{tip|若需非压缩格式存储,建议使用[[VTF_(Valve_Texture_Format)#Image_data_formats|IA88格式]]替代BGRA8888,文件体积减半且无质量损失。}} }}
{{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| 基于细节Alpha的基底遮罩 }}
  {{td| 基础遮罩通过细节Alpha }}
  {{td| 仅使用细节alpha通道,与基础alpha相乘生成最终alpha值。{{tip|推荐使用[[VTF_(Valve_Texture_Format)#Image_data_formats|A8格式]]替代DXT5以提高质量。}} }}
  {{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| 将细节贴图作为(额外){{ent|$ssbump}}凹凸贴图,忽略混合因子。
  {{td| 细节纹理作为(可能额外的){{L|$ssbump}}凹凸贴图使用。忽略混合因子。
        {{Note|可叠加标准凹凸贴图与自阴影凹凸贴图,但性能消耗较高,慎用。}}
        {{Note|可用于在同一材质上获得标准凹凸贴图和自阴影凹凸贴图。然而,这非常耗资源,应谨慎使用。}}
        {{ModernImportant|必须存在$bumpmap!若细节贴图VTF标记SSBump标志且存在$bumpmap时自动启用!}} }}
        {{ModernImportant|此模式需要一个$bumpmap!如果Detailtexture VTF标记了SSBump标志,并且存在$bumpmap,则会自动使用此模式!}} }}
}}
}}
{{tr
{{tr
| {{td| 11 |dark=1}}
| {{td| 11 |dark=1}}
  {{td| SSBump反照率 }}
  {{td| SSBump反照率 }}
  {{td| 通过计算SSBump的高于平均值的'亮度',将其作为环境遮蔽贴图使用。
  {{td| 类似于环境光遮蔽纹理,使用SSBump纹理。通过计算SSBump的高于平均值的“亮度”实现。
公式:<code>基底贴图 * (细节贴图.r*(2/3)+细节贴图.g*(2/3)+细节贴图.b*(2/3))</code>
计算公式为 <code>Basetexture * (DetailTexture.r * (2/3) + DetailTexture.g * (2/3) + DetailTexture.b * (2/3))</code>
        {{ModernImportant|不可与$bumpmap共用!若细节贴图VTF标记SSBump标志则自动启用!}} }}
        {{ModernImportant|此模式无法与$bumpmap一起使用。如果Detailtexture VTF标记了SSBump标志,此模式会自动使用!}} }}
}}
}}
}}
}}
{{ModernImportant|下方列出各游戏/着色器对各模式的限制。使用不支持的混合模式会导致控制台报"Missing Shader Combo"错误,材质将无法渲染!
{{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| 不支持模式1-6和8<br>
  {{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| 不支持模式1-6、8-9<br>
  {{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| 不支持模式10+11<br>0-4和7始终有效(有无{{ent|$bumpmap}}均可)<br>5+6仅支持{{ent|$phong}}或无{{ent|$bumpmap}}<br>8+9仅支持无{{ent|$bumpmap}} }}
  {{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| 不支持模式1-6 }}
  {{td| 模式1-6不支持。 }}
}}
}}
{{tr
{{tr
| {{td| {{src13}}<br>{{tf2branch}} |dark=1}}
| {{td| {{src13}} {{tf2}} |dark=1}}
  {{td| {{ent|LightmappedGeneric}}<br>{{ent|WorldVertexTransition}} }}
  {{td| {{ent|LightmappedGeneric}}<br>{{ent|WorldVertexTransition}} }}
  {{td| 不支持模式2-9<br>0+1始终有效<br>模式10无法与{{ent|$ssbump}}共用<br>
  {{td| 模式2-9不支持。<br>模式0和1始终有效。<br>模式10无法与{{ent|$ssbump}}一起使用。{{expand|title=解决方法|对于模式2,使用{{ent|WorldTwoTextureBlend}}<br>对于模式8,使用{{ent|LightmappedTwoTexture}}。}} }}
替代方案:<br> 模式2改用{{ent|WorldTwoTextureBlend}}<br> 模式8改用{{ent|LightmappedTwoTexture}} }}
}}
}}
{{tr
{{tr
| {{td| {{src13}}<br>{{tf2branch}}<br>{{as}} |dark=1}}
| {{td| {{src13}} {{tf2}} {{as}} |dark=1}}
  {{td| {{ent|VertexLitGeneric}} }}
  {{td| {{ent|VertexLitGeneric}} }}
  {{td| 不支持模式10+11<br>0-4始终有效(有无{{ent|$bumpmap}}均可)<br>5+6仅支持{{ent|$phong}}或无{{ent|$bumpmap}}<br>7-9仅支持无{{ent|$bumpmap}} }}
  {{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| 不支持模式6<br>
  {{td| 模式6不支持。<br>
模式7无法与{{ent|$bumpmap2}}、{{ent|$softedges}}{{ent|$blendmodulatetexture}}共用。 }}
模式7无法与{{ent|$bumpmap2}}、{{ent|$softedges}}{{ent|$blendmodulatetexture}}一起使用。 }}
}}
}}
{{tr
{{tr
| {{td| {{l4d2}} |dark=1}}
| {{td| {{l4d2}} |dark=1}}
  {{td| 所有着色器 }}
  {{td| 所有着色器 }}
  {{td| 不支持模式1、4、6、9、10 }}
  {{td| 模式1、4、6、9和10不支持。 }}
}}
}}
}}
}}
{{note|混合模式5和6在光照后应用,模式10在光照时应用,其余均在光照前应用。}}
}}
}}
}}
{{note|混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。}}}}
{{MatParam|$detailtint|RGB matrix|细节贴图的色彩调色。
 
{{MatParamDef|$detailtint|RGB 矩阵|细节纹理的颜色染色。
{{Bug
{{Bug
| 在{{src13}} {{tf2}} {{as}} {{csgo}}{{ent|VertexLitGeneric}}中,无法与{{ent|$bumpmap}}或{{ent|$phong}}共用}}
| 在 {{src13}} {{tf2}} {{as}} {{csgo}} 中,应用于 {{ent|VertexLitGeneric}} 时,无法与 {{ent|$bumpmap}} 或 {{ent|$phong}} 一起工作。}}
{{Bug|无法与{{ent|$blendtintbybasealpha}}共用<br>
{{Bug|无法与 {{ent|$blendtintbybasealpha}} 一起工作。<br>
{{Todo|验证受影响游戏(已知{{l4d2}} {{tf2}} {{portal2}} {{csgo}} {{as}} {{src13}}中有效)。}}
{{Todo|验证此问题在哪些游戏中存在(已知在 {{l4d2}} {{tf2}} {{portal2}} {{csgo}} {{as}} {{src13}} 中有效)。}}
}}
}}
}}
}}


{{MatParam|$detailframe|int|dx9=1|动画细节贴图的起始帧。}}
{{MatParamDef|$detailframe|整数|dx9=1|启动动画的<code>$detail</code>纹理的帧。}}
{{MatParam|$detail_alpha_mask_base_texture|bool|removed={{csgo}}|{{ent|WorldVertexTransition}}。启用时细节alpha决定"基础贴图混合"。{{ModernImportant|{{src13}}起此参数实际无效!}}}}
 
{{MatParamDef|$detail_alpha_mask_base_texture|布尔|已移除={{csgo}}|{{ent|WorldVertexTransition}} 专用。启用后,细节的 alpha 通道将决定“基础纹理混合”。{{ModernImportant|至少从 {{src13}} 开始,此参数实际上并未执行任何功能!}}}}
<br>
<br>
=== {{csgo}} <tt>WorldVertexTransition</tt> 参数 ===
=== {{csgo}} <tt>WorldVertexTransition</tt> 参数 ===
{{Confirm|这些参数是否仅限于{{csgo}},还是适用于所有{{csgobranch}}分支游戏?}}
{{Confirm|这些参数仅适用于 {{csgo}},还是在所有 {{csgobranch}} 分支的游戏中都可用?}}


{{MatParam|$detail2|texture|only={{csgo}}|shaders=WorldVertexTransition|
{{MatParamDef|$detail2|纹理|仅限={{csgo}}|着色器=WorldVertexTransition|
{{ent|WorldVertexTransition}}第二层的细节贴图。
用于 {{ent|WorldVertexTransition}} 第二层的细节纹理。
{{Note|{{ent|LightmappedGeneric}}理论上支持此参数及其他<code>WorldVertexTransition</code>参数,但可能异常。}}
{{Note|{{ent|LightmappedGeneric}} 技术上支持这些参数以及其他 <code>WorldVertexTransition</code> 参数,但它们可能无法按预期工作。}}
{{Note|<code>$detailtransform2</code>参数,着色器将使用{{ent|$basetexturetransform2}}替代!}}
{{Note|没有 <code>$detailtransform2</code>,着色器将改用 {{ent|$basetexturetransform2}}}}
{{ModernImportant|需同时存在<code>$detail</code>和<code>$basetexture2</code>!}}
{{ModernImportant|需要同时存在 <code>$detail</code> 和 <code>$basetexture2</code>!}}
{{Bug|无法与<code>$detailblendmode "9"</code>共用。}}
{{Bug|无法与 <code>$detailblendmode "9"</code> 一起使用。}}
}}
}}


{{MatParam|$detailscale2|float|<tt>$detail2</tt>的缩放比例。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$detailscale2|浮点数|<tt>$detail2</tt> 的细节缩放比例。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParam|$detailblendfactor2|normal|<tt>$detail2</tt>的混合因子。{{Note|<code>$detailblendfactor</code><code>$detailblendfactor2</code>会先混合再与基础贴图结合。}}|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$detailblendfactor2|正常值|<tt>$detail2</tt> 的细节混合因子。{{Note|<code>$detailblendfactor</code> <code>$detailblendfactor2</code> 在与基础纹理组合之前会先被混合。}}|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParam|$detailframe2|int|动画<code>$detail2</code>的起始帧。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$detailframe2|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParam|$detailtint2|RGB matrix|<tt>$detail2</tt>的调色。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$detailtint2|RGB 矩阵|<tt>$detail2</tt> 的颜色染色。|仅限={{csgo}}|着色器=WorldVertexTransition}}
<br>
<br>
=== {{csgo}}{{portal2}} <tt>SolidEnergy</tt> 参数 ===
=== {{csgo}}{{portal2}} <tt>SolidEnergy</tt> 参数 ===
{{Todo|验证{{portal2}}中的信息准确性}}
{{Todo|确认此信息是否完全适用于 {{portal2}}。}}
 
{{ModernConfirm|{{ent|SolidEnergy}} 是否在 {{csgobranch}} 分支的游戏中可用?}}


{{ModernConfirm|{{ent|SolidEnergy}}是否存在于{{csgobranch}}分支游戏中?}}
{{Note|<code>$detail1tint</code> 和 <code>$detail2tint</code> 在此着色器中不存在,因此故意未列出!}}


{{Note|$detail1tint和$detail2tint在此着色器中不存在,列表中已作刻意省略!}}
{{ModernImportant|<code>$detail</code> 的参数名称非常相似,但实际不同!}}


{{ModernImportant|<code>$detail</code>参数名称相似但功能不同!}}
{{MatParamDef|$detail1|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第二层的细节纹理。}}


{{MatParam|$detail1|texture|only={{csgo}}{{portal2}}|shaders=SolidEnergy|{{ent|SolidEnergy}}的第二层细节贴图。}}
{{MatParamDef|$detail1blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|
{{MatParam|$detail1blendmode|int|only={{csgo}}{{portal2}}|shaders=SolidEnergy|
如何将细节材质与反照率合并。
细节材质与反照率的混合方式。
有两种不同的细节混合方法可用:
:共2种混合模式:
{{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|功能同{{ent|DecalModulate}}着色器——色值低于128变暗,高于则变亮。}}
  {{td|此功能与 {{ent|DecalModulate}} 着色器相同—颜色值低于 128 会使图像变暗,高于 128 会使图像变亮。}}
}}
}}
{{tr
{{tr
| {{td|1|align=center|dark=1}}
| {{td|1|align=center|dark=1}}
  {{td|相乘}}
  {{td|Multiply}}
  {{td|$basetexture与$detail1相乘,$basetexture的alpha控制效果强度(黑色全效,白色无效)。}}
  {{td|<code>$basetexture</code> 与 <code>$detail1</code> 相乘,<code>$basetexture</code> 的 alpha 通道控制效果的强度。黑色部分完全乘积,白色部分无乘积。}}
}}
}}
}}
}}
}}
}}
{{MatParam|$detail1scale|float|<tt>$detail2</tt>的缩放比例。{{Note| 实际无效。}}|only={{csgo}}{{portal2}}|shaders=SolidEnergy}}
 
{{MatParam|$detail1blendfactor|float|<tt>$detail2</tt>的混合因子。{{Note| 实际无效。}}|only={{csgo}}{{portal2}}|shaders=SolidEnergy}}
{{MatParamDef|$detail1scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParam|$detail1frame|int|only={{csgo}}{{portal2}}|shaders=SolidEnergy|动画<code>$detail1</code>的起始帧。
 
{{ModernImportant|{{csgo}}的{{ent|WorldVertexTransition}}有类似<code>$detail2</code>参数,但功能不同!}}}}
{{MatParamDef|$detail1blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParam|$detail2|texture|only={{csgo}}{{portal2}}|shaders=SolidEnergy|{{ent|SolidEnergy}}的第三层细节贴图。}}
 
{{MatParam|$detail2blendmode|int|only={{csgo}}{{portal2}}|shaders=SolidEnergy|
{{MatParamDef|$detail1frame|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|启动动画的 <code>$detail1</code> 纹理的帧。 
细节材质与反照率的混合方式。
{{ModernImportant|{{csgo}} 的 {{ent|WorldVertexTransition}} 着色器具有非常类似的 <code>$detail2</code> 参数名称,但实际不同!}}}}
:共2种混合模式:
 
{{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|将$detail2叠加到$basetexture。{{Note|若使用$detail1,$detail2会先与$detail2相乘!}}}}
  {{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|$basetexture与$detail2相乘。{{Note|无法控制效果强度。}}}}
  {{td|<code>$basetexture</code> 与 <code>$detail2</code> 相乘。{{Note|无法控制效果的强度。}}}}
}}
}}
}}
}}
}}
}}
{{MatParam|$detail2scale|float|<tt>$detail2</tt>的缩放比例。{{Note| 实际无效。}}|only={{csgo}}{{portal2}}|shaders=SolidEnergy}}
{{MatParam|$detail2blendfactor|float|<tt>$detail2</tt>的混合因子。{{Note| 实际无效。}}|only={{csgo}}{{portal2}}|shaders=SolidEnergy}}
{{MatParam|$detail2frame|int|动画<code>$detail2</code>的起始帧。|only={{csgo}}{{portal2}}|shaders=SolidEnergy}}


== Valve预设细节贴图 ==
{{MatParamDef|$detail2scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
Valve官方细节贴图(仅OB可用)推荐使用以下预设参数:
 
{{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\'''noise_detail_01''' ''// 适用于砖墙、混凝土等...''
  $detail detail\'''rock_detail_01'''
  $detailscale 7.74
  $detailscale 11 
  $detailblendfactor 0.8
  $detailblendfactor
  $detailblendmode 0
  $detailblendmode 0


  $detail detail\'''metal_detail_01'''
  $detail detail\'''plaster_detail_01'''
  $detailscale 4.283
  $detailscale 6.783 
  $detailblendfactor .65
  $detailblendfactor 0.
  $detailblendmode 0
  $detailblendmode 0


$detail detail\'''rock_detail_01'''
以下参数来自 <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>。  
$detailscale 11
$detailblendfactor 1
  $detailblendmode 0


  $detail detail\'''plaster_detail_01'''
  $detail detail\'''wood_detail_01'''
  $detailscale 6.783
  $detailscale 2.563 
  $detailblendfactor .8
  $detailblendfactor 0.8
  $detailblendmode 0
  $detailblendmode 0


以下参数来自<tt>models\props_forest\LadderWood.vmt</tt>,是唯一使用<tt>detail\wood_detail_01</tt>(1024×1024高分辨率)的官方材质文件,因此<code>$detailscale</code>较低(除<tt>rock_detail_01</tt>外):
此外,还有 2 个其他的库存细节纹理。{{Code|detail\detailash001a}} 和 {{Code|detail\detaildirt001a}}。这些文件在《泄露版 HL2|2》中以及《HL2 EP1|2》中使用,并且使用以下参数。 


$detail detail\'''wood_detail_01'''
{{Code|Concrete/concretefloor009a}} 在 ''Episode One'' 材料中:  
$detailscale 2.563
$detailblendfactor .8
  $detailblendmode 0


另有{{Code|detail\detailash001a}}和{{Code|detail\detaildirt001a}}两个贴图曾用于"泄露版"{{hl2|2}}及{{hl2ep1|2}}的以下材质:
$detail detail/'''detaildirt001a''' 
$detailscale 0.27 


{{hl2ep1|2}}材质{{Code|Concrete/concretefloor009a}}参数:
{{Code|Metal/metalfloor005a}} ''Episode One'' 材料中:  
$detail detail/'''detaildirt001a'''
  $detailscale 0.27


{{hl2ep1|2}}材质{{Code|Metal/metalfloor005a}}参数:
  $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 使用细节贴图隐藏重复平铺] - 如何通过$detail减少贴图重复感
[https://web.archive.org/web/20191215081655/https://blog.maxofs2d.net/post/83154062767/hiding-large-scale-tiling-with-detail-textures 隐藏大规模重复图案的细节纹理] - 使用 $detail 使纹理重复现象不那么明显的技巧 


{{ACategory|Shader parameters|d}}
[[Category:Shader parameters|d]]

Latest revision as of 12:09, 23 August 2025

English (en)Français (fr)中文 (zh)Translate (Translate)

edit
一个细节纹理(noise_detail_01),以及将其应用到材质(brickwall031a)后的效果。

$detail是一个材质(en)着色器(en)参数,可在所有的 起源 起源 游戏中使用。 指定了一个纹理(en),当材质被近距离观察时,Source引擎将使用它通过适当地加深或减轻反照率(en)来增加材质的高分辨率细节,具体取决于$detailblendmode。您还可以使用全彩色(而非灰度)图像,并通过$detailblendmode 2进行混合。这种方法非常有效,可以增加纹理的表观分辨率,并广泛应用于半衰期2:第二章(en)以及传送门2(en)中的白瓷砖纹理凸起效果。

Icon-Bug.png错误: $detail纹理在与某些参数结合时不起作用:   [todo tested in ?]
Note.png注意:
待完善: 记录其他Source分支的相关问题。
证实:异形丛生中不起作用的内容,通常在求生之路中也不起作用,反之亦然。但如果有人能确认这一点会更好。
Icon-Bug.png错误:在使用$detail$blendmodulatetexture时会导致图形问题(表面出现条纹),仅在反恐精英:全球攻势Garry's Mod中能正常工作。  [todo tested in ?]

语法

$detail <texture>

您可能需要至少使用$detailscale(详见下文)。

参数和效果

旋转、缩放等操作细节纹理。
The default position is center .5 .5 scale 1 1 rotate 0 translate 0 0.
  1. center defines the point of rotation. Only useful if rotate is being used.
  2. 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.
  3. rotate rotates the texture counter-clockwise in degrees. Accepts any number, including negatives.
  4. 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.
Note.png注意:All values must be included!
Icon-Bug.png错误: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 ?]
Icon-Bug.png错误: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 ?]
Icon-Bug.png错误:此参数在LightmappedGenericWorldVertexTransitionLightmappedTwoTextureWorldTwoTextureBlend以及仅限(存在于 反恐精英:全球攻势 之中)Lightmapped_4WayBlend中不存在。  [todo tested in ?]
Icon-Bug.png错误:$treesway不兼容。  [todo tested in ?]
将细节纹理缩放到材质上的次数(默认值为4)。通常会用一个值约为7或8代替$detailtexturetransform,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:$detailscale "[ 4 8 ]"
控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于$alpha。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。
Icon-Bug.png错误:$detailblendmode为1或5的UnlitGeneric无效(在胜利之日:起源中测试)。  [todo tested in ?]
细节材质与漫反射或反照率的结合方式。
可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。
混合模式在🖿stdshaders/common_ps_fxc.h中实现。
L4D2中的混合模式,系数为0.8(从左到右依次为模式0到11,仅基础纹理和仅细节纹理。顶部行细节不透明度100%,底部行50%)。


Icon-Important.png重要:以下列出了适用于特定游戏和着色器的各种模式限制。使用不支持的混合模式可能/将导致“Missing Shader Combo”错误充斥控制台,材质将无法渲染!
Note.png注意:混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。
细节纹理的颜色染色。
Icon-Bug.png错误:起源2013 军团要塞2 异形丛生 反恐精英:全球攻势 中,应用于 VertexLitGeneric 时,无法与 $bumpmap$phong 一起工作。  [todo tested in ?]
Icon-Bug.png错误:无法与 $blendtintbybasealpha 一起工作。
待完善: 验证此问题在哪些游戏中存在(已知在 求生之路2 军团要塞2 传送门2 反恐精英:全球攻势 异形丛生起源2013 中有效)。
  [todo tested in ?]
$detailframe(en) <整数(en)> (DX9 SM2)
启动动画的$detail纹理的帧。
WorldVertexTransition 专用。启用后,细节的 alpha 通道将决定“基础纹理混合”。
Icon-Important.png重要:至少从 起源2013 开始,此参数实际上并未执行任何功能!


反恐精英:全球攻势 WorldVertexTransition 参数

证实:这些参数仅适用于 反恐精英:全球攻势,还是在所有 CS:GO 引擎分支 分支的游戏中都可用?
用于 WorldVertexTransition 第二层的细节纹理。
Note.png注意:LightmappedGeneric 技术上支持这些参数以及其他 WorldVertexTransition 参数,但它们可能无法按预期工作。
Note.png注意:没有 $detailtransform2,着色器将改用 $basetexturetransform2
Icon-Important.png重要:需要同时存在 $detail$basetexture2
Icon-Bug.png错误:无法与 $detailblendmode "9" 一起使用。  [todo tested in ?]
$detail2 的细节缩放比例。
$detail2 的细节混合因子。
Note.png注意:$detailblendfactor$detailblendfactor2 在与基础纹理组合之前会先被混合。
启动动画的 $detail2 纹理的帧。
$detail2 的颜色染色。


反恐精英:全球攻势传送门2 SolidEnergy 参数

待完善: 确认此信息是否完全适用于 传送门2
证实:SolidEnergy 是否在 CS:GO 引擎分支 分支的游戏中可用?
Note.png注意:$detail1tint$detail2tint 在此着色器中不存在,因此故意未列出!
Icon-Important.png重要:$detail 的参数名称非常相似,但实际不同!
用于 SolidEnergy 第二层的细节纹理。
如何将细节材质与反照率合并。

有两种不同的细节混合方法可用:

$detail2 的细节缩放比例。
Note.png注意:似乎无任何效果。
$detail2 的细节混合因子。
Note.png注意:似乎无任何效果。
启动动画的 $detail1 纹理的帧。
Icon-Important.png重要:反恐精英:全球攻势WorldVertexTransition 着色器具有非常类似的 $detail2 参数名称,但实际不同!
用于 SolidEnergy 第三层的细节纹理。
如何将细节材质与反照率合并。

有两种不同的细节混合方法可用:

$detail2 的细节缩放比例。
Note.png注意:似乎无任何效果。
$detail2 的细节混合因子。
Note.png注意:似乎无任何效果。
启动动画的 $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\detailash001adetail\detaildirt001a。这些文件在《泄露版 HL2|2》中以及《HL2 EP1|2》中使用,并且使用以下参数。

Concrete/concretefloor009aEpisode One 材料中:

$detail detail/detaildirt001a  
$detailscale 0.27  

Metal/metalfloor005aEpisode One 材料中:

$detail detail/detailash001a  
$detailscale 0.50  

另请参阅

隐藏大规模重复图案的细节纹理 - 使用 $detail 使纹理重复现象不那么明显的技巧