Difference between revisions of "$bumpmap"

From Valve Developer Community
Jump to: navigation, search
(Added mat_bumpmap console command, changed console commands to use the IO template)
 
(10 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
[[Image:Example of bump mapping.jpg|thumb|The above material in-game.]]
 
[[Image:Example of bump mapping.jpg|thumb|The above material in-game.]]
  
The '''$bumpmap''' [[VMT]] parameter specifies a [[texture]] that will provide three-dimensional lighting information for a material. The texture is a [[bump map]], but the process it is used for is called [[Wikipedia:Normal mapping|normal mapping]]. The two terms are often used interchangeably, however.
+
{{Shaderparam|$bumpmap}} It specifies a [[texture]] that will provide three-dimensional lighting information for a material. The texture is a [[bump map]], but the process it is used for is called [[Wikipedia:Normal mapping|normal mapping]]. The two terms are often used interchangeably, however.
  
{{warning|$bumpmap will disable [[prop_static]]'s per-vertex lighting. Not enough data is stored in the vertices for normal mapping, so the engine has no choice but to fall back.}}
+
{{warning|<code>$bumpmap</code> will disable {{ent|prop_static}}'s per-vertex lighting in every Source game but {{csgo}}. Not enough data is stored in the vertices for normal mapping, so the engine has no choice but to fall back.}}
  
 
{{note|
 
{{note|
* In the <code>[[Water_(shader)|Water]]</code> shader, $bumpmap is for a DX8 [[Du/dv_map|du/dv map]]. Use <code>$normalmap</code> instead.
+
* In the <code>[[Water_(shader)|Water]]</code> shader, <code>$bumpmap</code> is for a DX8 [[Du/dv_map|du/dv map]]. Use <code>$normalmap</code> instead.
* The $bumpmap parameter is not compatible with decals textures.}}
+
* Bumpmaps cannot be used on decal textures, except in {{csgo}}.}}
  
 
==Basic syntax==
 
==Basic syntax==
Line 21: Line 21:
  
 
==Additional parameters==
 
==Additional parameters==
; <code>$bumptransform <matrix></code>
+
{{MatParam|$bumptransform|matrix|Transforms the bump map texture. {{todo|Does this actually require DX9? Present in DX8 fallback shaders.}}
: Transforms the bump map texture. Requires DirectX 9 or above.
+
{{VMT UVtransform}}|dx9=1}}
{{VMT UVtransform}}
+
{{MatParam|[[$ssbump]]|bool|Flags the bump map texture(s) as being self-shadowing. Click for more details.|since=EP2}}
; <code>[[$ssbump]]</code>
+
{{MatParam|$bumpscale|float|Scales the bump map by the given value in DirectX 8. {{Todo|Does this actually exist? Seemingly not present in DX8 fallback shaders.}}|dx8=1}}
: Flags the bump map texture as being self-shadowing. Click for more details.
+
{{MatParam|$bumpframe|int|The frame to start an animated bump map on.}}
; <code>$bumpscale <[[float]]></code>
+
{{MatParam|$nodiffusebumplighting|bool|Stops the bump map affecting the lighting of the material's [[albedo]], which help combat [[Material optimization#Overdraw|overdraw]]. Does not affect the [[specular]] map.
: Scales the bump map by the given value in DirectX 8.
+
: {{bug|Does not function beyond {{Game link|Source 2007}}.}}}}
; <code>$bumpframe <[[integer]]></code>
+
{{MatParam|$forcebump|bool|If 0, use bumpmapping if the card says it can handle it. If 1, always force bumpmapping on.|dx8=1}}
: The frame to start an animated bump map on.
+
{{MatParam|$addbumpmaps|bool|Enables the usage and blending of two bump maps together for {{ent|LightmappedGeneric}}.|only=CSGO}}
;<code>$nodiffusebumplighting <[[bool]]></code>
+
{{MatParam|$bumpmap2|texture|The second bump map to use, for either {{ent|WorldVertexTransition}} or for <code>LightmappedGeneric</code> in {{csgo}} for bump map blending.|dx9=1}}
: Stops the bump map affecting the lighting of the material's [[albedo]], which help combat [[Material optimization#Overdraw|overdraw]]. Does not affect the [[specular]] map.
+
{{MatParam|$bumpframe2|int|Same as <code>$bumpframe</code>, but for the second bump map.|dx9=1}}
;<code>$forcebump <bool></code>
+
{{MatParam|$bumptransform2|matrix|Same as <code>$bumptransform</code>, but for the second bump map.
: Forces DirectX 8 cards to render the bump map. They normally don't for performance reasons.
+
: {{Note|<code>[[$detail]]</code> used with <code>$detailscale</code> will override this on <code>LightmappedGeneric</code>.}}|dx9=1}}
; <code>$bumpoffset <?></code>
+
{{MatParam|$bumpdetailscale1|and=$bumpdetailscale2|normal|The strength of the first and second bump maps for bump map blending.|only=CSGO}}
: {{confirm|DX8 version of center?}}
 
; <code>$bumpmap2 <texture></code>
 
; <code>$bumpframe2 <integer></code>
 
: Used by the [[WorldVertexTransition]] shader in blend materials that display two textures. DirectX 9 required.
 
; <code>$bumpmapalphaphongmask <bool></code>  
 
: Uses the bump map's alpha as the phong mask for the base texture
 
{{Todo|Where did '''$bumpmapalphaphongmask''' come from? Doesn't phong already use the alpha channel of the bumpmap if one exists?}}
 
  
 
==Console commands==
 
==Console commands==
; <code>mat_fastnobump <[[bool]]></code>
+
{{IO|mat_fastnobump|param=bool|Quickly enables/disabled normal mapping.}}
: Quickly enables/disabled normal mapping.
+
{{IO|mat_normalmaps|param=bool|Displays the bump map texture of all materials that have one in place of their [[albedo]].}}
; <code>mat_normalmaps <bool></code>
+
:(Yes, these two commands have bump and normal the wrong way around!)
: Displays the bump map texture of all materials that have one in place of their [[albedo]].
+
{{IO|mat_bumpmap|param=bool|Enable or disable normal mapping. Default 1.}}
 
 
(Yes, these two commands have bump and normal the wrong way around!)
 
  
 
==See also==
 
==See also==
 
+
* {{ent|$ssbump}}
* <code>[[$ssbump]]</code>
 
 
* [[Bump map]], for technical details and a guide to creation.
 
* [[Bump map]], for technical details and a guide to creation.
  
 
[[Category:List of Shader Parameters|B]]
 
[[Category:List of Shader Parameters|B]]

Latest revision as of 23:12, 30 November 2019

A material's albedo (left) compared to its bump map.
The above material in-game.

$bumpmap is a material shader parameter available in all Source games. It specifies a texture that will provide three-dimensional lighting information for a material. The texture is a bump map, but the process it is used for is called normal mapping. The two terms are often used interchangeably, however.

Warning: $bumpmap will disable prop_static's per-vertex lighting in every Source game but <Counter-Strike: Global Offensive>. Not enough data is stored in the vertices for normal mapping, so the engine has no choice but to fall back.

Note:
  • In the Water shader, $bumpmap is for a DX8 du/dv map. Use $normalmap instead.
  • Bumpmaps cannot be used on decal textures, except in <Counter-Strike: Global Offensive>.

Basic syntax

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

Additional parameters

$bumptransform <matrix> (DX9+)
Transforms the bump map texture. To do: Does this actually require DX9? Present in DX8 fallback shaders.
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 X axis.
  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.
Note:All values must be included!
Bug: Scaling the texture may cause odd issues where the Texture Lock tool in Hammer will not actually lock the texture in place.
Bug: 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.
$ssbump <boolean> (New with Half-Life 2: Episode Two / Source 2007)
Flags the bump map texture(s) as being self-shadowing. Click for more details.
$bumpscale <float> (DX8)
Scales the bump map by the given value in DirectX 8. To do: Does this actually exist? Seemingly not present in DX8 fallback shaders.
$bumpframe <integer>
The frame to start an animated bump map on.
$nodiffusebumplighting <boolean>
Stops the bump map affecting the lighting of the material's albedo, which help combat overdraw. Does not affect the specular map.
Bug: Does not function beyond <Source> Source 2007.
$forcebump <boolean> (DX8)
If 0, use bumpmapping if the card says it can handle it. If 1, always force bumpmapping on.
$addbumpmaps <boolean> (Only in Counter-Strike: Global Offensive)
Enables the usage and blending of two bump maps together for LightmappedGeneric.
$bumpmap2 <texture> (DX9+)
The second bump map to use, for either WorldVertexTransition or for LightmappedGeneric in <Counter-Strike: Global Offensive> for bump map blending.
$bumpframe2 <integer> (DX9+)
Same as $bumpframe, but for the second bump map.
$bumptransform2 <matrix> (DX9+)
Same as $bumptransform, but for the second bump map.
Note:$detail used with $detailscale will override this on LightmappedGeneric.
$bumpdetailscale1 and $bumpdetailscale2 <normal> (Only in Counter-Strike: Global Offensive)
The strength of the first and second bump maps for bump map blending.

Console commands

mat_fastnobump <boolean>
Quickly enables/disabled normal mapping.
mat_normalmaps <boolean>
Displays the bump map texture of all materials that have one in place of their albedo.
(Yes, these two commands have bump and normal the wrong way around!)
mat_bumpmap <boolean>
Enable or disable normal mapping. Default 1.

See also