Home Technical Talk

Problem with normal map baking

polycounter lvl 12
Offline / Send Message
Hayden Zammit polycounter lvl 12
Been stuck on this problem when baking with normal maps.

You can see the problem in this pic. Its going weird at that front face and a little further back.

Was hoping someone can tell me what causes these problems. I'm using Maya and baking my maps inside of Maya.

qXvbH.jpg

Replies

  • SelwynPhillips
    Options
    Offline / Send Message
    SelwynPhillips polycounter lvl 11
    I get alot of trouble with baking normal maps too. Hardening the egdes of the low poly might fix that strange gradient....... However, I might be wrong in suggesting this as I'm still learning myself. Give it a go, see what happens and tell me how wrong I am when it doesn't work :P
  • ZacD
    Options
    Offline / Send Message
    ZacD ngon master
    If you have having normal map issues, you should always post your highpoly, low poly, wireframes for the low poly, and your normal map, its hard to tell whats wrong otherwise.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    Okay, here's the high poly.



    BiTqk.jpg

    And here's the low poly with the wireframe.

    XoNSV.jpg

    and here's the normal map I'm getting for this part. UVs aren't final. Just testing.

    a6NZm.jpg
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    Yeah, I'd try hardening some of the harsh angles and breaking your uv along the same edges. It should get rid of the wonky shading - though it's strange that only that side has odd shading.
  • JohnnyRaptor
    Options
    Offline / Send Message
    JohnnyRaptor polycounter lvl 15
    yeah add hard edges on the mesh along the UV seams
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    Okay, I'll try the hard edges, though I always thought that you were supposed to have all your normals set to smooth.
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    TRIANGULATE BEFORE YOU BAKE

    Hardening edges can help reduce artifacts, but if you are going to harden an edge, you should also split the uv's there.

    That's the short, short version. For the long version, check out the thread cptSwing posted, or check out the polycount wiki, normal map section.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    I'm reading through all the recent normal map and hard edges threads that suddenly popped up. Think I'm starting to understand it. With my new knowledge I can safely say I hate normal maps and hard edges.

    Anyway, using hard edges here and there fixed all the problems I was having.
    TRIANGULATE BEFORE YOU BAKE
    I tried that. Here's a comparison pic. One on the right was triangulated before I baked. For some reason it looked terrible.

    AGAf5.jpg
  • Scruples
    Options
    Offline / Send Message
    Scruples polycounter lvl 10
    If you are keeping the mesh in Maya and aren't modifying it after the fact, you don't need to triangulate.

    Keep in mind your quad mesh is actually still made up of triangles, the lines joining them are simply hidden and usually re-evaluated whenever you move a vertex, which is the reason behind triangulating them before export or import, because different programs may triangulate the mesh differently.

    If the vertex normals are changing when you triangulate you can actually freeze the normals before triangulating to prevent this.

    I you want to see the hidden triangles, you can go to Display>Polygons>Face Triangles, with your object selected.
  • EarthQuake
    Options
    Offline / Send Message
    With Maya, when you're baking in Maya, triangulating before you bake really isn't necessary for any reason. What you do want to do however, is lock your normals and triangulate before you export(because triangulation in Maya changes your mesh normals).

    If you're sending your mesh to an external app like Xnormal to bake you should triangulate before you do that as well, because xnormal may triangulate your quads in the opposite order and give you "X" shaped smoothing errors.

    Nothing the OP is showing here looks like a direct result of triangulation though. Even with a synced normals workflow, normal map display isn't perfect, especially when you have shading on faces that are angles greater than 90 degrees like the OP's big problematic area there. Normal maps can't really account for such a steep angle.

    But yeah, simply setting all of your uv borders here to hard edge will likely fix your issues. There is a maya script that will do this in the thread linked above.

    You can also bevel some of your edges there to soften out those hard angles.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    When I tried using the triangulate function in Maya, it gave me the results in that second pic. When I triangulated by hand, it was fine. That totally confused me. I tried hitting triangulate and then I think I hit Set to Face and then finally went about and softened up some edges.

    The bake looked fine after that, both in Maya and Marmoset. Now with the piece if I turn it to either quads or tris in maya, it still bakes out and looks good in Maya and marmo.

    V1TXZ.jpg

    I know I probably shouldn't obsess so much over some of the smaller smoothing areas and everything, but I'm not a fan of having to fix up normal maps in Photoshop. I'd much rather just bake it and be done with it.
    With Maya, when you're baking in Maya, triangulating before you bake really isn't necessary for any reason. What you do want to do however, is lock your normals and triangulate before you export(because triangulation in Maya changes your mesh normals).

    Ah yeah, that worked as well. Thanks for that, and for all the other write-ups you've done recently on this subject. As that guy said in the other thread, you really are the Dr. House of polycount.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    So, I've encountered this problem now. You can see the weird artifacts I'm getting across the bottom of the cube. Its happening to all my other meshes. Is this something that is unavoidable with normal mapping?

    I tried with other meshes and I get the same problems, although the artifacts look different depending on the mesh.

    yJe0j.jpg?1
  • EarthQuake
    Options
    Offline / Send Message
    I'm not sure exactly what you're talking about here but I'll take a guess. When you've got heavy gradients in your normal map you're going to get one of two things:
    A. stepping type artifacts, this is usually what Maya opts for
    B. noise, or dithering, which I think is what Max does and I prefer a bit honestly.

    But I think you're probably over-thinking it a little here. Will this sort of thing show up when your asset is textured, in game, compressed etc? Probably not.

    (unless I'm mistaken as to what your issue is entirely).

    If that is what you're talking about, yes it is pretty much unavoidable when dealing with normal maps that have heavy gradients, because its simply a bit depth issue, there aren't enough colors available in an 8bit/per channel image to render a smooth gradient without stepping or noise.

    It looks like in general you're getting some smoothing errors here. Toolbag isn't synced with Marmoset, so you won't be able to get away with the same sort of smoothing as in the maya viewport. With a simple box like this, hard edges on all the edges with uvs detached is going to look best(in marmoset or any game engine that isn't synced with a specific baker).

    Detaching the top and bottom faces entirely/using hard edges there will improve it as well if you've got everything connected.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    EarthQuake, I don't have heavy gradients on the most problematic areas though. Here's another mesh in marmoset. The pics after are my original normal map, which looks fine enough. After I use unsharp mask in PS on it a few times you can see the normal map itself has some issues.

    I'm guessing it would be hardly noticeable once the diffuse and proper specular are done, but are these sorts of artifacts just unavoidable in your opinion?

    36x9x.jpg

    zLWIu.jpg

    TBK0U.jpg
  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    I think I have noticed this before, but assumed it was compression issues. What file format are you saving your textures as?

    Just a guess, but if you want to be double-sure that it's not an issue with your bake, try baking again using a cage (if you didn't already). It looks ALMOST like ray-fails.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    dirigible- Saving as a TGA. I tried with a cage in the transfer maps. Same result. By a cage you just mean setting the envelope function in Maya I'm assuming.
  • EarthQuake
    Options
    Offline / Send Message
    Yeah I think this is just a bit depth issue, not really anything you can do about it. Its really odd that it isn't all the same value there(since its a flat plane in the high and low), but I've had stuff like this in Maya before too on similar bits thinking about it, never really thought much of it though. I wouldn't worry about it.
  • dirigible
    Options
    Offline / Send Message
    dirigible polycounter lvl 8
    dirigible- Saving as a TGA. I tried with a cage in the transfer maps. Same result. By a cage you just mean setting the envelope function in Maya I'm assuming.

    Yeah, sorry. Not used to using maya terminology when talking about bakes.
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    EarthQuake - Yeah, I guess I'll just do the rest of the maps and see how it looks. I can paint out the problem areas if I really want to in PS. I just thought there would be an option somewhere in maya to fix this.

    dirigible - was pretty sure I knew what you meant, just wanted to make sure. Thanks.
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    Have you tried baking your map in another application? Are there UV's overlapping?
  • Hayden Zammit
    Options
    Offline / Send Message
    Hayden Zammit polycounter lvl 12
    No Uvs overlapping, and I tried with Xnormal as well.
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    And the result looks the same as your last pic? Then there's gotta be something wrong with your mesh (borked normals? double faces?)..
  • EarthQuake
    Options
    Offline / Send Message
    cptSwing wrote: »
    And the result looks the same as your last pic? Then there's gotta be something wrong with your mesh (borked normals? double faces?)..

    Just to be clear his last pic is heavily edited in photoshop to point out the extremely, extremely minor artifacts he's getting. The shot above that is the baked result, which you can't really see the issues with the naked eye(well I can't atleast).

    So you'll be on a wild goose hunt if you're trying to debug his edited image, the last image he posted. =D
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    Haha.. I did actually read it the opposite way, the last image being his bake result and the one before that having been edited.. one hella broken mesh, I thought.

    Thanks for the heads-up ;)
  • boombyte
    Options
    Offline / Send Message
    boombyte vertex
    Hi all.
    I don't wish start new thread beacause have almost the same problem.
    When I bake normal map some edges (on a low poly model) are still visible. I'm use Maya (2016). When I export model to Unity this edges still visible also.
    The model was softed with "Soften Edge".
    Here is few pics that will show problem... (low poly + normal map)------->




    This pic shows part of hi-poly------>



    This pic shows normal map and UVs in Maya-------->


    And this nMap from xNormal------>


    All nMaps are 256x256. 
    Not all edges visible, only some... 
    As I understand this problem is not from nMap but from edges.
    I spend 3 days for tries and info but nothing.
    Thanks for help.
    (sorry, I don't know how to make photos with one spoiler)
  • boombyte
    Options
    Offline / Send Message
    boombyte vertex
    Little update---
    when I chose Object space instead Tangent space everything almost ok. (in Maya's viewport--high quality and viewport 2.0)
    I can manually move vertex normal that make problematic edges good but this method make distortion on another nearest edges.
  • samnwck
    Options
    Offline / Send Message
    samnwck polycounter lvl 9
    When you bake, try separating each UV island into a separate smoothing group. That usually fixes baking issues like that for me. There are usually scripts that do that for you. 
  • boombyte
    Options
    Offline / Send Message
    boombyte vertex
    I use Maya and as I know there is no Smothing Groups--only Soften and Harden edges. I can change normal angle also. This is all. 
    Just tried separately set each UV island to Soft (that required for smothed surface). No changes--strange edges still here.
  • pior
    Options
    Offline / Send Message
    pior grand marshal polycounter
    Triangulate your model before baking and before importing into your engine. You have no way to know how each export/import procedure is going to interpret these diagonals, therefore you do want to force them every step of the way. The very first picture in this thread is typical illustration of this problem, and this might be what you are also running into  (not 100% sure though of course).

    When you bake, try separating each UV island into a separate smoothing group. That usually fixes baking issues like that for me. There are usually scripts that do that for you. 

    While this works and is quite a popular "fix", it is important to remember that it is by no means necessary. When placing a hard edge, one has to make sure that it sits on a edge that is also a UV border. But that does not mean that all UV borders need to be hard (as this would be a waste and may introduce issues in unwanted places).

    Good luck !
  • boombyte
    Options
    Offline / Send Message
    boombyte vertex
    But I don't understand how to make few Smoothing Groups in Maya. And I don't understand why this problem happened with me but other people make bakes good.
  • Bartalon
    Options
    Offline / Send Message
    Bartalon polycounter lvl 12
    From the looks of your images, you have numerous hard edges running throughout the inside of your UV shells.  Soften these edges, and make sure only the UV perimeter edges are hard.

    As pior said, it's not absolutely necessary to have hard edges at UV seams (it can cause issues with mip mapping in some cases), but for the purpose of troubleshooting it might be easier to harden all UV border edges until you've solved your problem.

    Here's a script by Jonathon Stewart that sets hard edges to texture borders, in case you're sick of doing it manually.
  • boombyte
    Options
    Offline / Send Message
    boombyte vertex
    No-no... I use owerall Soften for all model. Hard edges will look more terrible if no splits in UVs.
    It's look like (not 100%) this problem from http://polycount.com/discussion/107196/youre-making-me-hard-making-sense-of-hard-edges-uvs-normal-maps-and-vertex-counts/p1
    But in my case not all edges visible. And I tried ABC methods.

  • boombyte
Sign In or Register to comment.