$bumpmap: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to 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]]

Revision as of 13:38, 24 August 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

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