Search Unity

Normal map question

Discussion in 'Shaders' started by Lalancelot, Nov 6, 2014.

  1. Lalancelot

    Lalancelot

    Joined:
    Oct 27, 2014
    Posts:
    10
    Simple question, I made a cinema seat model in maya and I wanted to test it into Unity (4.6 beta). But, I am quite deceive of the result. When I use the displacement in maya, everything is smooth (obviously), but when I try to obtain something similar into Unity using normal map, the seams are all over the place and nothing is smooth. I know I cannot expect the same result from normal than displacement map, but I feel I am far off. Is this normal (no pun intended)? Displacement map and Normal map were created together into ZBrush. I tried many thing, but got no real improvement. I look into the doc, but the example is with a cube, which give expected result. I was hoping to smooth low poly round surface. Am I hoping too much, or am I doing something totally wrong. Thanks for any info.
     

    Attached Files:

    • Map.jpg
      Map.jpg
      File size:
      117.1 KB
      Views:
      808
  2. Farfarer

    Farfarer

    Joined:
    Aug 17, 2010
    Posts:
    2,249
    Looks like this could be a bunch of issues.

    First, can you show us the high poly, low poly and UV map?

    Secondly, how are you baking the normal and displacement maps? If you're doing it in ZBrush, you won't get great results and they definitely won't be useful in Unity.
     
  3. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    My first guess would be that the normal map in Maya is in object space, while almost any realtime shader will expect the normal map to be in tangent space.

    Can you post the normal map?
     
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    What are the import settings for this object in Unity? Do you import the normals or do you recalculate them?
    This has certainly a huge impact on the normal calculation as well. Check whether the hard edges are exactly at the uv seams.
     
  5. Lalancelot

    Lalancelot

    Joined:
    Oct 27, 2014
    Posts:
    10
    Sorry for the late reply, I did not get/see the notification. Since that last time, I redid my UV, trying to have less seams and to hide them as much as possible. I put as much information as I could into the mosaic file attached. In the ZIP file are the two normal map I use (fabric and wood).

    Farfarer: If you look at the mosaic file, you will see that I have only a low poly model. I exported each pieces of the seat in Zbrush, did a Morph Target of the low model, subdivided to 4, restored the low model with the morph, exported the maps. Once all parts were done, I put all files into one using Photoshop (for the normal and the displacement). You see that it worked fine for the displacement when I use them into Maya. But normal don't work that great into Unity. You say that Zbrush is not that great for normal maps. If there is a better method, I am all ears.

    jvo3dc: Even if my object has no deformation, I used the tangent space for my normal maps. But when I first tried it, I did not know the difference between the two methods.

    Dantus: For importing the model, I use the MB file from Maya directly into the asset folder. If there is something else to do (like recalculating the normal), I did not do it. As far as I know, they seem to be aligned.

    Thanks for the replies. I'll try to set my project on my web site for you to download.
    edit: http://www.lalancelot.com/scripts.html go to the bottom of the page to download the unity project.
     

    Attached Files:

    Last edited: Nov 25, 2014
  6. Flailer

    Flailer

    Joined:
    Apr 1, 2014
    Posts:
    66
    What's occurring here is that the file you are importing either does not have smoothed face normals OR the import settings are incorrect. If you go to the model import settings you can set the Normals and the Tangents to Import, this is especially useful if you have custom normal smoothing on the mesh, which you likely do. In addition, before you export from maya, please make sure you dont have any smooth preview in effect, go to Normals > Soften Edge. Check ur export settings to make sure that the mesh export settings export the mesh smoothed normals and tangents. Good luck and let me know how it goes.
     
  7. Lalancelot

    Lalancelot

    Joined:
    Oct 27, 2014
    Posts:
    10
    I followed your instructions and it worked fine. It is not perfect, but it has now more to do with my poor modeling. The problem was that I did not apply the Normal>Soften Edge to the parts of the model. Once done, everything went smooth (pun intended). I did not see any export option for the smoothed normals and the tangents in the MB file export. Maybe I could have done it if I used the obj export, but I use the Maya mb file directly into the asset folder. It worked fine with no export to tackle with. Great.
    Thanks a lot for all the info.
     

    Attached Files:

  8. J6

    J6

    Joined:
    Nov 27, 2014
    Posts:
    3
    just flip green channel and copy red channel and paste red channel to alpha channel.
     
    Last edited: Nov 28, 2014
  9. Lalancelot

    Lalancelot

    Joined:
    Oct 27, 2014
    Posts:
    10
    When you said flip the green channel, I guessed that you meant invert. I tried and indeed, I got even better results. I am not sure why we need to add the red channel to the alpha, but I did anyway. Thanks.
     

    Attached Files:

  10. J6

    J6

    Joined:
    Nov 27, 2014
    Posts:
    3
    yeah, flip means invert. my english is not very well^^;; I think Unity3d use alpha channel so many ways. so you don't need to think that alpha channel must be used when use transparent texture. you can use alpha channel for many ways.
    I don'k know why that alpha channel contains normal texture. but it's so good you got better result.
    have a good day~^^