Parallax mapping: Difference between revisions
(Formatting update) |
|||
Line 72: | Line 72: | ||
}</nowiki>}} | }</nowiki>}} | ||
===Adding parallax map with | ===Adding parallax map with the PBR shader=== | ||
[[File:Thexa4 pbr parallax 1.png|thumb|300px|right|Parallax enabled.]] | [[File:Thexa4 pbr parallax 1.png|thumb|300px|right|Parallax enabled.]] | ||
{{note| Follow the tutorial [[Adding PBR_to_Your_Mod|Adding PBR to Your Mod]] to implement the shader into your source sdk project | Games running on {{strata|4}} or with Thexa4's PBR shader installed can use parallax mapping already. | ||
{{warning| | {{note| Follow the tutorial [[Adding PBR_to_Your_Mod|Adding PBR to Your Mod]] to implement the shader into your source sdk project. This shader is compatible with [[HDR]] and with {{src13|4}}.}} | ||
{{note|All {{Strata|4}} games use a similar method.}} | |||
{{warning|An [[$mraotexure]] is needed to use the PBR features.}} | |||
[[File:Thexa4 pbr parallax 0.png|300px|thumb|right|Parallax Disabled.]] | [[File:Thexa4 pbr parallax 0.png|300px|thumb|right|Parallax Disabled.]] | ||
To make the effect work you will need to have these 3 parameters in your [[VMT]]: | To make the effect work you will need to have these 3 parameters in your [[VMT]]: | ||
Line 86: | Line 88: | ||
To make the parallax mapping work you will need to put your [[Heightmap]] into the [[Bump_map]]'s alpha channel! | To make the parallax mapping work you will need to put your [[Heightmap]] into the [[Bump_map]]'s alpha channel! See [[Creating PBR materials#Embedding the Heightmap|Creating PBR materials]] for a tutorial on how to do this. | ||
Example VMT: | Example VMT: | ||
Line 98: | Line 100: | ||
"$envmap" "env_cubemap" | "$envmap" "env_cubemap" | ||
"$surfaceprop" "Default" | "$surfaceprop" "Default" | ||
"$model" "0" | "$model" "0" //not needed for Strata games | ||
"$parallax" "1" | "$parallax" "1" |
Revision as of 08:54, 25 October 2023





ParallaxTest
, which can be used as an alternative.




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:
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:
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:
Adding parallax map with the PBR shader
Games running on Strata Source or with Thexa4's PBR shader installed can use parallax mapping already.





To make the effect work you will need to have these 3 parameters in your VMT:
$parallax
bool
- Enables/Disables parallax mapping.
$parallaxdepth
float
- Controls the intensity of the parallax effect.
$parallaxcenter
float
- Center depth of the Parallax Map.
To make the parallax mapping work you will need to put your Heightmap into the Bump_map's alpha channel! See Creating PBR materials for a tutorial on how to do this.
Example VMT: