Parallax Occlusion Map

From TrainzOnline
Jump to: navigation, search

Parallax Occlusion Mapping (POM) is a high-end GPU fragment shading technique which effectively adds a true height value to each texel.



Normal Mapping

In normal mapping, the lighting on each fragment is modified to act as if the surface was oriented in a different direction. This allows light to play across "surface bumps" as if they are present in the geometry. This offers a convincing result but suffers from various limitations when viewed at close range, including:

  • The lack of any parallax motion. For example, the tops of bumps (which should be closer to the camera) do not move across the field of view at a different speed to the bottom of holes (which should be further from the camera). This lack of relative motion reduces the effectiveness of the technique.
  • The lack of any form of self-occlusion. For example, seen at a grazing angle, a bump should occlude some amount of the flat surface behind the bump. Normal mapping does not provide this, and you can see the entire surface regardless of viewing angle.
  • The lack of any form of self-shadowing. For example, a bump does not case a shadow onto the nearby flat surface.

Together, these reduce the effectiveness of normal mapping, causing the result to be less convincing from certain angles, in certain lighting conditions, and where bumps or holes are of any significant depth.

Parallax Occlusion Mapping

POM adds texel height data, separately from the texel normal data. Each fragment is ray-traced on the GPU to determine the correct visual result, resolving all of the above limitations. This gives an exceedingly realistic result under many viewing conditions, at the expense of substantial GPU time.

The effect still has some limitations as compared to actual geometry:

  • The silhouette of the geometry is unchanged. At extreme glancing angles, it is still possible to see that the geometry has a flat silhouette. This is typically moderated by limited use of actual geometry to avoid a flat silhouette.
  • Multi-pass rendering techniques are unusable or of reduced effectiveness due to the height mismatches between the passes.
  • POM is sensitive to variations between the fragment normal and the face normal. Geometry where smoothed neighboring faces have substantially differing normals will give poor results where POM is used.

As with normal mapping, POM is expected to improve the visuals of already-acceptable geometry. It cannot be used to create the appearance of acceptable geometry from poor-quality geometry.

Heightmap Data

Each texel in a POM material has a single channel of heightmap data, normalised between 0.0 (sunk into the geometry to the maximum amount) to 1.0 (raised from the geometry to the maximum amount). Exactly what this means depends on the material in use. Typical mesh materials have 1.0 sitting flush with the geometry, with the outcome that it is only possible to push into the geometry, never pull out of it. Ground materials on the other hand have 0.5 at the reference ground height, with 0.0 pushed below reference and 1.0 above reference - this is effectively achieved by extruding the ground vertices before applying the POM effect.

Heightmap data may be edited by hand in a program such as Adobe Photoshop as long as a linear color space is used. Use of a non-linear color space will result in an incorrect mid-point and distorted height ranges. When manually editing heightmap data, be sure to use a tool to rebuild the normal map data so that the two data sets stay in sync- having the two effects simulating conflicting surface detail will give poor results.


Parallax Occlusion Mapping can be very GPU-intensive. We expect that users with low-to-mid range GPUs will have this effect disabled. Disabling the effect is a settings toggle and simply results in the height data being ignored.


There are a number of possible artifacts which result from the use of the POM technique. POM is not a "set and forget" technique- content creators need to design appropriate geometry, use appropriate UV mapping, and test the results carefully. Specifically, it is the content creator's responsibility to deal with the following:

  • POM may cause texels to be visible which are from outside the UV-mapped area of the texture.
    • The more extreme the viewing angle and the deeper the parallax, the further outside the designated mapping the user will be able to see.
    • The simplest use of POM, which avoids this problem entirely, is to use the full range of a texture that employs texture tiling along both axes.
      • In some cases, this requires using a number of additional materials because textures which could previously be part of a texture atlas now need their own unique tiling texture.
      • If you increase the number of materials in this way, you should ensure to use a different strategy in your lower LODs to avoid blowing out the number of draw calls. Disabling POM at lower LODs is a valid strategy.
    • Alternatively, the content creator may deploy various strategies to avoid this artifact being noticeable to the user:
      • If the POM geometry is fully enclosed by other geometry such that it cannot be viewed at a sharp angle, this artifact may not be problematic.
      • If the POM displacement map includes a full-height border of sufficient texel width, any trace heading outside the desired area will be blocked by that border.
      • If the texture is not tiled, the trace can be blocked by the edge of the texture in the normal fashion.
  • POM is heavily sensitive to the texels-to-meters ratio at each fragment.
    • It is critical that each texel is mapped such that it is nearly square and of a consistent size.


Personal tools