Conventions and axis orientation used by various applications for tangent space normal maps.
There is no clear convention for the orientation of the axis used by tangent space normal maps. Two "styles" emergent though, and I will call them, to make it simple, the DirectX style and the OpenGl style.
The difference between them resides in the orientation of the Y axis, which corresponds to the green channel of the texture.
Note that the orientation of the V axis, in the texture coordinates system, is not reliable to define the type of normal map used by an application.
What style is this?
It is very useful to have the normal map convention "in the eye" when working on a given piece of software. This allows you to recognize at a glance if a normal map is valid or flipped.
Here are some reference maps that can help to keep in mind how they should like like. They can also be used directly in the application to check which convetion it uses.
To differenciate on style from the other just remind you that:
"In DirectX style the pink is at the top right side of an extruded shape"
How to know the style of a 3D application?
The style of several common 3D applications is listed in this article.
If you need to check another application, follow these steps:
- Download the Normal Maps package at the bottom of this page and unzip it
- In the 3D application create a plane and place a point light above it, with a slight offset
- Creates a material for the plane and put one of the normal maps of the package in the base color and in the normal map channel (remebr it is a Tangent Space normal map)
- Then move the light on each of the horizontal axis separately; the specular highlight on the plane should follow the light. It should react as if it were the highlight of an extruded hemisphere. If the highlight reacts strangely on one of the axis then the application is not of the style of the chosen normal map. Try with the other style.
- If the first test is a success then run this second test. It will ensure the normal map reacts well even if the plane is not aligned with the world.
Put the light a bit aside of the plane, pick the plane and rotate it around the vertical axis. The highlight should stay at the same position.
Converting from one style to the other
To convert a tangent space normal map from a style to the other, just open the texture in Photoshop and invert the green channel. It practice this operation is equivalent to a multiplication of the Y axis per -1.
Although in this case Photoshop or any other image editor can be used keep in mind that a normal map in, well, a map of normals. It is not an image. In other words most of the common images operations such as a contrast, a level, a rotation... will very likely "break" the normals and produce stange results. And a normal map is pretty sensitive...
FixNormalMaps.zip - A set of references tangent space normal maps in .PNG file format.