Click or drag to resize
DigitalRuneParallax Mapping

The ParallaxMappingSample (see Samples) shows how to implement a new light type which adds environment map reflections to all materials in the scene. This article provides additional background information and explanations.

This topic contains the following sections:

Parallax mapping

The new ParallaxMappingSample shows how to add a new materials that support Parallax Mapping with Offset Limiting and Parallax Occlusion Mapping.

Parallax mapping is an enhancement of normal mapping. While normal mapping makes bumps and dents appear under lighting, parallax mapping gives the material the appearance of depth – as shown in the following screenshots:

Parallax

The ground on the left is created using 3 texture maps:

Ground-Diffuse
Diffuse Texture
Ground-Specular
Specular Texture
Ground-Normal
Normal Texture

Parallax mapping uses an additional height map:

Ground-Height
Height Texture

The height map is used to offset the lookup into the other texture maps. This way, we can create the appearance of depth – even if the ground consists only of a flat triangles. There are many resources, which explain how parallax mapping works, for example [3] and [4].

In addition to standard Parallax Mapping with Offset Limiting and Parallax Occlusion Mapping, the sample code shows:

  • How to add a height bias, which lets you define whether the bumps should appear above or below the actual ground plane.
  • How to transition to normal mapping in the distance.
  • How to add simple soft self-shadowing.
References
  • [1] W. Engel, J. Hoxley, R. Kornmann, N. Suni, J. Zink: Techniques For Dynamic Per-Pixel Lighting. In Programming Vertex, Geometry, and Pixel Shaders. http://content.gpwiki.org/index.php/D3DBook:(Lighting)_Per-Pixel_Lighting
  • [2] N.Tatarchuk: Practical Parallax Occlusion Mapping with Approximate Soft Shadows for Detailed Surface Rendering. In ShaderX5: Advanced Rendering Techniques, edited by W. Engel