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



中,使用LightmappedGeneric时,与$seamless_scale不兼容。 - 在



中,使用VertexLitGeneric时,与$selfillumfresnel不兼容(如果使用了$bumpmap)。 - 在


中,使用LightmappedGeneric时,与$lightwarptexture不兼容。
注意:
- 在
中,LightmappedGeneric似乎根本没有$lightwarptexture参数,因此不能“不起作用”。 - 在

中,使用VertexLitGeneric时,与$desaturatewithbasealpha不兼容。 - 在
中,与$blendmodulatetexture和$bumpmap不兼容。
- 在
- 待完善: 记录其他Source分支的相关问题。
错误:在使用$detail和$blendmodulatetexture时会导致图形问题(表面出现条纹),仅在
和
中能正常工作。 [todo tested in ?]
语法
$detail <texture>
您可能需要至少使用$detailscale(详见下文)。
参数和效果
- $detailtexturetransform <matrix> (DX9 SM2)
- 旋转、缩放等操作细节纹理。The default position is
center .5 .5 scale 1 1 rotate 0 translate 0 0.centerdefines the point of rotation. Only useful ifrotateis being used.scalefits the texture into the material the given number of times.2 1is a 50% scale in the horizontal X axis while the vertical Y axis is still at original scale.rotaterotates the texture counter-clockwise in degrees. Accepts any number, including negatives.translateshifts the texture by the given numbers..5will 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 ?]
错误:此参数在LightmappedGeneric、WorldVertexTransition、LightmappedTwoTexture、WorldTwoTextureBlend以及仅限(仅存在于
之中)的Lightmapped_4WayBlend中不存在。 [todo tested in ?]
- $detailscale <浮点型>
- 将细节纹理缩放到材质上的次数(默认值为4)。通常会用一个值约为7或8代替
$detailtexturetransform,用于128px的细节纹理。若要分别缩放X和Y坐标,请将值放在方括号内:$detailscale "[ 4 8 ]"
- $detailblendfactor <normal>
- 控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于$alpha。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。
错误:对$detailblendmode为1或5的UnlitGeneric无效(在
中测试)。 [todo tested in ?]
- $detailblendmode <整数>
- 细节材质与漫反射或反照率的结合方式。
- 可以使用12种不同的细节混合方法,但并非所有模式都适用于所有着色器(详见下文)。
- 混合模式在
stdshaders/common_ps_fxc.h中实现。
模式 效果 描述 0 DecalModulate 此模式与DecalModulate着色器功能相同——颜色低于128会使图像变暗,高于128会使图像变亮。
提示: 使用
VTEX的mipblend选项,可以让使用此混合模式的细节纹理在远处“渐隐”,从而减少锯齿效果。
1 加法模式 细节纹理的颜色会添加到基础纹理上。这与$additive类似,但它会受到光照的影响(参见模式5)。 2 半透明细节 细节纹理作为半透明覆盖层应用于基础纹理之上。 3 混合因子渐隐 细节纹理作为半透明覆盖层应用,但忽略其Alpha通道,而是使用混合因子来决定基础纹理的显示程度。 4(?) 半透明基础 实质上颠倒了两种纹理的正常叠加顺序。细节纹理显示在“下方”,基础纹理的Alpha通道控制其作为半透明覆盖层的效果。细节纹理的Alpha通道控制整体材质的Alpha值——用于半透明、遮罩或其他用途。
证实:可能与VRAD纹理阴影不兼容,因为VRAD显式查找$basetexture。5 无光照加法 细节纹理的颜色与基础纹理以模式1相同的方式相加,但细节纹理的颜色不受光照影响,因此看起来会发光。 6 无光照加法阈值渐隐 类似于模式5,但首先根据混合因子是否高于0.5来以两种模式修改添加的颜色。 澄清: 如何修改?7 双模式DecalModulate 仅使用细节纹理的红色和Alpha通道。与DecalModulate着色器或模式0类似,但基础纹理的Alpha通道会在使用红色(0)或Alpha(255)细节通道作为调制源之间进行渐隐。这实质上允许两个细节材质,但两者都是灰度的。
提示: 如果使用此混合模式的细节纹理需要存储为未压缩格式,建议使用IA88代替BGRA8888,以减半文件大小且无质量损失。
8 乘法模式 基础通道的颜色乘以细节纹理的颜色。 9 基础遮罩通过细节Alpha 仅使用细节的Alpha通道,并将其与基础纹理的Alpha通道相乘,生成最终的Alpha值。
提示: 使用A8代替DXT5,以在相同文件大小下提升质量。
10 自阴影凹凸贴图 细节纹理作为(可能额外的)$ssbump凹凸贴图使用。忽略混合因子。
注意: 可用于在同一材质上获得标准凹凸贴图和自阴影凹凸贴图。然而,这非常耗资源,应谨慎使用。
重要: 此模式需要一个$bumpmap!如果Detailtexture VTF标记了SSBump标志,并且存在$bumpmap,则会自动使用此模式!
11 SSBump反照率 类似于环境光遮蔽纹理,使用SSBump纹理。通过计算SSBump的高于平均值的“亮度”实现。 计算公式为
Basetexture * (DetailTexture.r * (2/3) + DetailTexture.g * (2/3) + DetailTexture.b * (2/3))
重要: 此模式无法与$bumpmap一起使用。如果Detailtexture VTF标记了SSBump标志,此模式会自动使用!
重要: 以下列出了适用于特定游戏和着色器的各种模式限制。使用不支持的混合模式可能/将导致“Missing Shader Combo”错误充斥控制台,材质将无法渲染!
分支 着色器 限制
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。
|}
对于模式8,使用LightmappedTwoTexture。
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不支持。
注意: 混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。
- $detailtint <RGB 矩阵>
- 细节纹理的颜色染色。
错误: 在
中,应用于 VertexLitGeneric 时,无法与 $bumpmap 或 $phong 一起工作。 [todo tested in ?]
错误:无法与 $blendtintbybasealpha 一起工作。
[todo tested in ?]
- $detailframe <整数> (DX9 SM2)
- 启动动画的
$detail纹理的帧。
- $detail_alpha_mask_base_texture <布尔>
- WorldVertexTransition 专用。启用后,细节的 alpha 通道将决定“基础纹理混合”。
WorldVertexTransition 参数
- $detail2 <纹理>
- 用于 WorldVertexTransition 第二层的细节纹理。
注意: LightmappedGeneric 技术上支持这些参数以及其他 WorldVertexTransition参数,但它们可能无法按预期工作。
注意: 没有 $detailtransform2,着色器将改用 $basetexturetransform2!
重要: 需要同时存在 $detail和$basetexture2!
错误:无法与 $detailblendmode "9"一起使用。 [todo tested in ?]
- $detailscale2 <浮点数>
- $detail2 的细节缩放比例。
- $detailblendfactor2 <正常值>
- $detail2 的细节混合因子。
注意: $detailblendfactor和$detailblendfactor2在与基础纹理组合之前会先被混合。
- $detailframe2 <整数>
- 启动动画的
$detail2纹理的帧。
- $detailtint2 <RGB 矩阵>
- $detail2 的颜色染色。

