OpenGL vs DirectX Normal Maps: Which One Your Engine Needs

OpenGL vs DirectX normal maps come down to one thing: which way the green channel points. Use the wrong one and bumps look like dents.

Updated

The only difference is green

A normal map stores a direction in each pixel. It tells the light which way the surface faces. Red is left to right, green is up and down, and blue points out of the surface. The two styles disagree on which way is "up" for green. OpenGL maps are Y+, so a surface facing the top of the texture is bright green. DirectX maps are Y−, so the same surface is dark green. Red and blue are the same in both.

Which format each engine expects

  • OpenGL (Y+): Unity, Godot, Blender, Maya, the glTF format, three.js.
  • DirectX (Y−): Unreal Engine, 3ds Max, Source.
  • Substance Painter and Designer can export either one. Check the export preset.

How to tell which one you have

Find a detail that clearly sticks out, such as a rivet or a brick. In an OpenGL map, its top edge is greener (lighter in the green channel) and its bottom edge is darker. In a DirectX map, it is the other way round. In the engine, a wrong map makes the light look upside down. With a light from above, raised details get lit on their lower edge.

Converting between the two

Flip the green channel and nothing else. In an image editor, pick the green channel and invert it. Most engines can also do it when you import. Unreal Engine has a Flip Green Channel checkbox in the texture settings. Godot has a similar option for normal maps in the import dock.

Making the normal map from a height map? Then pick the right style when you make it, and there is nothing to convert.

Other reasons a normal map looks wrong

  • It was imported as a colour texture. Normal maps hold data, not colour, so they must be linear. Set the texture type to Normal map in Unity, or Compression Settings to Normalmap in Unreal.
  • The height was flipped when the map was made. Now the whole surface is inside out, not just flipped up and down.
  • The mesh has no tangents. Or its tangents were worked out in a different way than in the tool that baked the map.

Next: pack the other maps

Once the normal map is right, put the other grayscale maps into one packed texture. Those are metallic, occlusion and roughness.

Tools for this guide

All tools →

More guides

All guides →