Zh/$detail: Difference between revisions
mNo edit summary |
(→参数和效果) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 31: | Line 31: | ||
== 参数和效果 == | == 参数和效果 == | ||
{{ | {{MatParamDef | ||
| $detailtexturetransform|matrix|dx9 = 1 | | $detailtexturetransform|matrix|dx9 = 1 | ||
| 旋转、缩放等操作细节纹理。{{VMT UVtransform}} | | 旋转、缩放等操作细节纹理。{{VMT UVtransform}} | ||
Line 38: | Line 38: | ||
}} | }} | ||
{{ | {{MatParamDef | ||
|$detailscale| float | |$detailscale| float | ||
| 将细节纹理缩放到材质上的次数(默认值为4)。通常会用一个值约为7或8代替<code>$detailtexturetransform</code>,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:<code>$detailscale "[ 4 8 ]"</code> | | 将细节纹理缩放到材质上的次数(默认值为4)。通常会用一个值约为7或8代替<code>$detailtexturetransform</code>,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:<code>$detailscale "[ 4 8 ]"</code> | ||
}} | }} | ||
{{ | {{MatParamDef | ||
|$detailblendfactor|normal| | |$detailblendfactor|normal| | ||
控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于[[$alpha]]。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。 | 控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于[[$alpha]]。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。 | ||
Line 49: | Line 49: | ||
}} | }} | ||
{{ | {{MatParamDef | ||
|$detailblendmode| int | |$detailblendmode|int|text=细节材质与漫反射或反照率的结合方式。 | ||
| 细节材质与漫反射或反照率的结合方式。 | |||
: 可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。 | : 可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。 | ||
: 混合模式在{{Path|stdshaders/common_ps_fxc|h}}中实现。 | : 混合模式在{{Path|stdshaders/common_ps_fxc|h}}中实现。 | ||
Line 179: | Line 178: | ||
}} | }} | ||
}} | }} | ||
{{note|混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。}} | {{note|混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。}}}} | ||
{{ | {{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}} 一起工作。}} | ||
Line 189: | Line 188: | ||
}} | }} | ||
{{ | {{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|这些参数仅适用于 {{csgo}},还是在所有 {{csgobranch}} 分支的游戏中都可用?}} | {{Confirm|这些参数仅适用于 {{csgo}},还是在所有 {{csgobranch}} 分支的游戏中都可用?}} | ||
{{ | {{MatParamDef|$detail2|纹理|仅限={{csgo}}|着色器=WorldVertexTransition| | ||
用于 {{ent|WorldVertexTransition}} 第二层的细节纹理。 | 用于 {{ent|WorldVertexTransition}} 第二层的细节纹理。 | ||
{{Note|{{ent|LightmappedGeneric}} 技术上支持这些参数以及其他 <code>WorldVertexTransition</code> 参数,但它们可能无法按预期工作。}} | {{Note|{{ent|LightmappedGeneric}} 技术上支持这些参数以及其他 <code>WorldVertexTransition</code> 参数,但它们可能无法按预期工作。}} | ||
Line 204: | Line 203: | ||
}} | }} | ||
{{ | {{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> | ||
Line 219: | Line 218: | ||
{{ModernImportant|<code>$detail</code> 的参数名称非常相似,但实际不同!}} | {{ModernImportant|<code>$detail</code> 的参数名称非常相似,但实际不同!}} | ||
{{ | {{MatParamDef|$detail1|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第二层的细节纹理。}} | ||
{{ | {{MatParamDef|$detail1blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy| | ||
如何将细节材质与反照率合并。 | 如何将细节材质与反照率合并。 | ||
有两种不同的细节混合方法可用: | 有两种不同的细节混合方法可用: | ||
Line 241: | Line 240: | ||
}} | }} | ||
{{ | {{MatParamDef|$detail1scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | ||
{{ | {{MatParamDef|$detail1blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}} | ||
{{ | {{MatParamDef|$detail1frame|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|启动动画的 <code>$detail1</code> 纹理的帧。 | ||
{{ModernImportant|{{csgo}} 的 {{ent|WorldVertexTransition}} 着色器具有非常类似的 <code>$detail2</code> 参数名称,但实际不同!}}}} | {{ModernImportant|{{csgo}} 的 {{ent|WorldVertexTransition}} 着色器具有非常类似的 <code>$detail2</code> 参数名称,但实际不同!}}}} | ||
{{ | {{MatParamDef|$detail2|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第三层的细节纹理。}} | ||
{{ | {{MatParamDef|$detail2blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy| | ||
如何将细节材质与反照率合并。 | 如何将细节材质与反照率合并。 | ||
有两种不同的细节混合方法可用: | 有两种不同的细节混合方法可用: | ||
Line 270: | Line 269: | ||
}} | }} | ||
{{ | {{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 的细节纹理 == |
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 使纹理重复现象不那么明显的技巧