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

Zh/$envmapmask: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
(deepseek translation)
No edit summary
 
Line 29: Line 29:
[[File:Scanner mask.jpg|thumb|250px|{{L|npc_cscanner}}的遮罩效果]]
[[File:Scanner mask.jpg|thumb|250px|{{L|npc_cscanner}}的遮罩效果]]


{{MatParam|$envmapmasktransform|矩阵|
{{MatParamDef|$envmapmasktransform|矩阵|
: 用于变换高光遮罩纹理。
: 用于变换高光遮罩纹理。
{{bug|在{{ent|VertexLitGeneric}}材质上无效。}}
{{bug|在{{ent|VertexLitGeneric}}材质上无效。}}
{{VMT UVtransform}}|dx9=1}}
{{VMT UVtransform}}|dx9=1}}
{{MatParam|$envmapmaskscale|浮点数|按给定值缩放高光遮罩。另见上文<code>$envmapmasktransform</code>参数。|dx8=1}}
{{MatParamDef|$envmapmaskscale|浮点数|按给定值缩放高光遮罩。另见上文<code>$envmapmasktransform</code>参数。|dx8=1}}
{{MatParam|$envmapmaskframe|整数|动画高光遮罩的起始帧编号。}}
{{MatParamDef|$envmapmaskframe|整数|动画高光遮罩的起始帧编号。}}
====CS:GO WorldVertexTransition专用参数====
====CS:GO WorldVertexTransition专用参数====
{{MatParam|$envmapmask2|纹理|{{ent|WorldVertexTransition}}第二层的高光遮罩。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$envmapmask2|纹理|{{ent|WorldVertexTransition}}第二层的高光遮罩。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParam|$envmapmasktransform2|矩阵|<code>$envmapmask2</code>的纹理变换矩阵。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$envmapmasktransform2|矩阵|<code>$envmapmask2</code>的纹理变换矩阵。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParam|$envmapframe2|整数|动画<code>$envmapmask2</code>的起始帧编号。|only={{csgo}}|shaders=WorldVertexTransition}}
{{MatParamDef|$envmapframe2|整数|动画<code>$envmapmask2</code>的起始帧编号。|only={{csgo}}|shaders=WorldVertexTransition}}


==替代方法==
==替代方法==
Line 46: Line 46:
若使用以下命令,应用于{{code|$basetexture / $bumpmap}}的变换及其他参数将同时影响高光遮罩。
若使用以下命令,应用于{{code|$basetexture / $bumpmap}}的变换及其他参数将同时影响高光遮罩。


{{MatParam|$basealphaenvmapmask|布尔值|使用{{code|$basetexture}}的alpha通道作为高光遮罩。}}
{{MatParamDef|$basealphaenvmapmask|布尔值|使用{{code|$basetexture}}的alpha通道作为高光遮罩。}}
{{note|
{{note|
* 嵌入{{code|$basetexture}}的alpha通道作用相反:透明区域反光,不透明区域哑光。这是因为(例如)窗户纹理的alpha遮罩通常为黑色以实现透明效果——而黑色遮罩区域恰好应是高反光区域。为避免仅为反转alpha遮罩而复制纹理文件,可使用此材质参数。
* 嵌入{{code|$basetexture}}的alpha通道作用相反:透明区域反光,不透明区域哑光。这是因为(例如)窗户纹理的alpha遮罩通常为黑色以实现透明效果——而黑色遮罩区域恰好应是高反光区域。为避免仅为反转alpha遮罩而复制纹理文件,可使用此材质参数。
Line 61: Line 61:
</ul>}}
</ul>}}


