Home Technical Talk

Normal Map Gradients

polycounter lvl 7
Offline / Send Message
atomander polycounter lvl 7
Hey Polycount, having an issue with some of my normal map bakes. I've been getting a lot of gradients in what I presume should be pretty flat surfaces, such as the base of this model, the cover, and the toothed roller section. The normal on the LP doesn't actually look too distorted in Marmoset, but I'm wary of basing all my other maps in DDO off this bake. Below is the LP wireframe, the LP with the normal map, and the HP:

e3RiOEh.jpg

And here is my normal map:

VlqJ53L.png

High poly is from zBrush, Low Poly is Blender, all bakes in xNormal. Any thoughts on if the gradient is going to be a problem, and if so, how to rebake to avoid it?

Replies

  • ZippZopp
    Offline / Send Message
    ZippZopp polycounter lvl 12
    you can use hard edges at your UV seams and that should help with the gradients.
  • EarthQuake
    The gradients are there to account for the smoothing of the lowpoly mesh. It looks like your mesh normals on the lowpoly are pretty extreme, so that shows up in your normal map. You can add hard edges at your uv splits and that should help. Just make sure you're baking with a cage so you don't get gaps in the projection.

    Generally, gradients are not an issue persay, especially with a synced tangent workflow, but if your workflow isn't synced, you'll get some major issues with an asset like this.

    More here: http://www.polycount.com/forum/showthread.php?t=107196

    Also when testing for normal map issues, use a highly reflective material, small issues will be a lot more obvious then.
  • JedTheKrampus
    Offline / Send Message
    JedTheKrampus polycounter lvl 8
    You should try to avoid gradients in your normal maps even if you have a synced tangent basis because texture compression and lower mips will make your model look bizarre anyway. It's better to use a few more polygons or a few more smoothing-group/UV splits to make the low-frequency lowpoly normals closer to the highpoly normals.

    Ideally you should use an engine that has a synced tangent basis but set up your bakes like it's for an engine that has an unsynced tangent basis. You'll still have some room to make mistakes, but your normal map will also still look good under compression and at lower mips.
  • EarthQuake
    Yep, all of that is explained in the thread linked above ^
  • SuperFranky
    Offline / Send Message
    SuperFranky polycounter lvl 10
    http://www.polycount.com/forum/showthread.php?t=107196 Haha, this thread comes up so often that I feel it should be a part of the message welcoming a member to the forums. Essential reading for everyone.
  • atomander
    Offline / Send Message
    atomander polycounter lvl 7
    I'd read through that thread several times and was banging my head trying to figure out what was going on. Then I realized that I had to hit "save mesh" after editing the cage in xNormal 3D view.

    Geez. Shame.

    Thanks for the help everyone, that thread is awesome!
  • gabr01
    Offline / Send Message
    gabr01 polycounter lvl 3
    Hi,

    This is an older post. But it seems some things are being said here that I like to verify.

    I have been testing several setups baking a normalmap from hi to lo poly using XNormal. I get the best results when using one smoothing group on the lo poly mesh. But this does result in gradients in the normalmap as discussed here.

    JedTheKrampus writes that gradients in the normalmap should be avoided though. And I belief I read that somewhere else as well.

    But looking here https://docs.unity3d.com/Manual/BestPracticeMakingBelievableVisuals4.html , this is for Unity, it appears that it is actually recommended to use one smoothing group on the lo poly mesh as this will reduce vertex count and it will produce smoother visual results.

    I am just new to all this and like to double check this :) 

    Is one smoothing group indeed just fine when using this in Unity or should I continue searching for fixes for the artifacts I get when using hard edges on the lo poly mesh?

    Gabriette
  • gnoop
    Offline / Send Message
    gnoop sublime tool
    They are right regarding smoothing groups and UV islands. Less is better.
       But in a model already unwrapped to multiple separate UV  islands  there is no reason to make smooth shading in between different UV islands unless it's something  rounded  like a human head .   An engine would split edges along the seam anyway.    So smooth groups should be  in sync with UV islands .

    Smooth shaded edges in between  two non-split surfaces meeting each other at 90 degree  (like cube)  will always give you a gradient in  normal maps  since  the normal map would try to "fix" the gradient you see in shading of smoothed mesh.    To get rid of it you have to add  extra supporting  edge loops next to that  edge .   it's what your link shows.    

    There is also no big reason to split your UV and smooth groups to every small 90 degree  surface bend  if it small and narrow. Nobody notice gradients there.   Like those railroad  tiers .  But you better  rotate vertex normals of top surface of the  tires to be perfectly perpendicular /vertical    so the gradient would go to  that tiny height part only.    


  • gabr01
    Offline / Send Message
    gabr01 polycounter lvl 3
    Thank you very much for the quick response.

    Being a noob with this I am not entirely sure if I understand everything.

    Your example of non-split surfaces at 90 degree like cube, resulting in a gradient that is exactly what I mean.

    I get best results when unwrapping to, I guess this is called, one island. Meaning there is only one unwrapped group over vertices / triangles with only a couple of split edges. So the results in Unity will be an almost equal number of vertices in the final Unity Mesh, for a box without bottom, only 4 split edges on the sides. 

    But you continue with "To get rid of it you have to add  extra supporting  edge loops next to that  edge" which is exactly why I am asking this question. Do you mean add an extra strip of triangles to ease the angle? Where does the link mention this?

    It sounds as if ideally this type of gradients in the normalmap should be avoided? Is it wrong practise not to do that, have less vertices and keep the gradients in the normalmap?

  • gnoop
    Offline / Send Message
    gnoop sublime tool
    gabr01 said:
    Thank you very much for the quick response.

    Being a noob with this I am not entirely sure if I understand everything.

    Your example of non-split surfaces at 90 degree like cube, resulting in a gradient that is exactly what I mean.

    I get best results when unwrapping to, I guess this is called, one island. Meaning there is only one unwrapped group over vertices / triangles with only a couple of split edges. So the results in Unity will be an almost equal number of vertices in the final Unity Mesh, for a box without bottom, only 4 split edges on the sides. 

    But you continue with "To get rid of it you have to add  extra supporting  edge loops next to that  edge" which is exactly why I am asking this question. Do you mean add an extra strip of triangles to ease the angle? Where does the link mention this?

    It sounds as if ideally this type of gradients in the normalmap should be avoided? Is it wrong practise not to do that, have less vertices and keep the gradients in the normalmap?


    Those extra loops are not adding anything  to general form /silhouette  or something. Their single purpose  is to get rid of  a shading gradient.     And 3 extra loops on the top  is not necessary actually.  Would be ok to just add a single one with vertex normals edited to be perfectly perpendicular to surface .  They are not by default with all smoothed mesh.   

    All that said you could just  split UV and vertex normals (make other smooth group) on the very corner .      Hard edge or smooth one with extra loop , you can see there would be no difference in vertex count for an engine.   Smoothed/non split edge still allows to bake better looking rounding.  Split edges  could be rounded by means of normal map too but just a little bit less perfect usually.

    Gradients in normal map may look ok in your 3d soft or baker  but in real game with texture compression they would never look perfectly flat , especially with shiny material


  • gabr01
    Offline / Send Message
    gabr01 polycounter lvl 3
    Yes, I see what you mean, thank you!

    So that extra loop is recommended also for example for a long non straight wall? Adding that extra loop will result in significantly more vertices / tris, but still that is preferred above those gradients in the normalmap when no extra loop is used?



  • gnoop
    Offline / Send Message
    gnoop sublime tool
    Yes, but having just hard edge altogether with uv seam  is perfectly ok too.   As of gradients you could tolerate them in some places too, narrow stripes, small details etc.    Bit having a big flat wall having the gradient is not ok usually.
  • gabr01
    Offline / Send Message
    gabr01 polycounter lvl 3
    I tested hard edges with uv seam and enough room for padding but the results were not as good as when using one smoothing group. I will do further tests to see if I can get better results.

    Thank you so much for taking the time to help. I have a better idea now what to do.


  • poopipe
    Online / Send Message
    poopipe grand marshal polycounter
    Using support loops /single smoothing group on hard surface stuff is a terrible idea if you plan to LOD your object on the same texture maps -  you just end up with expensive LODs that look shit.

    Generally speaking,  if you're going to be  close enough to notice the artefacts caused by hardening a 90 degree edge you're close enough to need geometry to represent the bevel across it



  • gabr01
    Offline / Send Message
    gabr01 polycounter lvl 3
    Thank you poopipe for this additional info which is relevant, LOD levels will be required
Sign In or Register to comment.