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

Zh/$detail: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 31: Line 31:


== 参数和效果 ==
== 参数和效果 ==
{{MatParam
{{MatParamDef
| $detailtexturetransform|matrix|dx9 = 1
| $detailtexturetransform|matrix|dx9 = 1
| 旋转、缩放等操作细节纹理。{{VMT UVtransform}}
| 旋转、缩放等操作细节纹理。{{VMT UVtransform}}
Line 38: Line 38:
}}
}}


{{MatParam
{{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>
}}
}}


{{MatParam
{{MatParamDef
|$detailblendfactor|normal|
|$detailblendfactor|normal|
控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于[[$alpha]]。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。
控制细节纹理对基础纹理的影响量。这取决于混合模式;在大多数情况下,它的作用类似于[[$alpha]]。值为0时通常使细节纹理无效果,而值为1时会完全应用细节效果。
Line 49: Line 49:
}}
}}


{{MatParam
{{MatParamDef
|$detailblendmode| int
|$detailblendmode| int
| 细节材质与漫反射或反照率的结合方式。
| 细节材质与漫反射或反照率的结合方式。
Line 181: Line 181:
{{note|混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。}}
{{note|混合模式5和6在光照后应用。混合模式10在光照期间应用。其他所有混合模式均在光照前应用。}}


{{MatParam|$detailtint|RGB 矩阵|细节纹理的颜色染色。
{{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 189:
}}
}}


{{MatParam|$detailframe|整数|dx9=1|启动动画的<code>$detail</code>纹理的帧。}}
{{MatParamDef|$detailframe|整数|dx9=1|启动动画的<code>$detail</code>纹理的帧。}}


{{MatParam|$detail_alpha_mask_base_texture|布尔|已移除={{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|纹理|仅限={{csgo}}|着色器=WorldVertexTransition|
{{MatParamDef|$detail2|纹理|仅限={{csgo}}|着色器=WorldVertexTransition|
用于 {{ent|WorldVertexTransition}} 第二层的细节纹理。
用于 {{ent|WorldVertexTransition}} 第二层的细节纹理。
{{Note|{{ent|LightmappedGeneric}} 技术上支持这些参数以及其他 <code>WorldVertexTransition</code> 参数,但它们可能无法按预期工作。}}
{{Note|{{ent|LightmappedGeneric}} 技术上支持这些参数以及其他 <code>WorldVertexTransition</code> 参数,但它们可能无法按预期工作。}}
Line 204: Line 204:
}}
}}


{{MatParam|$detailscale2|浮点数|<tt>$detail2</tt> 的细节缩放比例。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParamDef|$detailscale2|浮点数|<tt>$detail2</tt> 的细节缩放比例。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParam|$detailblendfactor2|正常值|<tt>$detail2</tt> 的细节混合因子。{{Note|<code>$detailblendfactor</code> 和 <code>$detailblendfactor2</code> 在与基础纹理组合之前会先被混合。}}|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParamDef|$detailblendfactor2|正常值|<tt>$detail2</tt> 的细节混合因子。{{Note|<code>$detailblendfactor</code> 和 <code>$detailblendfactor2</code> 在与基础纹理组合之前会先被混合。}}|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParam|$detailframe2|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParamDef|$detailframe2|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParam|$detailtint2|RGB 矩阵|<tt>$detail2</tt> 的颜色染色。|仅限={{csgo}}|着色器=WorldVertexTransition}}
{{MatParamDef|$detailtint2|RGB 矩阵|<tt>$detail2</tt> 的颜色染色。|仅限={{csgo}}|着色器=WorldVertexTransition}}
<br>
<br>


Line 219: Line 219:
{{ModernImportant|<code>$detail</code> 的参数名称非常相似,但实际不同!}}
{{ModernImportant|<code>$detail</code> 的参数名称非常相似,但实际不同!}}


{{MatParam|$detail1|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第二层的细节纹理。}}
{{MatParamDef|$detail1|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第二层的细节纹理。}}


{{MatParam|$detail1blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|
{{MatParamDef|$detail1blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|
如何将细节材质与反照率合并。
如何将细节材质与反照率合并。
有两种不同的细节混合方法可用:
有两种不同的细节混合方法可用:
Line 241: Line 241:
}}
}}


{{MatParam|$detail1scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParamDef|$detail1scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}


{{MatParam|$detail1blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParamDef|$detail1blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}


{{MatParam|$detail1frame|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|启动动画的 <code>$detail1</code> 纹理的帧。   
{{MatParamDef|$detail1frame|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|启动动画的 <code>$detail1</code> 纹理的帧。   
{{ModernImportant|{{csgo}} 的 {{ent|WorldVertexTransition}} 着色器具有非常类似的 <code>$detail2</code> 参数名称,但实际不同!}}}}
{{ModernImportant|{{csgo}} 的 {{ent|WorldVertexTransition}} 着色器具有非常类似的 <code>$detail2</code> 参数名称,但实际不同!}}}}


{{MatParam|$detail2|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第三层的细节纹理。}}
{{MatParamDef|$detail2|纹理|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|用于 {{ent|SolidEnergy}} 第三层的细节纹理。}}


{{MatParam|$detail2blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|
{{MatParamDef|$detail2blendmode|整数|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy|
如何将细节材质与反照率合并。
如何将细节材质与反照率合并。
有两种不同的细节混合方法可用:
有两种不同的细节混合方法可用:
Line 270: Line 270:
}}
}}


{{MatParam|$detail2scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParamDef|$detail2scale|浮点数|<tt>$detail2</tt> 的细节缩放比例。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}


{{MatParam|$detail2blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParamDef|$detail2blendfactor|浮点数|<tt>$detail2</tt> 的细节混合因子。{{Note|似乎无任何效果。}}|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}


{{MatParam|$detail2frame|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}
{{MatParamDef|$detail2frame|整数|启动动画的 <code>$detail2</code> 纹理的帧。|仅限={{csgo}}{{portal2}}|着色器=SolidEnergy}}


== Valve 的细节纹理 ==   
== Valve 的细节纹理 ==   

Revision as of 12:08, 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 ?]

{{MatParamDef |$detailblendmode| int | 细节材质与漫反射或反照率的结合方式。

可以使用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 使纹理重复现象不那么明显的技巧