Parallax mapping: Difference between revisions
IS NEW Puddy (talk | contribs) (removed //"LightmappedGeneric" in example VMF) |
(Small tweaks, csgo note) |
||
Line 1: | Line 1: | ||
[[Image:parallax_mapping.jpg|thumb|400px|Example of parallax mapping.]] | [[Image:parallax_mapping.jpg|thumb|400px|Example of parallax mapping.]] | ||
{{ | {{warning|Parallax maps are disabled in every Valve game except for {{csgo}}, although it will appear [[Fullbright|unlit]].}} | ||
{{note|This '''downloadable''' shader only works in the | {{note|This '''downloadable''' shader only works in the Episode 1 (2006) engine.}} | ||
'''Parallax mapping''' (also known as '''offset mapping''' or '''virtual displacement mapping''') is a shading technique that displaces the individual pixel height of a surface, so that when you look at it at an angle, the high points will obscure the low points behind them, making it look three-dimensional. The height data for each pixel comes from a [[ | '''Parallax mapping''' (also known as '''offset mapping''' or '''virtual displacement mapping''') is a shading technique that displaces the individual pixel height of a surface, so that when you look at it at an angle, the high points will obscure the low points behind them, making it look three-dimensional. The height data for each pixel comes from a [[$parallaxmap]] texture, which needs to be created for each parallax mapped material. | ||
Parallax mapping is an enhancement of the [[bump mapping]] technique. It is only worthwhile for textures that have a depth of at least a few centimeters, like deep-set bricks or stone. | Parallax mapping is an enhancement of the [[bump mapping]] technique. It is only worthwhile for textures that have a depth of at least a few centimeters, like deep-set bricks or stone. | ||
Line 39: | Line 39: | ||
</nowiki> | </nowiki> | ||
</pre> | </pre> | ||
===Adding a parallax map with the Parallax Occlusion Shader mod=== | ===Adding a parallax map with the Parallax Occlusion Shader mod=== | ||
{{note|This mod is obsolete, and does not work properly with [[HDR]]. There is [http://www.hl2world.com/bbs/1-vt46068.html a reincarnation of the Parallax Occlusion Shader mod] by the same author but that only works with models. A brush version is in the works. In the meantime, Parallax Occlusion Shader still works with HDR off.}} | {{note|This mod is obsolete, and does not work properly with [[HDR]]. There is [http://www.hl2world.com/bbs/1-vt46068.html a reincarnation of the Parallax Occlusion Shader mod] by the same author but that only works with models. A brush version is in the works. In the meantime, Parallax Occlusion Shader still works with HDR off.}} | ||
Line 63: | Line 60: | ||
<code>"$heightscale"</code>, defines the "depth" of the effect, takes values 0.0—1.0, default=0.4<br/> | <code>"$heightscale"</code>, defines the "depth" of the effect, takes values 0.0—1.0, default=0.4<br/> | ||
<code>"$heightmapsample"</code>, default=16<br /> | <code>"$heightmapsample"</code>, default=16<br /> | ||
Example VMT: | Example VMT: | ||
Line 81: | Line 74: | ||
</nowiki> | </nowiki> | ||
</pre> | </pre> | ||
==See also== | ==See also== | ||
* [[Material Creation]] | * [[Material Creation]] | ||
* [[Normal Map Creation]] | * [[Normal Map Creation]] | ||
* [[Wikipedia:Parallax mapping]] | * [[Wikipedia:Parallax mapping]] | ||
==External links== | ==External links== | ||
* [http://www.fpsbanana.com/tools/4343 Download] | * [http://www.fpsbanana.com/tools/4343 Download] | ||
[[Category:Material System]] | [[Category:Material System]] |
Revision as of 16:46, 29 November 2018



Parallax mapping (also known as offset mapping or virtual displacement mapping) is a shading technique that displaces the individual pixel height of a surface, so that when you look at it at an angle, the high points will obscure the low points behind them, making it look three-dimensional. The height data for each pixel comes from a $parallaxmap texture, which needs to be created for each parallax mapped material.
Parallax mapping is an enhancement of the bump mapping technique. It is only worthwhile for textures that have a depth of at least a few centimeters, like deep-set bricks or stone.
Creating a parallax mapped material
Creating a heightmap
Regardless of the way you are going to render them, creating parallax mapped materials always starts with creating a heightmap.
Adding a parallax map with the built-in support for parallax maps
Add these two lines to your Valve Material (.vmt) file:
"$parallaxmap" "texture name"
"$parallaxmapscale" <scale value>
Fill in the path and name of your heightmap on the first line, and a number between 0 and 1 on the second line. This number affects how deep the texture will look. 0.05
is an appropriate value for bricks.
Example VMT:
"LightmappedGeneric" { "$basetexture" "walls/brickwall" "$surfaceprop" "brick" "$bumpmap" "walls/brickwall_normal" "$parallaxmap" "walls/brickwall_height" "$parallaxmapscale" 0.05 }
Adding a parallax map with the Parallax Occlusion Shader mod

First, in the Valve Material (.vmt) file, after the line
"LightmappedGeneric"
add this line:
//"MN_PrlxLightmappedGeneric"
When playing a map with your parallax mapped material, comment out the first line. When compiling a map with your parallax mapped material in Hammer, comment out the last line. This (according to the author of the mod) is a workaround to a glitch in Source SDK.
Finally, add this line to your VMT file:
"$heightmap" "texture name"
Other parameters you may need:
"$heightscale"
, defines the "depth" of the effect, takes values 0.0—1.0, default=0.4
"$heightmapsample"
, default=16
Example VMT:
"MN_PrlxLightmappedGeneric" { "$basetexture" "walls/brickwall" "$surfaceprop" "brick" "$bumpmap" "walls/brickwall_normal" "$heightmap" "walls/brickwall_height" }