$bumpmap: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Documented normal map blending from CSGO, removed $bumpoffset as it doesn't seem to exist, misc fixes)
(Changed to use Shaderparam and MatParam templates)
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 <code>'''$bumpmap'''</code> [[material]] 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|<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 <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.}}
Line 21: Line 21:


==Additional parameters==
==Additional parameters==
; <code>$bumptransform <[[matrix]]></code> {{dx9}}
{{MatParam|$bumptransform|matrix|Transforms the bump map texture. {{todo|Does this actually require DX9? Present in DX8 fallback shaders.}}
: Transforms the bump map texture. {{todo|Does this actually require DX9? Present in DX8 fallback shaders.}}
{{VMT UVtransform}}|dx9=1}}
{{VMT UVtransform}}
{{MatParam|[[$ssbump]]|bool|Flags the bump map texture 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> {{dx8}}
{{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. {{Todo|Does this actually exist? Seemingly not present in DX8 fallback shaders.}}
: {{bug|Does not function in Orange Box builds and later.}}}}
; <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 <code>[[LightmappedGeneric]]</code>.|since=CSGO}}
;<code>$nodiffusebumplighting <[[bool]]></code>
{{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}}
: 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}}
: {{bug|Does not function in Orange Box builds and later.}}
{{MatParam|$bumptransform2|matrix|Same as <code>$bumptransform</code>, but for the second bump map.
;<code>$forcebump <bool></code> {{dx8}}
: {{Note|<code>[[$detail]]</code> used with <code>$detailscale</code> will override this on <code>LightmappedGeneric</code>.}}|dx9=1}}
: If 0, use bumpmapping if the card says it can handle it. If 1, always force bumpmapping on.  
{{MatParam|$bumpdetailscale1|normal|The strength of the first bumpmap, used for bump map blending.|since=CSGO}}
; <code>$addbumpmaps <bool></code> {{CSGO add}}
{{MatParam|$bumpdetailscale2|normal|The strength of the second bumpmap, used for bump map blending.|since=CSGO}}
: Enables the usage and blending of two bump maps together for <code>[[LightmappedGeneric]]</code>.
; <code>$bumpmap2 <texture></code> {{dx9}}
: The second bump map to use, for either <code>[[WorldVertexTransition]]</code> or for <code>LightmappedGeneric</code> in {{csgo}} for bump map blending.
; <code>$bumpframe2 <integer></code> {{dx9}}
: Same as <code>$bumpframe</code>, but for the second bump map.
; <code>$bumptransform2 <matrix></code> {{dx9}}
: 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>.}}
; <code>$bumpdetailscale1 <[[normal]]></code> {{CSGO add}}
: The strength of the first bumpmap, used for bump map blending.
; <code>$bumpdetailscale2 <normal></code> {{CSGO add}}
: The strength of the second bumpmap, used for bump map blending.


==Console commands==
==Console commands==

Revision as of 08:49, 26 June 2019

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

Template:Shaderparam 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.pngWarning:$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.pngNote:
  • 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 [[$ssbump|$ssbump]] $bumpscale $bumpframe $nodiffusebumplighting $forcebump $addbumpmaps $bumpmap2 $bumpframe2 $bumptransform2 $bumpdetailscale1 $bumpdetailscale2

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