DirectX vs OpenGL Normal Map

In this article, you will learn what normal map is, the difference between the normal formats of DirectX and OpenGL and its importance.
Besides, the expected normal formats by common 3D software will be listed.

What is a Normal Map?

A normal map is a texture mapping technique used by rendering engines to fake the lighting of bumps and dents of a surface so that it can make additional details appear on 3D models. The word ‘fake’ means those extra bumps and dents do not actually exist on the model. They are created by lighting illusion.
Smooth Surface of Model
Fake Bumps and Dents by Normal Map
Actual Geometry: Simple Sphere Fake bumps and dents created by normal map
Normal maps are usually blue, purple or greenish.

Typical Normal Map

Why Normal Map?

Normal map can add details to low poly models without additional vertices. Therefore, it can enhance the details of 3D models without further subdivision. Thus, it saves a lot of memory usage and reduces a lot of rendering time.

The following brick wall is created by a plane of 4 vertices. Imagine how many more vertices are required to model the same wall without normal map?
Details Bumps and Dents from 4 Vertices

Normal Map Formats

There are 2 standard formats of normal maps, DirectX and OpenGL. Both have the same capability, only their green channel (RGB map) is inverted to each another.

DirectX Normal Map
OpenGL Normal Map
DirectX Normal Map OpenGL Normal Map
DirectX expects the first pixel to be at the top while OpenGL expects it to be at the bottom. The top-down direction of DirectX is referred as Y- while the bottom-top direction of OpenGL is known as Y+.

Normal Map of TextureCan

Most of the materials on TextureCan.com have offered both DirectX and OpenGL normal map formats.

The filenames of DirectX normal maps are ended with _normal_directx while those of OpenGL are ended with _normal_opengl.
Occasionally, a few materials provide only a single normal map. In this case, the normal map is of DirectX format.

Normal Formats by Applications

Here is a list of the normal formats expected by most common 3D software (to be precise, rendering engine):

Software DirectX OpenGL
3DS Max  
Arnold  
Blender  
Cinema 4D  
Corona  
CryEngine  
Houdini  
Marmoset Toolbag  
Maya  
Octane  
Redshift  
Substance Painter  
Unity  
Unreal Engine  
VRay  
Zbrush  

What will Happen if Using Wrong Normal Map?

If the rendering engine expects a OpenGL normal map, but a DirectX normal map is loaded or vice versa, it will mess up the highlights and shadows.

If you compare the muddy bumps, both have some difference. In severe cases, bumps may become dents and vice versa.

Correct Normal Map
Incorrect Normal Map
Correct Normal Map Incorrect Normal Map
There are also areas, the resulting appearance does not have much difference even if a wrong normal format is used. For example, the puddles between the two images do not have much difference.

To ensure you always get a desire result, please feed the correct normal map to your renderer.

Convert Normal Map Format

Most texture sets in TextureCan.com provide both normal format. You only need to pick the correct one.
In case, only 1 normal format is provided, you can convert between DirectX and OpenGL format by inverting the green channel in any imaging software or the 3D software itself.

If the software has a curve editor (such as Photoshop) or curve node (such as Blender), you may invert the green channel as thus:
Original Green Channel
Green Channel Inverted
Original Green Channel Green Channel Inverted
Remember to select the green channel first.

In Blender, you may also invert the green channel this way, but it involves more nodes:

Typical Normal Map

I hope you have a better understanding of DirectX and OpenGL normal maps.

Thank you for reading thus far!