Parallax Occlusion Map

From TrainzOnline
Revision as of 14:41, 15 September 2017 by Windwalkr (Talk | contribs)

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.

Parallax-occlusion-map.png

Contents

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.

Performance

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.

Samples

Personal tools