Difference between revisions of "Parallax mapping"

From Valve Developer Community
Jump to: navigation, search
(link to Parallax Occlusion Shader for Half-Life 2 download)
Line 1: Line 1:
 
[[Category:Material System]]
 
[[Category:Material System]]
{{note|The parallax mapping feature is currently disabled in Source Engine shaders so you will not notice any results, but it is very easy to implement; hardly any coding experience is needed. Many mods have already implemented it. See "[http://wraiyth.freesuperhost.com/parallaxmapping/ps.htm Enabling Parallax mapping in the code]"}}
+
{{note|The parallax mapping feature is currently disabled in Source Engine shaders so you will not notice any results, but it is very easy to implement; hardly any coding experience is needed. Many mods have already implemented it. See "[http://wraiyth.freesuperhost.com/parallaxmapping/ps.htm Enabling Parallax mapping in the code]" Also you can download user-made  [http://files.filefront.com/HL2_ParallaxOcclusionShader1_1/;4873478;;/fileinfo.html Parallax Occlusion Shader for Half-Life 2]
 +
}}
  
 
A parallax map (also known as a Photonic map, Offset map or Virtual Displacement map) will cause your flat material to look 3D. Parallax maps compliment bump maps and normal maps. When you look at a parallax mapped material at an angle, the high points will obscure the low points behind them. This is only worthwhile for textures that have depth ranging at least a few centimeters, like deep-set bricks or stone. If you're not sure about using one, then don't bother.
 
A parallax map (also known as a Photonic map, Offset map or Virtual Displacement map) will cause your flat material to look 3D. Parallax maps compliment bump maps and normal maps. When you look at a parallax mapped material at an angle, the high points will obscure the low points behind them. This is only worthwhile for textures that have depth ranging at least a few centimeters, like deep-set bricks or stone. If you're not sure about using one, then don't bother.
Line 27: Line 28:
 
==External links==
 
==External links==
  
[http://wraiyth.freesuperhost.com/parallaxmapping/ps.htm Enabling Parallax mapping in the code]
+
* [http://wraiyth.freesuperhost.com/parallaxmapping/ps.htm Enabling Parallax mapping in the code]
 +
*[http://files.filefront.com/HL2_ParallaxOcclusionShader1_1/;4873478;;/fileinfo.html Parallax Occlusion Shader for Half-Life 2 download]

Revision as of 22:56, 17 March 2006

Note.png Note: The parallax mapping feature is currently disabled in Source Engine shaders so you will not notice any results, but it is very easy to implement; hardly any coding experience is needed. Many mods have already implemented it. See "Enabling Parallax mapping in the code" Also you can download user-made Parallax Occlusion Shader for Half-Life 2

A parallax map (also known as a Photonic map, Offset map or Virtual Displacement map) will cause your flat material to look 3D. Parallax maps compliment bump maps and normal maps. When you look at a parallax mapped material at an angle, the high points will obscure the low points behind them. This is only worthwhile for textures that have depth ranging at least a few centimeters, like deep-set bricks or stone. If you're not sure about using one, then don't bother.

Adding a parallax map

  1. Imagine your texture in 3D and create a new texture in grayscale where white corresponds to the pixels closest to you and black corresponds to pixels farthest from you. Save this as a TGA with _height at the end of the name and convert it to a VTF. Put it in the same directory as your texture.
  2. Add these two lines to your VMF:
    "$parallaxmap" "texture name"
    "$parallaxmapscale" <scale value>
    Fill in the path and name of your parallax map on the first line and a number between zero and one on the second line. This number affects how deep the texture will look. 0.05 is an appropriate value for bricks.
    If the bricks in the example brick wall texture were really thick and stuck out from the plaster, a parallax map might be appropriate. We would create a VTF as described above named brickwall_height.vtf and place it with the other texture files. Here's an example VMT for a parallax mapped material:
"LightmappedGeneric"
{
    "$basetexture" "walls/brickwall"
    "$surfaceprop" "brick"
    "$bumpmap" " walls/brickwall_normal"
    "$parallaxmap" "walls/brickwall_height"
    "$parallaxmapscale" 0.05
}

See also

Creating Materials

Creating Normal Maps

Wikipedia:Parallax mapping

External links