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

$envmapmask

From Valve Developer Community
< Zh
Revision as of 20:53, 7 August 2025 by MoRanYue (talk | contribs) (deepseek translation)
Jump to navigation Jump to search
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 $envmapmaskscale $envmapmaskframe

CS:GO WorldVertexTransition专用参数

$envmapmask2 $envmapmasktransform2 $envmapframe2

替代方法

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

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

$basealphaenvmapmask

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 ?]


$normalmapalphaenvmapmask

Icon-Bug.png错误:
Note.png注意:$phong$selfillumfresnel(en)共同作用时使用$normalmapalphaenvmapmask有特殊限制,请查阅$phong条目获取详情。



$selfillum_envmapmask_alpha
$envmapmaskintintmasktexture

在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)可自动完成此流程。

另请参阅