13
$\begingroup$

I'm curious which type of normal map works better? DirectX or OpenGL normal maps? Which one to use for cycles and eevee?

$\endgroup$
1
  • 8
    $\begingroup$ Blender expects normal maps in the OpenGL format. The difference between the two is that the green channel is inverted from one to the other, so in the end it doesn't matter what you use, if you know how to use it - you get the same result. $\endgroup$ Commented Feb 3, 2018 at 16:06

2 Answers 2

18
$\begingroup$

Only DirectX applications use DX normal maps. And DirectX run only under Windows mainly due to license. For everything else you need to use OpenGL. For sure is good always check documentation.

On images below you can find simple ways how to convert DX to OpenGL (or OpenGL to DX) using separate/combine nodes with an invert node inbetween the Y sockets, or using a Vector Curves node with its Y curve inverted:

enter image description here

enter image description here

$\endgroup$
3
  • $\begingroup$ so when i use blender on windows I can use the DirectX version? $\endgroup$ Commented Apr 28, 2019 at 19:56
  • $\begingroup$ @DrachenSeele - unfortunately no, because Blender itself doesn't support DirectX textures $\endgroup$
    – Shubol3D
    Commented May 6, 2019 at 19:45
  • 1
    $\begingroup$ OK, is there any way to distinguish DX and OGL? $\endgroup$ Commented May 6, 2019 at 19:47
18
$\begingroup$

Blender uses the OpenGL format. This image shows an optimized version of normal map conversion, because it doesn't convert between number and color, so it is faster with Cycles and EEVEE:

OpenGL to DirectX normal map

This second picture shows how you can recognize OpenGL normal maps just by looking at them. Notice, that on OpenGL normal map it looks as if there is light shining from the top right (or opposite), while on DirectX it's from the bottom right direction (or opposite). enter image description here

$\endgroup$
7
  • 1
    $\begingroup$ I really don't get what you mean by this part: " This image shows an optimized version of normal map conversion, because it doesn't convert between number and color, so it is faster with Cycles and EEVEE" $\endgroup$ Commented Jan 28, 2020 at 14:50
  • $\begingroup$ Grey dots on nodes are numbers - one value. Yellow are colors. If you'd use Invert node, Cycles needs to convert the single number to RGB and then back. So if you do nodes it's good to stick with grey(number) inputs and outputs if possible. $\endgroup$ Commented Jan 30, 2020 at 12:47
  • $\begingroup$ Where do you get this info from? How do you know it differs? Color nodes do maths with numerical values they just come from colors - that's the same. Even if we say that color management transforms impact performance(which is definitely not perceivable in any way in practice), normal maps are set to non-color data, so there is no color management for them. As far as I know there should be no difference at all in this case. I mean have you tested it, or looked through the source code? $\endgroup$ Commented Jan 30, 2020 at 13:34
  • $\begingroup$ Yes I have tested it when building complex procedural shaders, and the performance difference was perceptible. Normal map is set to non-color, but how does the Invert node know this, when it gets numeric input? Even with no color management, it's still 3x the same operation(invert is 1-x on all channels) - probably calculated on each sample of the material, so many million/billion times per image. $\endgroup$ Commented Jan 30, 2020 at 14:24
  • 1
    $\begingroup$ There is a reason not to use the color nodes - even without color correction, you still operate on 3 values instead of on one. And as I mentioned, I tested performance impact in some more complicated node setups. $\endgroup$ Commented Feb 13, 2020 at 16:06

You must log in to answer this question.