<br>{{MatParam|$normalmapalphaenvmapmask|布尔值|使用{{code|$bumpmap}}或{{code|$normalmap}}的alpha通道作为高光遮罩。
<br>{{MatParamDef|$normalmapalphaenvmapmask|布尔值|使用{{code|$bumpmap}}或{{code|$normalmap}}的alpha通道作为高光遮罩。
{{warning|若同时使用{{code|{{L|$phong|$basemapalphaphongmask}}}}或{{code|{{L|$phong|$basemapluminancephongmask}}}},将导致{{ent|$envmap}}的遮罩被后者覆盖。<br>
{{warning|若同时使用{{code|{{L|$phong|$basemapalphaphongmask}}}}或{{code|{{L|$phong|$basemapluminancephongmask}}}},将导致{{ent|$envmap}}的遮罩被后者覆盖。<br>
使用{{ent|$phong}}时'''存在额外限制''',请查阅其条目了解潜在问题。}}
使用{{ent|$phong}}时'''存在额外限制''',请查阅其条目了解潜在问题。}}
Line 69: Line 69:
:{{note| 在{{ent|$phong}}和{{L|发光纹理#.24selfillum|$selfillumfresnel}}共同作用时使用<code>$normalmapalphaenvmapmask</code>有特殊限制,请查阅{{ent|$phong}}条目获取详情。}}
:{{note| 在{{ent|$phong}}和{{L|发光纹理#.24selfillum|$selfillumfresnel}}共同作用时使用<code>$normalmapalphaenvmapmask</code>有特殊限制,请查阅{{ent|$phong}}条目获取详情。}}
* 在{{csgo}}的{{ent|LightmappedGeneric}}和{{ent|WorldVertexTransition}}材质上,{{code|{{L|$normalmapalphaenvmapmask}}}}无法与{{L|$detail#参数与效果|$detailblendmode}} "9"或{{ent|$envmapanisotropy}}共用。}}<br>
* 在{{csgo}}的{{ent|LightmappedGeneric}}和{{ent|WorldVertexTransition}}材质上,{{code|{{L|$normalmapalphaenvmapmask}}}}无法与{{L|$detail#参数与效果|$detailblendmode}} "9"或{{ent|$envmapanisotropy}}共用。}}<br>
<br>{{MatParam|$selfillum_envmapmask_alpha|浮点数|使用{{code|$envmapmask}}的alpha通道替代{{code|$basetexture}}的alpha作为{{ent|$selfillum}}遮罩。<br>
<br>{{MatParamDef|$selfillum_envmapmask_alpha|浮点数|使用{{code|$envmapmask}}的alpha通道替代{{code|$basetexture}}的alpha作为{{ent|$selfillum}}遮罩。<br>
: {{bug|此参数会取代{{code|$selfillum}}。若两者共用将导致错误,材质无法渲染。}}
: {{bug|此参数会取代{{code|$selfillum}}。若两者共用将导致错误,材质无法渲染。}}
: {{warning|仅适用于{{ent|VertexLitGeneric}}材质——注意<code>$envmapmask</code>在VertexLitGeneric上'''无法'''与{{ent|$bumpmap}}或{{ent|$phong}}共同工作。}}
: {{warning|仅适用于{{ent|VertexLitGeneric}}材质——注意<code>$envmapmask</code>在VertexLitGeneric上'''无法'''与{{ent|$bumpmap}}或{{ent|$phong}}共同工作。}}
{{todo|此参数并非<code>$envmapmask</code>的替代方案,实际需依赖该参数。<code>应移至"附加参数"章节</code>,并确保其他页面链接不受影响。}}}}
{{todo|此参数并非<code>$envmapmask</code>的替代方案,实际需依赖该参数。<code>应移至"附加参数"章节</code>,并确保其他页面链接不受影响。}}}}
<br>{{MatParam|$envmapmaskintintmasktexture|布尔值|使用{{ent|$tintmasktexture}}的红色通道作为高光遮罩。|only={{csgo}}|shaders=VertexLitGeneric}}
<br>{{MatParamDef|$envmapmaskintintmasktexture|布尔值|使用{{ent|$tintmasktexture}}的红色通道作为高光遮罩。|only={{csgo}}|shaders=VertexLitGeneric}}


==在3ds Max中将高光层级合并至法线贴图Alpha通道==
==在3ds Max中将高光层级合并至法线贴图Alpha通道==

Latest revision as of 12:10, 23 August 2025

Info content.png
This page is Machine translated
It is not recommended to use machine translation without any corrections.
If the article is not corrected in the long term, it will be removed.
Also, please make sure the article complies with the alternate languages guide.(en)
English (en)Français (fr)Русский (ru)中文 (zh)Translate (Translate)

$envmapmask是一个材质(en)着色器(en)参数,可在所有的 起源 起源 游戏中使用。 它定义了高光遮罩,用于控制材质的每个像素对$envmap光线的反射强度。遮罩应为灰度图像,其中纯白区域表示完全反射,纯黑区域表示无反射。对于不依赖$envmap的漫反射类型高光,请参见$phong

Icon-Bug.png错误:起源2007 起源2007引擎游戏中,若$envmapmask未存储在子文件夹中,将导致纹理无法在游戏中加载。
Warning.png警告:$envmapmask在多数情况下无法与使用$bumpmap/的材质共同作用;详见#替代方法
Warning.png警告:$envmapmask完全无法与使用$phong的材质共同工作。默认情况下,它会使用$basetexture的alpha通道作为环境贴图遮罩。
Note.png注意:尽管高光遮罩传统上是灰阶的,但也可使用彩色图像。此时颜色数据将作为逐像素的$envmaptint参数生效。

VMT语法示例

$envmapmask <纹理路径>
VertexLitGeneric(en)
{
	$envmap(en)			env_cubemap
	$envmapmask		"props/tvscreen_test"
}

附加参数

npc_cscanner(en)的遮罩效果
$envmapmasktransform(en) <矩阵(en)> (DX9 SM2)
用于变换高光遮罩纹理。
Icon-Bug.png错误:VertexLitGeneric材质上无效。  [todo tested in ?]
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 ?]
按给定值缩放高光遮罩。另见上文$envmapmasktransform参数。
动画高光遮罩的起始帧编号。

CS:GO WorldVertexTransition专用参数

$envmapmask2(en) <纹理(en)> (存在于 反恐精英:全球攻势 之中)
Shader(s): WorldVertexTransition
WorldVertexTransition第二层的高光遮罩。
$envmapmasktransform2(en) <矩阵(en)> (存在于 反恐精英:全球攻势 之中)
Shader(s): WorldVertexTransition
$envmapmask2的纹理变换矩阵。
$envmapframe2(en) <整数(en)> (存在于 反恐精英:全球攻势 之中)
Shader(s): WorldVertexTransition
动画$envmapmask2的起始帧编号。

替代方法

无需为高光遮罩创建全新纹理,可将其嵌入$basetexture$bumpmapalpha通道(en)中。使用$bumpmap的模型材质必须采用此方法。但请注意,这不会降低内存占用。

若使用以下命令,应用于$basetexture / $bumpmap的变换及其他参数将同时影响高光遮罩。

使用$basetexture的alpha通道作为高光遮罩。
Note.png注意:
  • 嵌入$basetexture的alpha通道作用相反:透明区域反光,不透明区域哑光。这是因为(例如)窗户纹理的alpha遮罩通常为黑色以实现透明效果——而黑色遮罩区域恰好应是高反光区域。为避免仅为反转alpha遮罩而复制纹理文件,可使用此材质参数。
  • 起源2007 起源2007反恐精英:全球攻势 反恐精英:全球攻势中,模型的alpha通道不会反转,但笔刷材质的alpha通道反转!
  • 起源2013中,模型的alpha通道仅在$phong禁用时反转!
  • 求生之路2中若存在$envmap则自动启用。不透明区域反光,透明区域哑光。设为true(en)可反转$basetexture的alpha通道行为。当材质无需透明效果时,允许$bumpmap(en)拥有独立的$phong(en)遮罩。
Icon-Bug.png错误:  [todo tested in ?]


使用$bumpmap$normalmap的alpha通道作为高光遮罩。
Warning.png警告:若同时使用$basemapalphaphongmask(en)$basemapluminancephongmask(en),将导致$envmap的遮罩被后者覆盖。
使用$phong存在额外限制,请查阅其条目了解潜在问题。
Icon-Bug.png错误:
Note.png注意:$phong$selfillumfresnel(en)共同作用时使用$normalmapalphaenvmapmask有特殊限制,请查阅$phong条目获取详情。



使用$envmapmask的alpha通道替代$basetexture的alpha作为$selfillum遮罩。
Icon-Bug.png错误:此参数会取代$selfillum。若两者共用将导致错误,材质无法渲染。  [todo tested in ?]
Warning.png警告:仅适用于VertexLitGeneric材质——注意$envmapmask在VertexLitGeneric上无法$bumpmap$phong共同工作。
待完善: 此参数并非$envmapmask的替代方案,实际需依赖该参数。应移至"附加参数"章节,并确保其他页面链接不受影响。


$envmapmaskintintmasktexture(en) <布尔值(en)> (存在于 反恐精英:全球攻势 之中)
Shader(s): VertexLitGeneric
使用$tintmasktexture的红色通道作为高光遮罩。

在3ds Max中将高光层级合并至法线贴图Alpha通道

要将高光层级贴图合并到法线贴图的Alpha通道,可创建复合贴图节点:法线贴图置于图层1,高光贴图置于遮罩1。右键点击复合贴图,选择"渲染贴图"并将新图像保存为文件(保存时需保持Gamma值为1.0,并选择32位/像素)。

Wall Worm 2.72+中的[Alpha Spec工具](http://dev.wallworm.com/topic/34/alpha_spec.html)可自动完成此流程。

另请参阅