Ben Reynolds (ben-reynolds)

10 replies · posted

Jagged edges and smooth shading issues on normal baking exercise

I've been working on the normal map baking exercise for a few days now and am still struggling to get a clean result. Diagonal edges in the bake are jagged, and the curved part near the front of the object appears faceted. There's a gradient on each face, rather than the whole curved surface being smoothed.

All beveled edges are marked sharp and marked as seams. I've been baking the map to a 32-bit exr and converting to an 8-bit png in photoshop. I attached some screens below of rendered view and my normal map.

I've started fiddling with settings randomly hoping to stumble on something, but that's not really problem solving. So I'm taking that as a sign I need to ask for a hand. What would you suggest I look at first to troubleshoot this?


Exercise: Bake a Hard Surface Normal Map

  • I have had a somewhat similar problem on normal maps from substance painter where I will get polygonal banding in Blender even though the map seems to work fine in substance and on sketchfab.  I've used both DirectX  and OpenGL with the same result. The problem may not be related, so I hope you don't mind me piggy-backing ben-reynolds .  I seem to always struggle with getting a clean normal map that behaves predictably, no matter what program I bake with, so I am all ears on this thread.

    • crew

      pprocyonlotor In Blender, is your normal map texture set to non-color data (if it's not 32 bit) and run through a normal map node? Without that step, you can end up with wonky results like that. 

    • jlampel it is set to non-color data and run through a normal map node. It's happened with two separate normal maps I've exported from substance. You can download the blends here  or here if that is helpful.

    • crew

      pprocyonlotor Interesting, can I get a screenshot of what it looks like for you with the nodes? I'm not able to find anything wrong with it in the Blendswap file: 

    • jlampel Interesting. Maybe its some difference between 2.8 and 2.79??  Here is what I get:  

      no normal:

      with normal: 

    • jlampel ....and I guess I found the problem.  I had both height and normal plugged into a bump node, and apparently that doesn't behave the way I thought it did.  When I plug the normal into a normal map node it seems to work just fine.  So why does the bump node have a normal input? When would that be used? And should I use both height and normal maps at all? Combining them with a mix RGB seemed to get both working.

    • crew

      pprocyonlotor You were on the right track with the bump node! It has a normal input so that you can add the bump on top of the normal map (not usually necessary, but sometimes I'd use a normal map for large details and a bump map for fine details). The way you can tell what can be plugged into what is the color of the socket: yellow is RGB color information and purple XYZ vector information. The purpose of the normal map node is essentially to convert the RGB of the texture to the XYZ that Cycles uses to calculate what it should look like. So if you stick a normal map node between your normal texture and the bump node, that will work too! Yellow goes to yellow, purple to purple. Hope that clears things up! 

  • crew

    Hey Ben, good questions! I'll try to answer everything one by one. 

    Diagonal edges will basically always be jagged as it's cutting halfway through pixels. The only solution here is to either force the edges to be straight (causing stretching) or increase the resolution of the texture. One thing that will make it less obvious though is increasing the amount of segments of your bevel to something like 5 or 7, since right now it is razor sharp. 

    The gradient along the faces is from the high poly. The edges that are seams and bevels need to be marked sharp as well (I double checked the file and that does fix it), otherwise the bevel is going to cause the angle between edges to be lower than the auto-smooth threshold. 

    Other than that it looks like you're spot on. Keep up the good work!

  • jlampel Thanks for the tips, increasing the bevel segments gave some reasonable improvement to the jagged edges, however I'm still not seeing a difference on the curved surface. I've tried marking all beveled edges sharp and played with the auto-smooth threshold a bit on both the high poly and low poly objects. A couple questions about sharp edges:

    1. When you use Select -> Sharp edges, does that select edges where the shading has been manually marked sharp, or is it using some other criteria such as the angle?
    2. Is there a difference between Ctrl+E -> Mark sharp and clicking sharp on the Shading/UVs panel in the tool bar?

    • crew

      ben-reynolds Select Sharp Edges is selecting based on the edge angle, and has nothing to do with whether the edge is marked sharp or not. It's really not intuitive, so I've requested that it get changed in 2.8 to "Select by Edge Angle". 

      Is there a difference between Ctrl+E -> Mark sharp and clicking sharp on the Shading/UVs panel in the tool bar?

      Nope, it's the exact same! 

      I'll take another look at that file in a bit, but the only explanation for that kind of faceting that I can think of is that either the low poly or high poly is not smoothed in those areas - unless they are beveled as well and the subdivision surface (if you have one on for baking) is therefore pinching everything together.