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

Zh/$bumpmap: Difference between revisions

From Valve Developer Community
< Zh
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{wip}}{{translate}}
{{translate}}
{{LanguageBar}}
{{LanguageBar}}
{{this is a|shader parameter|notext=1|name=$bumpmap}}
{{this is a|shader parameter|notext=1|name=$bumpmap}}


[[File:Brickwall021a normalcompare.jpg|thumb|A material's {{L|diffuse}} (left) compared to its normal map.]]
[[File:Brickwall021a normalcompare.jpg|thumb|材质的{{L|diffuse|漫反射贴图}}(左)与其法线贴图对比。]]
[[File:Example of bump mapping.jpg|thumb|The above material in-game.]]It specifies a {{L|texture}} that will provide three-dimensional lighting information for a material. The texture is a {{L|bump map}}, but the process it is used for is called {{w|normal mapping}}. The two terms are often used interchangeably, however.
[[File:Example of bump mapping.jpg|thumb|上述材质的游戏内效果。]]该参数指定为材质提供三维光照信息的{{L|texture|纹理}}。该纹理属于{{L|bump map|凹凸贴图}},但其应用过程被称为{{w|normal mapping|法线贴图}}。不过这两个术语常被混用。


{{warning|<code>$bumpmap</code> will disable {{ent|prop_static}}'s per-vertex lighting in every Source game before {{csgobranch|4}}.<br>
{{warning|<code>$bumpmap</code> 会在所有{{csgobranch|4}}之前的Source游戏中禁用{{ent|prop_static}}的逐顶点光照。<br>
Not enough data is stored in the vertices for normal mapping, so the engine has no choice but to fall back.}}
由于顶点中未存储足够的法线贴图数据,引擎只能回退处理。}}
{{important|Bumpmapped brushes and displacements generate four lightmaps per-surface (one for each light direction, plus non-bumped version), instead of one. If {{code|$bumpmap}} or {{code|$normalmap}} is added to a VMT that did not have it at the time of compilation, the map must be recompiled.
{{important|使用凹凸贴图的笔刷和置换表面会为每个面生成四张光照贴图(每个光照方向一张,外加非凹凸版本),而非一张。若在VMT中添加{{code|$bumpmap}}{{code|$normalmap}}但编译时未包含该参数,则地图必须重新编译。
{{note|This does not apply to maps compiled using the {{code|-bumpall}} {{L|VBSP}} parameter (Which creates 4 lightmaps for all faces, regardless of if they are bumpmapped). This parameter should not be used often, however, as it significantly increases lightmap usage.}}
{{note|此规则不适用于使用{{code|-bumpall}} {{L|VBSP}}参数编译的地图(该参数会为所有面生成4张光照贴图,无论是否启用凹凸贴图)。但应谨慎使用此参数,因其会显著增加光照贴图占用。}}
}}
}}
{{Important|<code>$bumpmap</code> does not exist for {{code|{{L|LightmappedReflective}}}}. Use <code>$normalmap</code> instead.}}
{{Important|<code>$bumpmap</code> 不适用于{{code|{{L|LightmappedReflective|光照反射}}}}。请改用<code>$normalmap</code>}}


{{note|
{{note|
* In the <code>{{L|Water_(shader)|Water}}</code> shader, <code>$bumpmap</code> is for a DX8 {{L|Du/dv_map|du/dv map}}. Use <code>$normalmap</code> instead.
* <code>{{L|Water_(shader)|Water|水材质}}</code>着色器中,<code>$bumpmap</code>用于DX8的{{L|Du/dv_map|du/dv贴图}}。请改用<code>$normalmap</code>
* Bump maps cannot be used on decal textures except in {{csgobranch|4}}.
* {{csgobranch|4}}外,贴花纹理无法使用凹凸贴图。
* On {{ent|VertexLitGeneric}} using {{ent|$lightwarptexture}} will force bumpmapping even if <code>$bumpmap</code> is not in the VMT. A default one is bound instead, all <code>$bumpmap</code> caveats come with it.}}
* {{ent|VertexLitGeneric}}中使用{{ent|$lightwarptexture}}会强制启用凹凸贴图,即使VMT中未声明<code>$bumpmap</code>。此时会绑定默认贴图,所有<code>$bumpmap</code>相关限制仍适用。}}
{{bug| <code>$bumpmap</code> causes some other Parameters to not work. Parameters that will break with <code>$bumpmap</code> are ( but not limited to ) :
{{bug| <code>$bumpmap</code> 会导致部分参数失效。受影响参数包括(但不限于):
* Will not work with materials using {{ent|$envmapmask}}. Except on {{ent|VertexLitGeneric}}{{mapbase|only}} and {{ent|LightmappedGeneric}}{{csgo|only}}. See {{L|$envmapmask#Alternative_methods|Alternative methods}}.
* 与使用{{ent|$envmapmask}}的材质不兼容。{{ent|VertexLitGeneric}}{{mapbase|}}{{ent|LightmappedGeneric}}{{csgo|}}除外。详见{{L|$envmapmask#Alternative_methods|替代方案}}
* In {{csgo}} {{ent|LightmappedGeneric}}, {{L|$detail#Parameters and Effects|$detailblendmode}} 9 cannot be used.
* {{csgo}}{{ent|LightmappedGeneric}}中无法使用{{L|$detail#Parameters and Effects|$detailblendmode}} 9。
* In {{csgo}} {{ent|VertexLitGeneric}}, {{L|$detail#Parameters and Effects|$detailblendmode}} 5, 6, 8, 9, 10 and 11 not usable. With {{ent|$phong}} 5 and 6 can be used.
* {{csgo}}{{ent|VertexLitGeneric}}中无法使用{{L|$detail#Parameters and Effects|$detailblendmode}} 5、6、8、9、10和11。若启用{{ent|$phong}}则5和6可用。
* In {{src13}}{{tf2}}{{as}} {{ent|VertexLitGeneric}}, {{L|$detail#Parameters and Effects|$detailblendmode}} 5-11 not usable. With {{ent|$phong}} 5 and 6 can be used.
* {{src13}}{{tf2}}{{as}}{{ent|VertexLitGeneric}}中无法使用{{L|$detail#Parameters and Effects|$detailblendmode}} 5-11。若启用{{ent|$phong}}则5和6可用。
* In {{src13}}{{tf2}}{{as}}{{csgo}} {{L|$detail#Parameters and Effects|$detailtint}} won't work.
* {{src13}}{{tf2}}{{as}}{{csgo}}{{L|$detail#Parameters and Effects|$detailtint}}无效。
* {{ent|$distancealpha}}, {{ent|$outline}}, {{ent|$softedges}} won't work.
* {{ent|$distancealpha}}{{ent|$outline}}{{ent|$softedges}}无效。
* On {{ent|LightmappedGeneric}}, cannot be used with {{ent|$basealphaenvmapmask}}
* {{ent|LightmappedGeneric}}中无法与{{ent|$basealphaenvmapmask}}共用。
}}
}}


==Basic Syntax==
==基础语法==
<syntaxhighlight lang=php highlight=5>
<syntaxhighlight lang=php highlight=5>
LightmappedGeneric
LightmappedGeneric
Line 37: Line 37:
</syntaxhighlight>
</syntaxhighlight>


==Additional Parameters==
==附加参数==
{{MatParam|$bumptransform|matrix|Transforms the bump map texture. {{todo|Does this actually require DX9? Present in DX8 fallback shaders.}}
{{MatParamDef|$bumptransform|matrix|对凹凸贴图纹理进行矩阵变换。{{todo|是否必须DX9?在DX8回退着色器中存在。}}
: {{bug|Does not work when using {{ent|$detail}}. This ''does'' work in {{csgobranch}}.}}
: {{bug|{{ent|$detail}}共用时失效。在{{csgobranch}}中有效。}}
{{VMT UVtransform}}|dx9=1}}
{{VMT UVtransform}}|dx9=1}}
{{MatParam|$bumpframe|int|The frame to start an animated bump map on.}}
{{MatParamDef|$bumpframe|int|设置动画凹凸贴图的起始帧。}}
{{MatParam|$nodiffusebumplighting|bool|Stops the bump map affecting the lighting of the material's {{L|albedo}}, which help combat {{L|Material optimization#Overdraw|overdraw}}. Does not affect the {{L|specular}} map, making it useful for distorted reflections on flat surfaces.
{{MatParamDef|$nodiffusebumplighting|bool|禁用凹凸贴图对材质{{L|albedo|反照率}}光照的影响,有助于缓解{{L|Material optimization#Overdraw|过度绘制}}。不影响{{L|specular|高光贴图}},适用于平面表面的扭曲反射效果。
: {{bug|Does not function beyond {{src07|2}}.{{confirm}}}}
: {{bug|{{src07|2}}之后版本失效.{{confirm}}}}
: {{note|Functions with {{L|$ssbump}} but not regular normals on {{game link|Source 2013}}. More testing required?}}
: {{note|{{game link|Source 2013}}中可与{{L|$ssbump}}共用,但常规法线贴图无效。需更多测试?}}
|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParam|$ssbump|bool|Flags the bump map texture(s) as being self-shadowing. Click for more details.|since={{src07}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParamDef|$ssbump|bool|将凹凸贴图标记为自阴影贴图。点击查看详情。|since={{src07}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParam|$forcebump|bool|If 0, use bumpmapping if the card says it can handle it. If 1, always force bumpmapping on.|dx8=1|removed={{l4d}}}}
{{MatParamDef|$forcebump|bool|0:根据显卡支持情况启用凹凸贴图;1:始终强制启用。|dx8=1|removed={{l4d}}}}
{{MatParam|$bump_force_on|bool|Force bump mapping on, even for low-end machines.|since={{portal2}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParamDef|$bump_force_on|bool|强制启用凹凸贴图,即使低端设备也生效。|since={{portal2}}|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParam|$addbumpmaps|bool|Enables the usage and blending of two bump maps together for {{ent|LightmappedGeneric}}.|only={{csgobranch}}|shaders=LightmappedGeneric}}
{{MatParamDef|$addbumpmaps|bool|{{ent|LightmappedGeneric}}中启用双凹凸贴图混合。|only={{csgobranch}}|shaders=LightmappedGeneric}}
{{MatParam|$bumpmap2|texture|The second bump map to use, either for {{ent|WorldVertexTransition}} or for <code>LightmappedGeneric</code> in {{csgobranch}} for bump map blending.|dx9=1|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParamDef|$bumpmap2|texture|第二张凹凸贴图,用于{{ent|WorldVertexTransition}}或{{csgobranch}}中<code>LightmappedGeneric</code>的凹凸贴图混合。|dx9=1|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParam|$bumpframe2|int|Same as <code>$bumpframe</code>, but for the second bump map.|dx9=1|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParamDef|$bumpframe2|int|<code>$bumpframe</code>,但作用于第二张凹凸贴图。|dx9=1|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParam|$bumptransform2|matrix|Same as <code>$bumptransform</code>, but for the second bump map.
{{MatParamDef|$bumptransform2|matrix|<code>$bumptransform</code>,但作用于第二张凹凸贴图。
: {{Note|{{ent|$detail}} used with <code>$detailscale</code> will override this on <code>LightmappedGeneric</code> if the shader is using <code>$addbumpmaps</code>.}}|dx9=1|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
: {{Note|<code>LightmappedGeneric</code>着色器使用<code>$addbumpmaps</code>,则{{ent|$detail}}配合<code>$detailscale</code>会覆盖此参数。}}|dx9=1|shaders=LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition}}
{{MatParam|$bumpmask|texture|If using two bump maps, use a third bump map to act as the base, with the alpha channel acting as a mask for the first two bump maps. The alpha channel of <code>$bumpmask</code> is also used as a specular mask.
{{MatParamDef|$bumpmask|texture|使用两张凹凸贴图时,可用第三张凹凸贴图作为基底,其alpha通道作为前两张的遮罩。<code>$bumpmask</code>的alpha通道也用作高光遮罩。
: {{note|Only used by {{hl2}}<code>materials/nature/toxicslime002a</code>.}}
: {{note|仅被{{hl2}}<code>materials/nature/toxicslime002a</code>使用。}}
: {{note|Does not work with {{ent|$detail}} and {{ent|$seamless_scale}}.}}|dx9=1|shaders=LightmappedGeneric}}
: {{note|{{ent|$detail}}{{ent|$seamless_scale}}不兼容。}}|dx9=1|shaders=LightmappedGeneric}}
{{MatParam|$bumpdetailscale1|and=$bumpdetailscale2|normal|The strength of the first and second bump maps for bump map blending.|only={{csgobranch}}|shaders=LightmappedGeneric}}
{{MatParamDef|$bumpdetailscale1|and=$bumpdetailscale2|normal|设置第一、第二张凹凸贴图在混合时的强度。|only={{csgobranch}}|shaders=LightmappedGeneric}}


==Console Commands==
==控制台命令==
{{IO|mat_fastnobump|param=bool|Quickly enables/disabled normal mapping.}}
{{Varcom|start}}
{{IO|mat_normalmaps|param=bool|Displays the bump map texture of all materials that have one in place of their {{L|diffuse}}.}}
{{Varcom|mat_fastnobump||bool|快速切换法线贴图启用状态。}}
{{IO|mat_bumpmap|param=bool|Enable or disable normal mapping. Default 1.}}
{{Varcom|mat_normalmaps||bool|将所有材质的凹凸贴图显示在{{L|diffuse|漫反射}}贴图位置。}}
{{Varcom|mat_bumpmap|1|bool|启用/禁用法线贴图。}}
{{Varcom|end}}


==See also==
==另见==
* {{ent|$ssbump}}
* {{ent|$ssbump}}
* {{L|Bump map}}, for technical details and a guide to creation.
* {{L|Bump map|凹凸贴图}},了解技术细节与制作指南。

Latest revision as of 12:10, 23 August 2025

Info content.png
This page needs to be translated.
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.(en)
English (en)Español (es)Français (fr)中文 (zh)Translate (Translate)

$bumpmap是一个材质(en)着色器(en)参数,可在所有的 起源 起源 游戏中使用。

材质的漫反射贴图(en)(左)与其法线贴图对比。
上述材质的游戏内效果。

该参数指定为材质提供三维光照信息的纹理(en)。该纹理属于凹凸贴图(en),但其应用过程被称为Wikipedia icon 法线贴图。不过这两个术语常被混用。

Warning.png警告:$bumpmap 会在所有CS:GO 引擎分支 CS:GO 引擎分支之前的Source游戏中禁用prop_static的逐顶点光照。
由于顶点中未存储足够的法线贴图数据,引擎只能回退处理。
Icon-Important.png重要:使用凹凸贴图的笔刷和置换表面会为每个面生成四张光照贴图(每个光照方向一张,外加非凹凸版本),而非一张。若在VMT中添加$bumpmap$normalmap但编译时未包含该参数,则地图必须重新编译。
Note.png注意:此规则不适用于使用-bumpall VBSP(en)参数编译的地图(该参数会为所有面生成4张光照贴图,无论是否启用凹凸贴图)。但应谨慎使用此参数,因其会显著增加光照贴图占用。
Icon-Important.png重要:$bumpmap 不适用于光照反射(en)。请改用$normalmap
Note.png注意:
Icon-Bug.png错误: $bumpmap 会导致部分参数失效。受影响参数包括(但不限于):   [todo tested in ?]

基础语法

LightmappedGeneric
{
	$basetexture	brick/brickwall021a
	$surfaceprop	brick
	$bumpmap		brick/brickwall021a_normal
}

附加参数

$bumptransform(en) <matrix(en)> (DX9 SM2)
对凹凸贴图纹理进行矩阵变换。
待完善: 是否必须DX9?在DX8回退着色器中存在。
Icon-Bug.png错误:$detail共用时失效。在CS:GO 引擎分支中有效。  [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 ?]
设置动画凹凸贴图的起始帧。
Shader(s): LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition
禁用凹凸贴图对材质反照率(en)光照的影响,有助于缓解过度绘制(en)。不影响高光贴图(en),适用于平面表面的扭曲反射效果。
Icon-Bug.png错误:起源2007 起源2007之后版本失效.[证实]  [todo tested in ?]
Note.png注意:起源2013 Source 2013 中可与$ssbump(en)共用,但常规法线贴图无效。需更多测试?
$ssbump(en) <布尔值(en)> (存在于自 起源2007 以来)
Shader(s): LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition
将凹凸贴图标记为自阴影贴图。点击查看详情。
$forcebump(en) <布尔值(en)> (DX8) (被移除求生之路 以来)
0:根据显卡支持情况启用凹凸贴图;1:始终强制启用。
$bump_force_on(en) <布尔值(en)> (存在于自 传送门2 以来)
Shader(s): LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition
强制启用凹凸贴图,即使低端设备也生效。
$addbumpmaps(en) <布尔值(en)> (存在于 CS:GO 引擎分支 之中)
Shader(s): LightmappedGeneric
LightmappedGeneric中启用双凹凸贴图混合。
$bumpmap2(en) <texture(en)> (DX9 SM2)
Shader(s): LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition
第二张凹凸贴图,用于WorldVertexTransitionCS:GO 引擎分支LightmappedGeneric的凹凸贴图混合。
$bumpframe2(en) <整数(en)> (DX9 SM2)
Shader(s): LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition
$bumpframe,但作用于第二张凹凸贴图。
$bumptransform2(en) <matrix(en)> (DX9 SM2)
Shader(s): LightmappedGeneric, Lightmapped_4WayBlend, WorldVertexTransition
$bumptransform,但作用于第二张凹凸贴图。
Note.png注意:LightmappedGeneric着色器使用$addbumpmaps,则$detail配合$detailscale会覆盖此参数。
$bumpmask(en) <texture(en)> (DX9 SM2)
Shader(s): LightmappedGeneric
使用两张凹凸贴图时,可用第三张凹凸贴图作为基底,其alpha通道作为前两张的遮罩。$bumpmask的alpha通道也用作高光遮罩。
Note.png注意:仅被半衰期2materials/nature/toxicslime002a使用。
Note.png注意:$detail$seamless_scale不兼容。
$bumpdetailscale1(en) and $bumpdetailscale2(en) <normal(en)> (存在于 CS:GO 引擎分支 之中)
Shader(s): LightmappedGeneric
设置第一、第二张凹凸贴图在混合时的强度。

控制台命令

控制台变量/命令 参数或默认值 描述符 效果
mat_fastnobump bool 快速切换法线贴图启用状态。
mat_normalmaps bool 将所有材质的凹凸贴图显示在漫反射(en)贴图位置。
mat_bumpmap 1 bool 启用/禁用法线贴图。

另见