Sub topic 15
OpenGL vs DirectX Normal Map Conventions
Assume you can unwrap a mesh, create an Image Texture node, and connect a normal map in Blender. The main issue here is that OpenGL and DirectX use different meanings for the normal map's green channel.
The green-channel difference
A tangent-space normal map stores a surface direction as red, green, and blue color values:
- Red represents the tangent, or left-to-right surface direction.
- Green represents the bitangent, or up-and-down surface direction.
- Blue represents the direction away from the surface.
OpenGL normally treats green as positive Y. DirectX normally treats green as negative Y. The red and blue channels usually keep the same interpretation.
| Convention | Green-channel direction | Typical use |
|---|---|---|
| OpenGL | +Y | Blender and many offline renderers |
| DirectX | -Y | Many DirectX-based or game-engine workflows |
This is a coordinate convention, not a difference in mesh detail. A map baked for one convention can make dents look like bumps when read using the other convention.
Choosing the correct convention
Choose the convention required by the renderer that will display the asset. Do not choose based only on the software that created the map.
For a map used inside Blender, keep the image in Non-Color data mode and use the Normal Map node. Blender expects the usual OpenGL-style tangent-space orientation. If the result shows reversed bumps, check the map's convention before changing the mesh or UVs.
For a DirectX-oriented engine, invert the green channel before export or during import. Inverting green means replacing each green value with 1 - green. A pixel with green value 0.2 becomes 0.8. This preserves the red and blue channels.
Practical conversion workflow
- Bake the map in Blender.
- Test it on the low-poly material in Blender.
- Confirm the target engine's normal convention.
- If the engine expects DirectX, invert only the green channel.
- Export the converted image and test the asset under the engine's lighting.
Do not invert the entire image. That changes red and blue too, producing incorrect directions. Also avoid flipping the image vertically. A vertical image flip changes pixel positions, while a green-channel inversion changes the encoded surface direction.
Exercise
Exercise
A normal map looks correct in Blender but produces reversed relief in a DirectX-based engine. What should you change?
Show answer
Keep the red and blue channels unchanged and invert the green channel, either during export or in the engine's texture import settings.