Tangent space

From TrainzOnline
Revision as of 10:24, 19 October 2017 by Windwalkr (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tangent Space is a specialized coordinate system used in fragment shading which can be considered as having the following properties:


  • Z points away from the surface (along the surface normal).
  • X points approximately along the texture mapping "S" axis. (Approximate since the fragment normal is frequently not at 90° to the "S" axis.)
  • Y points approximately along the texture mapping "T" axis. (Approximate since texture maps are frequently applied in a distorted fashion; ie. with the texture S and T axes not at 90° to each other.)

The Z axis is known as the "normal". The X axis is known as the "tangent". The Y axis is known as the "bitangent". It should be observed that Tangent Space is derived per-fragment, and varies across a rendered polygon based on the interpolation of the surface normal.

Normal maps are encoded in tangent space. To convert a single vector read from a normal space into model space, it is multiplied through the 'tangent basis matrix' (a matrix which encodes the tangent space axes). Tangent Space also affects other techniques such as Parallax mapping.

More technical details on tangent space and the related math can be found online- this is not a Trainz-specific subject matter.

Personal tools