SolidEnergy 参数
$detail1tint 和 $detail2tint 在此着色器中不存在,因此故意未列出!
$detail 的参数名称非常相似,但实际不同!
- $detail1 <纹理>
- 用于 SolidEnergy 第二层的细节纹理。
- $detail1blendmode <整数>
- 如何将细节材质与反照率合并。
有两种不同的细节混合方法可用:
模式 效果 描述 0 DecalModulate 此功能与 DecalModulate 着色器相同—颜色值低于 128 会使图像变暗,高于 128 会使图像变亮。 1 Multiply $basetexture与$detail1相乘,$basetexture的 alpha 通道控制效果的强度。黑色部分完全乘积,白色部分无乘积。
- $detail1scale <浮点数>
- $detail2 的细节缩放比例。
注意: 似乎无任何效果。
- $detail1blendfactor <浮点数>
- $detail2 的细节混合因子。
注意: 似乎无任何效果。
- $detail1frame <整数>
- 启动动画的
$detail1纹理的帧。
重要:
的 WorldVertexTransition 着色器具有非常类似的 $detail2参数名称,但实际不同!
- $detail2 <纹理>
- 用于 SolidEnergy 第三层的细节纹理。
- $detail2blendmode <整数>
- 如何将细节材质与反照率合并。
有两种不同的细节混合方法可用:
模式 效果 描述 0 Additive 将 $detail2添加到$basetexture。
注意: 使用 $detail1时,$detail2首先会与$detail2相乘!1 Multiply $basetexture与$detail2相乘。
注意: 无法控制效果的强度。
- $detail2scale <浮点数>
- $detail2 的细节缩放比例。
注意: 似乎无任何效果。
- $detail2blendfactor <浮点数>
- $detail2 的细节混合因子。
注意: 似乎无任何效果。
- $detail2frame <整数>
- 启动动画的
$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 使纹理重复现象不那么明显的技巧
