Difference between revisions of "$bumpmap"

From Valve Developer Community
Jump to: navigation, search
(Changed to use Shaderparam and MatParam templates)
(Changed CSGO parameters to CSGO only as they aren't in any other games, combined $bumpdetailscale1 & 2 into one MatParam template, kept other "2" parameters seperate due to extra details specific to them, misc fixes)
 
Line 4: Line 4:
 
{{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.
 
{{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|<code>$bumpmap</code> will disable <code>[[prop_static]]</code>'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.}}
+
{{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|
Line 23: Line 23:
 
{{MatParam|$bumptransform|matrix|Transforms the bump map texture. {{todo|Does this actually require DX9? Present in DX8 fallback shaders.}}
 
{{MatParam|$bumptransform|matrix|Transforms the bump map texture. {{todo|Does this actually require DX9? Present in DX8 fallback shaders.}}
 
{{VMT UVtransform}}|dx9=1}}
 
{{VMT UVtransform}}|dx9=1}}
{{MatParam|[[$ssbump]]|bool|Flags the bump map texture as being self-shadowing. Click for more details.|since=EP2}}
+
{{MatParam|[[$ssbump]]|bool|Flags the bump map texture(s) as being self-shadowing. Click for more details.|since=EP2}}
 
{{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}}
 
{{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}}
 
{{MatParam|$bumpframe|int|The frame to start an animated bump map on.}}
 
{{MatParam|$bumpframe|int|The frame to start an animated bump map on.}}
 
{{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.
 
{{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.
: {{bug|Does not function in Orange Box builds and later.}}}}
+
: {{bug|Does not function beyond {{Game link|Source 2007}}.}}}}
 
{{MatParam|$forcebump|bool|If 0, use bumpmapping if the card says it can handle it. If 1, always force bumpmapping on.|dx8=1}}
 
{{MatParam|$forcebump|bool|If 0, use bumpmapping if the card says it can handle it. If 1, always force bumpmapping on.|dx8=1}}
{{MatParam|$addbumpmaps|bool|Enables the usage and blending of two bump maps together for <code>[[LightmappedGeneric]]</code>.|since=CSGO}}
+
{{MatParam|$addbumpmaps|bool|Enables the usage and blending of two bump maps together for {{ent|LightmappedGeneric}}.|only=CSGO}}
{{MatParam|$bumpmap2|texture|The second bump map to use, for either <code>[[WorldVertexTransition]]</code> or for <code>LightmappedGeneric</code> in {{csgo}} for bump map blending.|dx9=1}}
+
{{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}}
 
{{MatParam|$bumpframe2|int|Same as <code>$bumpframe</code>, but for the second bump map.|dx9=1}}
 
{{MatParam|$bumpframe2|int|Same as <code>$bumpframe</code>, but for the second bump map.|dx9=1}}
 
{{MatParam|$bumptransform2|matrix|Same as <code>$bumptransform</code>, but for the second bump map.
 
{{MatParam|$bumptransform2|matrix|Same as <code>$bumptransform</code>, but for the second bump map.
 
: {{Note|<code>[[$detail]]</code> used with <code>$detailscale</code> will override this on <code>LightmappedGeneric</code>.}}|dx9=1}}
 
: {{Note|<code>[[$detail]]</code> used with <code>$detailscale</code> will override this on <code>LightmappedGeneric</code>.}}|dx9=1}}
{{MatParam|$bumpdetailscale1|normal|The strength of the first bumpmap, used for bump map blending.|since=CSGO}}
+
{{MatParam|$bumpdetailscale1|and=$bumpdetailscale2|normal|The strength of the first and second bump maps for bump map blending.|only=CSGO}}
{{MatParam|$bumpdetailscale2|normal|The strength of the second bumpmap, used for bump map blending.|since=CSGO}}
 
  
 
==Console commands==
 
==Console commands==
Line 46: Line 45:
  
 
==See also==
 
==See also==
* <code>[[$ssbump]]</code>
+
* {{ent|$ssbump}}
 
* [[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 20:38, 24 August 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 <bool>
Quickly enables/disabled normal mapping.
mat_normalmaps <bool>
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!)

See also