/
DirectX- vs OpenGL-Style normal maps
Search
Notion
DirectX- vs OpenGL-Style normal maps
1 backlink
If you import normal maps from CC0Textures.com into Blender, Unity or some other programs the normal map can sometimes look a little bit… off.
Reflections might appear to go in the wrong direction and the perception of height does not feel right.
What is happening?
This behavior has to do with the different ways the two big graphic standards OpenGL and DirectX convert the Y-Axis of 3D space into the green color channel of the normal map.
CC0 Textures creates its normal maps according to the DirectX standard, this means that in some tools which expect OpenGL-style maps the results may look distorted.
How can I fix this?
There are two ways of dealing with this issue:
Editing the map itself
You can simply invert the green color channel of the normal map. This will convert a DirectX map to openGL and vice versa.
Open up the normal map in the image editor of your choice and open the color curves. Open the curve for the green color channel and invert it. You can invert an individual color channel by moving the beginning of its curve all the way to the top and the end all the way to the bottom (as shown in the picture).
If you have the ImageMagick CLI tool installed you can also use this command to perform the same action:
magick.exe convert "./input.png" -channel g -negate +channel "./output.png"
PowerShell
Fixing the map "on the fly"
You can also perform this action using pretty much every 3D Software that has a node editor.
Just split the normal map into its RGB Channels, invert the green one using an “Invert” node and merge them back together. The image shows this setup in Blender. Similar setups should be possible in Substance Designer or Unity.