Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    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?
     
    AntonioModer likes this.
  2. M4dR0b

    M4dR0b

    Joined:
    Feb 1, 2019
    Posts:
    108
    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. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    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:
    108
    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.