$ssbump: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(→‎Third Party Tools: Added SSbump Generator link)
m (added language bar.)
Line 1: Line 1:
{{lang|$ssbump}}[[Category:List of Shader Parameters|S]]
[[Image:Ssbump examples.jpg|right|thumb|256px|Comparing SSBump with standard bump mapping and no mapping at all.]]
[[Image:Ssbump examples.jpg|right|thumb|256px|Comparing SSBump with standard bump mapping and no mapping at all.]]


Line 8: Line 9:


== Example ==
== Example ==
[[Image:Rockwall cave 02a height-ssbump.jpg|thumb|256px|rockwall_cave_02a_height-ssbump.vtf]]
[[Image:Rockwall cave 02a height-ssbump.jpg|thumb|256px|rockwall_cave_02a_height-ssbump.vtf]]
[[Image:Face-ssbump.jpg|thumb|256px|A simpler example: each surface is flat.]]
[[Image:Face-ssbump.jpg|thumb|256px|A simpler example: each surface is flat.]]
Line 25: Line 25:


== Limitations ==
== Limitations ==
The shadows cast by the bump map are permanently baked into the texture, [http://www.interlopers.net/forum/viewtopic.php?f=16&t=27513 meaning that they can only appear in one of three predefined locations]. <code>height2ssbump</code> generates shadows for light arriving from the right, top-left, and bottom-left of the texture. If light arrives from between those directions (such as from the left), the nearest available baked shadows are blended between, producing an acceptable but hardly ideal image.
The shadows cast by the bump map are permanently baked into the texture, [http://www.interlopers.net/forum/viewtopic.php?f=16&t=27513 meaning that they can only appear in one of three predefined locations]. <code>height2ssbump</code> generates shadows for light arriving from the right, top-left, and bottom-left of the texture. If light arrives from between those directions (such as from the left), the nearest available baked shadows are blended between, producing an acceptable but hardly ideal image.


Line 31: Line 30:


== Creation ==
== Creation ==
You need to use '''<code>height2ssbump</code>''', a [[command line]] SDK tool. The command is:
You need to use '''<code>height2ssbump</code>''', a [[command line]] SDK tool. The command is:


  height2ssbump <options> <path\to\[[heightmap]].tga> <[[float]]|bumpscale>
  height2ssbump <options> <path\to\[[heightmap]].tga> <[[float]]|bumpscale>


The output is <code><input name>-ssbump.tga</code>, in the same folder as the input file. <code>Bumpscale</code> controls the intensity of the ssbump (i.e. coarseness of the surface).  
The output is <code><input name>-ssbump.tga</code>, in the same folder as the input file. <code>Bumpscale</code> controls the intensity of the ssbump (i.e., coarseness of the surface).  


{{note|Bizarrely, the tool examines ''only the [[alpha channel]] of the input TGA''. The original alpha channel will be passed on to the output TGA, but serves no purpose and should be deleted.}}
{{note|Bizarrely, the tool examines ''only the [[alpha channel]] of the input TGA''. The original alpha channel will be passed on to the output TGA, but serves no purpose and should be deleted.}}
Line 44: Line 42:
{{tip|If you are generating an SSbump from a Valve-created heightmap, you may need to remove the alpha channel from the heightmap first, and then copy the Green channel into a replacement Alpha channel in order to generate the SSbump correctly. This can be caused by leftover [[Specular]] maps in the Alpha channel most likely used in the generation of [[$envmapmask|Env map masks]] that are stored in the alpha channel of a [[Normal_Maps|Normal map]] and enabled via the {{ent|$normalmapalphaenvmapmask}} material parameter.}}
{{tip|If you are generating an SSbump from a Valve-created heightmap, you may need to remove the alpha channel from the heightmap first, and then copy the Green channel into a replacement Alpha channel in order to generate the SSbump correctly. This can be caused by leftover [[Specular]] maps in the Alpha channel most likely used in the generation of [[$envmapmask|Env map masks]] that are stored in the alpha channel of a [[Normal_Maps|Normal map]] and enabled via the {{ent|$normalmapalphaenvmapmask}} material parameter.}}


[[Image:Valve_Heightmap_SSbump_Alpha_differences.png|thumb|256px|Difference in generating an SSbump from Valve heightmaps that have a pre-existing alpha channels.]]
[[Image:Valve_Heightmap_SSbump_Alpha_differences.png|thumb|256px|Difference in generating an SSbump from Valve heightmaps that have preexisting alpha channels.]]
[[Image:height2ssbump bumpscale.jpg|thumb|256px|A showcase of how bumpscale values affect the output of height2ssbump.]]
[[Image:height2ssbump bumpscale.jpg|thumb|256px|A showcase of how bumpscale values affect the output of height2ssbump.]]


=== Options ===
=== Options ===
;<code><path/filename></code>
;<code><path/filename></code>
:The source [[heightmap]] (TGA format).
:The source [[heightmap]] (TGA format).
Line 65: Line 62:


=== Third Party Tools ===
=== Third Party Tools ===
Third-party tools capable of generating SSbump maps:
Third-party tools capable of generating SSbump maps:


Line 71: Line 67:
*[http://www.xnormal.net/1.aspx Xnormal]
*[http://www.xnormal.net/1.aspx Xnormal]
*[https://sourceforge.net/projects/ssbumpgenerator/ SSbump Generator]
*[https://sourceforge.net/projects/ssbumpgenerator/ SSbump Generator]
 
{{SDKTools}}[[Category:VMT Lighting]]
{{SDKTools}}
 
[[Category:List of Shader Parameters|S]]

Revision as of 15:49, 9 May 2022

English (en)Translate (Translate)
Comparing SSBump with standard bump mapping and no mapping at all.

Template:Shaderparam It is a boolean parameter that flags a $bumpmap texture as being a self-shadowing bump map.

Standard bump maps only darken texels that are facing away from a light source. Self-shadowing bump maps darken both texels facing away and also any texels which are 'behind' them. You can read more about the technology behind it in this paper.

Tip.pngTip:Self-shadowed normal mapping actually renders faster than standard normal maps!

Example

rockwall_cave_02a_height-ssbump.vtf
A simpler example: each surface is flat.
LightmappedGeneric
{
	$basetexture	nature/rockwall_cave02a
	$surfaceprop	concrete
	$bumpmap	nature/rockwall_cave_02a_height-ssbump

	$ssbump		1
	$SSBumpMathFix	1 // seen in L4D2, modifies the amount of light received. Can be any number (0 removes the effect)
}

Limitations

The shadows cast by the bump map are permanently baked into the texture, meaning that they can only appear in one of three predefined locations. height2ssbump generates shadows for light arriving from the right, top-left, and bottom-left of the texture. If light arrives from between those directions (such as from the left), the nearest available baked shadows are blended between, producing an acceptable but hardly ideal image.

Additionally, in order to preserve the illusion of height, low areas of a SSBumped material will receive less light even if it arrives head-on. This can look odd if you have too intense (rugged) a SSBump.

Creation

You need to use height2ssbump, a command line SDK tool. The command is:

height2ssbump <options> <path\to\heightmap.tga> <float|bumpscale>

The output is <input name>-ssbump.tga, in the same folder as the input file. Bumpscale controls the intensity of the ssbump (i.e., coarseness of the surface).

Note.pngNote:Bizarrely, the tool examines only the alpha channel of the input TGA. The original alpha channel will be passed on to the output TGA, but serves no purpose and should be deleted.

You can use normal2ssbump, another SDK tool, to generate an SSBump from a normal bump map (as opposed to a height or displacement map) - Unlike height2ssbump you do not need to run through the command line or use any additional parameters; simply drag-and-drop your normal map onto the program or a shortcut.

Tip.pngTip:If you are generating an SSbump from a Valve-created heightmap, you may need to remove the alpha channel from the heightmap first, and then copy the Green channel into a replacement Alpha channel in order to generate the SSbump correctly. This can be caused by leftover Specular maps in the Alpha channel most likely used in the generation of Env map masks that are stored in the alpha channel of a Normal map and enabled via the $normalmapalphaenvmapmask material parameter.
Difference in generating an SSbump from Valve heightmaps that have preexisting alpha channels.
A showcase of how bumpscale values affect the output of height2ssbump.

Options

<path/filename>
The source heightmap (TGA format).
-r <int>
Set the number of 'rays' (default 250). More rays take more time.
-n
Generate a conventional bump map as <input name>-bump.tga.
Template:L4D add
Generate an ssbump detail texture.
-A
Generate ambient occlusion in the alpha channel.
-f <int>
Set smoothing filter radius (default 10; 0 disables).
-D
Write out filtered result as filtered.tga.

Third Party Tools

Third-party tools capable of generating SSbump maps: