Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

[Solution] How To config CrazyBump Normals Maps for Unity?

Discussion in 'General Graphics' started by AlanMattano, Jan 5, 2018.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    What do I need to do to correctly convert the CrazyBump Normals before importing them into Unity?

    Solution by bgolus:

    in CrazyBump go to preferences by clicking this icon:


    and put,
    • Normal map y-axis: Up
    • Normal map x-axis: Right
    When you are ready for export,
    before saving the Normal map,
    set the Normal map: intensity value to half the final value you choose.
    As for example, If you choose a normal map intensity of 50, then put 25 and save.


    ___________________________ Old question _____________________________

    Dear CrazyBump fanatics,
    Looking at the manual tells me that the X,Y & Z values of a normal texture direction vector are different from Unity Y up. In particular, the manual talks about Z is up. But doesn't explain what are the other two X and Y channels.

    If I export CrazyBump Normals Y up and X Right looks bad. I think I need to move the texture Y channel to the Z. I can do this in Photoshop. But also Unity talks about half of the x Y values:

    "Understanding... ...for using normal maps! ... : The RGB colour values are used to store the X,Y,Z direction of the vector, with Z being “up” (contrary to Unity’s usual convention of using Y as “up”). In addition, the values in the texture are treated as having been halved, with 0.5 added. This allows vectors of all directions to be stored. Therefore to convert an RGB colour to a vector direction, you must multiply by two, then subtract 1. For example, an RGB value of (0.5, 0.5, 1) or #8080FF in hex results in a vector of (0,0,1) which is “up” for the purposes of normal-mapping - and represents no change to the surface of the model. This is the colour you see in the flat areas of the “example” normal map earlier on this page."

    from: https://docs.unity3d.com/Manual/StandardShaderMaterialParameterNormalMap.html
     
    Last edited: Feb 23, 2018
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,229
    World space "up" in Unity is +Y, yes. But that has nothing to do with tangent space normal maps which are in tangent space.

    In tangent space x and y are aligned to the texture's UV, and z is away from the surface. That's true for Unity, that's true for Unreal, that's true for every tangent space normal map.

    The difference is Unity uses OpenGL style +Y normal maps and CrazyBump & UDK uses -Y normal maps. In short, the green channel is inverted between the two. This is also called Y up and Y down, because when you look at the texture itself it looks like the green channel is going "up" (or lit from above) or "down" (lit from below).

    https://medium.com/@bgolus/normal-mapping-for-a-triplanar-shader-10bf39dca05a#0576

    Open the texture in Photoshop / Gimp, select the green channel, invert the color.
     
    iSinner, theANMATOR2b and AlanMattano like this.
  3. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    Thanks @bgolus ! So in CrazyBump preferences by clicking this icon:

    upload_2018-1-7_0-49-55.png
    • Normal map y-axis: Up
    • Normal map x-axis: Right
    Then you can import the normal texture directly to Unity.
    • In the texture inspector, change the Texture Type to Normal map
    • Drag&Drop the texture to the material
    • and set the Normal Map value to 0.5 (since look working perfect for me)
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,229
    Sounds like you should be reducing the intensity in CrazyBump itself.
     
  5. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    Saving Normal Map half the value inside CrazyBump is time-consuming but also a good idea.
    If I put Normal Map value to 0.5 in the material inspector, is less performer than 1?
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,229
    No, but scaling the normal also isn't available for all shaders and gets disabled for some platforms even when it is an option (like mobile).
     
  7. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    Thanks a lot! You save me a lot of time. I will export by saving Normal Map half the value in CrazyBump.