Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

Help Wanted Normal Map Format (DirectX & OpenGL) Incosistency Among Material Libraries

Discussion in 'High Definition Render Pipeline' started by passeridaepc, Apr 23, 2021.

  1. passeridaepc

    passeridaepc

    Joined:
    Jun 16, 2019
    Posts:
    157
    So, I'm acquiring and downloading materials from such sources as Quixel Megascans, Poliigon, Textures.com, CC0Textures and others. On many of these sites, you can find information about the normal map format that is being used. Most of such libraries (like Poliigon and Textures.com) go for OpenGL format. But in practice, if you download three random mats from, say Textures.com, you'll get this:

    These are three renders of their mats that come directly from the site:
    upload_2021-4-23_17-10-37.png

    Here are their normal maps applied to three Unity cubes:
    upload_2021-4-23_17-22-28.png

    So, the first one appears to be in DirectX format and the other two in OpenGL.

    So, here's a question to those people who work with materials: do you often come across such cases and how do you determine which normal format is in front of you in each particular situation?

    I've also faced another issue when I rotate such normal maps. I've tried special approaches like the one in this thread but for some normal maps (I have two examples from Poliigon and CC0Textures) they just don't work correctly until I also flip the red channel. Which is extremely weird, because the red channel is supposed to be correct in each format, right?
     
  2. M4dR0b

    M4dR0b

    Joined:
    Feb 1, 2019
    Posts:
    103
    Y-Hello there,

    If I remember correctly DirectX reads green values as being Y down or negative, and OpenGL reads green values as Y up or positive.

    normal_maps1.jpg

    Unity uses OpenGl Y+

    You can mostly tell them apart from the Green and Red channel being inverted.
     
  3. passeridaepc

    passeridaepc

    Joined:
    Jun 16, 2019
    Posts:
    157
    Yep, but my complaint is about the fact that certain websites state that their material libraries use OpenGL format, while in reality, it may be OpenGL for one material and DirectX for another.
     
  4. M4dR0b

    M4dR0b

    Joined:
    Feb 1, 2019
    Posts:
    103
    Well, that's mostly dependant on what software and how they baked those normals. I believe I've had some trouble with inverted normals baking out either from Maya or CrazyBump, but like eons ago. Right now every baking software asks how you want the green channel.
     
unityunity