Home Technical Talk

Normal map Bake artifacts? (Warning 9 Screenshots)

polygon
Offline / Send Message
Dagon polygon
I'm using Blender to model the high and low poly as well as Baking normal and AO maps. I haven't baked anything other than planes with details like floating geometry etc. But today I'm trying to bake a normal map out of this high poly crate which isn't working out too well. I've got artifacts all over the place. Those screenshots below will hopefully explain the problem to you. Since I can't figure out why I've got issues like that.


(Reached Limit with Photobucket)

Replies

  • ivanzu
    Options
    Offline / Send Message
    ivanzu polycounter lvl 10
    Set bias to 0.50 or 0.100 and then try to bake.
  • Jeremy Tabor
    Options
    Offline / Send Message
    Jeremy Tabor polycounter lvl 13
    well, I don't use blender, so look at this with a skeptic's eye, but it appears based off of that last screenshot, that your projection cage (in orange, if I am interpreting that correctly) is clipping through your HighPoly, which correlate with the majority of the artifacting in your normal map.

    The cage needs to fully encompass both the Low and High poly models.
  • walkonsky
    Options
    Offline / Send Message
    walkonsky polycounter lvl 11
    to me it looks like the inner and outer shell of your crate interfere during the bake. probably the normals of the inner shell are projected to the normal map of the outer one and the other way round.
    first of all, check if your normals are all pointing in the right direction. then, try to explode your mesh. move any parts that are easy to separate from each other away from each other in both the high and low poly. (you will probably divide the mesh along its uv-seams) especially separate the inner and outer shell of your crate. use those exploded meshes for baking.
    also make sure that you dont have any duplicated vertices or edges. and, lastly, you might want to optimize your mesh. there are a lot of verts that are not needed. that might not be helpful to your present problem, but it might help you otherwise. ;)
  • tigg
    Options
    Offline / Send Message
    The usual steps I'd take in a situation like this:
    Make sure you haven't accidentally duplicated the whole object. Try Remove Doubles.
    Make sure your normals are all pointing the right way.
    If you have any mirrored UV's, put them outside the 0-1 box thingy.
    Play with the Bias and Distance settings.

    Other than that, I would honestly recommend Xnormal for baking your maps. It's just a bit less fiddly.
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Trying to fix it but haven't really made too much of a difference yet. I checked for duplicates and there weren't any. I think it's just the interior of the box stuffing things up. Maybe I'll stick to a closed box without an interior.
  • jjsuperspy
    Options
    Offline / Send Message
    jjsuperspy polycounter lvl 8
    id say change your bias, distance and check your face normals such as if some are facing inwards etc.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    It's baking the Z fighting. Most of the green you are seeing is the underside of the faces being baked. Increase the size of your LP so that the Z fighting stops or increase the Bias value to the same effect. Only increase the bias in small amounts, as it's measured in Blender units and a value of 1 will tell Blender to bias towards things that are 1 unit away. If you zoom in you should be able to get a good starting number by looking at the subdivison of the grid.

    Here is an example of the Bias setting (please excuse the crappy compression...Photobucket seems to have crunched the jpgs pretty bad)

    bias_2.jpg

    Bias.jpg

    Also, you will prob. want to explode something like this before baking as Blender doesn't have the same control as a cage. Separate the top and the bottom parts of the box so they are 5 units apart or something and do the same with anything that is not a contiguous mesh. If you still cant get good results, post the .blend or send me a PM and I will be happy to take a look for you. :)

    *edit* Also, It's worth remembering that you cant bake smoothing groups/hard edges in Blender without getting a seam in the normal map, so make sure that you only split the mesh where it is not contiguous geometry.
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Tried baking it again using all the methods above and the same problem, I tried using the Bias I exploded the mesh from how I understand it. But what I think is going wrong may be that since both the LP and HP models have a thickness to them maybe that's causing the problem? Maybe the insides are clipping. I've sent the blend. to Netalliandy and hopefully he'll know what's wrong.


    Things I tried:

    -Explode mesh
    -Play with Bias settings
    -resize the HP or LP models
    -Checked for duplicates blender found none, I shouldn't have any faces "inside" the mesh, I don't tend to make that mistake if at all.

    As you can see I exploded the model hopefully I did it right? Or must I separate it from the seams?


    (Reached Limit with Photobucket)
  • Zwebbie
    Options
    Offline / Send Message
    Zwebbie polycounter lvl 18
    Well, the method of your exploded mesh is good, but you need to place the highpoly and lowpoly elements in exactly the same location as their counterparts.

    Also, it looks like you have a Distance value of 0. Now I haven't baked anything in Blender in a long while, but I could've sworn 0 would lead to absolutely no result. Distance is the distance to which rays travel looking for a highpoly before giving up, and bias tells them which surface to pick if they find multiple, the one closest to the bias value. I've got an extremely crummy image here attempting to explain it, if that's of any use. I'd advise you to give Distance a value of .5, Bias .1, overlay the highpoly and lowpoly to occupy the same space, and try again.
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Tried what Zwebbie said, Had a better result but still quite a few artifacts.


    (Reached Limit with Photobucket)
  • Frankie
    Options
    Offline / Send Message
    Frankie polycounter lvl 19
    I'm pretty sure that it works like this.

    Blender sends out a ray outwards from the low poly model with a maximum distance set by distance.

    If distance is left at 0 the ray is infinite.

    This ray terminates on the first thing it hits so it's more than likely to hit the back of an object and will terminate before it hits floating detail or extra detail on layered object.

    Adding a value to bias makes the ray trace inwards starting from this distance away from the surface of the low poly model and will terminate on the first thing it hits, so will be the upper layer of the object, this is usually desired behavior.

    If you set bias and leave distance at 0, if nothing is hit within the bias trace it will then send out an infinite forward distance trace so you might get some weird results where you didn't expect anything.

    I think the rays actually go in both direction so 1 will send it 1 unit infront and behind the surfaces of the low poly model.

    It then does something else I cant work out that could be a bug. (just an example of this bit I cant work out,
    distance 0 bias 0 = expected behavior
    distance 2 bias 0 = expected behavior
    distance 0 bias 2 = expected behavior
    distance 2 bias 2 = missing large chunks
    distance 4 bias 2 = expected behavior but what I expected from d2 b2
    )
  • mnphear
    Options
    Offline / Send Message
    mnphear polycounter lvl 9
    bake it with xnormals
  • Zwebbie
    Options
    Offline / Send Message
    Zwebbie polycounter lvl 18
    Frankie wrote: »
    It then does something else I cant work out that could be a bug. (just an example of this bit I cant work out,
    distance 0 bias 0 = expected behavior
    distance 2 bias 0 = expected behavior
    distance 0 bias 2 = expected behavior
    distance 2 bias 2 = missing large chunks
    distance 4 bias 2 = expected behavior but what I expected from d2 b2
    )
    Just curious, what is the expected behaviour here? Since the distance from the lowpoly is from -D+B to D+B, D2B2 reaches from 0 to 4 away from the model. So if you've got highpoly behind the lowpoly, it won't be taken into account, if that's what you're missing.

    Also, I did not know about D0 being infinite, so thanks for that :) .
  • Frankie
    Options
    Offline / Send Message
    Frankie polycounter lvl 19
    well I only worked it out from messing around so could be wrong. Yeah I think your right, "D2B2 reaches from 0 to 4"

    Having 0 as infinite makes it feel like bias is separate and that confuses me.

    probably :)
  • Defaultsound
    Options
    Offline / Send Message
    Defaultsound polycounter lvl 14
    I know I had a problem with baking normals in Blender once, the problem was that I had scaled the object (which is a no no in blender for some reason) and to fix it you need to reset the scale proportions by selecting the object and hitting alt-a to reset it. Then the green in the bake should go.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    @Frankie and Zwebbie, AFAIK, a distance of 0 is indeed infinite.
    If you have a well set up LP mesh, you should never really need to touch bias or distance, and most of the time I leave them at 0 and 0 and get perfectly good results. It's only in very rare cases (like this) where I have needed to change the bias.
    I know I had a problem with baking normals in Blender once, the problem was that I had scaled the object (which is a no no in blender for some reason) and to fix it you need to reset the scale proportions by selecting the object and hitting alt-a to reset it. Then the green in the bake should go.

    This is most likely to you scaling the mesh in object mode. When ever you do this you need to apply the location/scale/rotation (Ctrl+A in Object mode) so that Blender updates the object to the correct internal scale again.


    @Dagon,
    I took a look at the .blend and there are quite a few issues that need to be resolved before you even consider baking.
    • You have overlapping UV's, which are causing some issues - You always need to offset any overlapping UVs by 1 unit (or any whole number) in order for them to bake correctly. To do this go to the properties panel in the UV/Image Editor (N key) and check Normalised in the Display panel and then select the UVs and move them by -1 unit in Y.
    • The low poly need to more closely conform to the HP surface and there are parts where the LP intersects with itself, which is causing issues.
    • The LP really needs to be optimised a more. On some parts, like the hinges for example, the extrusions are so close together that they are causing major overdraw and ray casting issues. You would get a much better result if you just used a scaled cube for these parts. You could probably get away with a 2 quads or baking it onto the back of the main body)
    • The hinges are really high poly. Currently they are 84 tris per hinge, which is over 30% of the geo cost for the entire mesh.
    • The details on the front and back really dont need their own geometry and could be baked perfectly onto the front/back of the crate. Let the normal map do the work :)
    • Your UVs are massively out of proportion with each other in some places. The hinges have almost the same UV space as the 4 sides of the crate. Turn on "Stretch" in the Properties panel and you will see what I mean. Everything should be blue, or as close to blue as possible.
    • The LP is all right angles, which will make it harder to capture the details nicely. Add some bevels and you will get a much nicer bake.
    Having said that, I did manage to get a reasonable result with what you have by scaling the meshes up by 20, exploding the parts, offsetting the UVs and setting the bias to .5. It is not perfect however and with the current geo (the hinges etc.) it would be extremely hard and time consuming to get a decent bake in Blender, simply because the Bias/Offset are not versatile enough for situations like this. You would be much better taking the whole thing into xNormal and baking there. It is due to this restrictiveness that I really don't bake a ton of stuff in Blender any more.
    I would sincerely suggest that you take another look at the LP mesh and see what you can do to improve it. Most of the time fixing the LP is a much better solution than fighting with bake issues. Its often faster too :)
  • Frankie
    Options
    Offline / Send Message
    Frankie polycounter lvl 19
    I'm not trying to start an argument but this part is totally wrong.
    If you have a well set up LP mesh, you should never really need to touch bias or distance, and most of the time I leave them at 0 and 0 and get perfectly good results. It's only in very rare cases (like this) where I have needed to change the bias.

    There are only a few cases where this would work out ok. Anything even slightly complicated would break down and need the bias setting. Actually I can't even see why bias is needed and isn't on all the time.
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Wow thanks for all the advice. And I actually did realize that the detail on the front and back of the LP didn't actually need to be there, Didn't think of that. I'll see what I can do about the UV issues. By following your instructions word for word, But before I do that I'll remove the front and back "plates" on the LP. and edit the hinges.

    Also deleting faces that are hidden on the HP like on the "plates" I deleted the faces that are clipping inside the crate. Doing it for the LP as well.


    I'm currently downloading Xnormal to use that for baking normals from now on.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    Frankie wrote: »
    I'm not trying to start an argument but this part is totally wrong.

    There are only a few cases where this would work out ok. Anything even slightly complicated would break down and need the bias setting. Actually I can't even see why bias is needed and isn't on all the time.

    I could be wrong and that is fine, but I don't really know what to tell you. In my experience with baking in Blender, I rarely need to touch the bias or distance settings. The only time I use Bias is if I'm baking floating geo.

    It could be that I explode as much as a can to reduce errors or that I bake parts as separate objects that I know will give me issues, but I honestly don't use them much. Most of the time, if I get baking errors (in Blender or xNormal) I tend to change the LP geo to fix them, rather than fighting with the baking tools.

    I just baked Eat3d's NGT scene in Blender with a setting of 0 for both the Bias and Distance.
    Blender_Bake_front.jpg

    Blender_Bake_back.jpg

    The actual normal maps sometimes look a little messy, but for the most part it doesn't show on the model because its either covered by the actual geo that the error is picking up or it's due to an intersection that isn't actually seen on the mesh.

    But generally Blender is a really poor solution for baking anyway (no AA, no cage, slow bakes etc.), which I why I moved over to xNormal almost exclusively. :)
    Dagon wrote: »
    Wow thanks for all the advice. And I actually did realize that the detail on the front and back of the LP didn't actually need to be there, Didn't think of that. I'll see what I can do about the UV issues. By following your instructions word for word, But before I do that I'll remove the front and back "plates" on the LP. and edit the hinges.

    Also deleting faces that are hidden on the HP like on the "plates" I deleted the faces that are clipping inside the crate. Doing it for the LP as well.


    I'm currently downloading Xnormal to use that for baking normals from now on.

    No worries :)
    If you need to learn how xNormal works, I made a tut a while back that goes over the interface etc.
    http://eat3d.com/free/xnormal_overview
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Wow that's a really good bake! And model! And thanks for the link, I've tried Xnormal before but couldn't get into it but now I have no other choice. Xnormal seems like a much better tool for baking, So I better learn how to use it.
  • Frankie
    Options
    Offline / Send Message
    Frankie polycounter lvl 19
    Well that's strange because your bakes do look great.

    My point is just most of the time, high poly models will have floating details or layers of detail.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    Dagon wrote: »
    Wow that's a really good bake! And model! And thanks for the link, I've tried Xnormal before but couldn't get into it but now I have no other choice. Xnormal seems like a much better tool for baking, So I better learn how to use it.

    Cheers! I didn't make the model or diffuse/spec textures though. Its from an Eat3d tutorial and I used it because I had it to hand and it's a reasonably complicated model to bake. :)



    Yea, xNormal is an awesome application and produces really high quality bakes, though it can take a while to get used to the interface and work flow.

    You can export a custom cage from Blender, rather than using the in build cage in xN, which is what I do 99% of the time.

    For the cage, I use this method.
    (If you are not using hard edges/smoothing groups ignore the edge split steps)
    • Make a duplicate of your LP mesh (without the Edge Split modifier applied)
    • Add a solidify modifier to it and move it above the edge split modifier in the stack.
    • Uncheck "Fill Rim" and check "Even Thickness" and "High Quality Normals"
    • Change the "Thickness" into a minus number, so that it covers your HP mesh entirely
    • Apply the Solidify modifier
    • Go into Edit mode and select one of the faces of the outer most mesh
    • Hit CTRL+L to select linked
    • Invert the selection and delete the inner mesh
    • Go back into Object mode and apply the Edge split modifier
    • Export the mesh with UV's and Normals
    • Done!
    That should export a perfect cage mesh, with all the smoothing groups intact. :)

    Frankie wrote: »
    Well that's strange because your bakes do look great.

    My point is just most of the time, high poly models will have floating details or layers of detail.

    Yea, I know what you mean and it sometimes can be problematic in Blender. If they fixed the baking tools, it would be much easier and less time consuming.
    I was really hoping that Cages would get included in this years GSoC but it didnt happen :(
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Looks like I will probably have to edit both meshes to fix these issues, I still don't know exactly why so many artifacts are appearing. But at least I've now started learning how to bake maps with Xnormal.


    As you can see both the Normal and AO maps have artifacts. I'll try and model another crate/box and see if I get a better result with Xnormal. I didn't use Cage to bake the normals, The video did explain how to use it but I didn't understand it, But watching it again may solve that.

    I must say the result is definitely a lot cleaner than Blender's but it is missing some detail, Like the screws on the hinges aren't there.

    (Reached Limit with Photobucket)


    I can bake planes pretty fine though, I put the junk on it for obvious reasons, I baked this one below in Blender.
    (Reached Limit with Photobucket)
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    You still want to make sure that the mesh is exploded and the UV's are offset and that all the HP and LP parts line up etc.

    Also you should remember that the cage needs to entirely cover all the HP parts that you want to bake from. If the cage isnt covering the screws it wont pick them up.

    Try making a cage using the steps I mentioned in my last post and see how it works out for you :)
  • Snader
    Options
    Offline / Send Message
    Snader polycounter lvl 15
    Just a heads up Dagon, next time you have a problem like this, it's probably better to post it at http://www.polycount.com/forum/forumdisplay.php?f=43
  • igi
    Options
    Offline / Send Message
    igi polycounter lvl 12
    I didn't know that blender is that much advanced on baking stuff.Is bake result from blender synced within udk?Any chance to use cage for baking in blender?If yes then I might use blender instead of xnormal.
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    igi wrote: »
    I didn't know that blender is that much advanced on baking stuff.Is bake result from blender synced within udk?Any chance to use cage for baking in blender?If yes then I might use blender instead of xnormal.

    I really wouldnt advise swapping xNormal for Blender. Blender is vastly inferior in almost every way and I really dont see cages being added to it any time soon. I would stick with xNormal if I were you :)

    Blender uses the same tangent space as xNormal and neither are synced to UDK, but they both seem to be a good match to Marmoset.
  • Zwebbie
    Options
    Offline / Send Message
    Zwebbie polycounter lvl 18
    For the cage, I use this method. [...]
    I wouldn't want to drag this off-topic, but I've always wondered why anyone would really need cages that badly. I've never used one; I just bake a short-ray and a long-ray bake and combine them, and that never failed. Admittedly, baking the AO twice does take a while, but otherwise...
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    Zwebbie wrote: »
    I wouldn't want to drag this off-topic, but I've always wondered why anyone would really need cages that badly. I've never used one; I just bake a short-ray and a long-ray bake and combine them, and that never failed. Admittedly, baking the AO twice does take a while, but otherwise...

    I tend to use a custom cage in xNormal because of the reliable and predictable way in which it behaves. 99% of the time it gives me a perfect bake and for the 2 minutes or so it takes to set up it saves me a ton of time in the long run.
    One of the other reasons is the way in which Blender handles smoothing groups. You have to mark the edges as sharp and then apply an Edge Split modifier, which breaks the geometry at those edges, which makes it impossible to use the inbuilt cage feature in xNormal because as you expand the cage you get gaps in the geometry which cause issues.
    It's the best way I found to get a decent bake :)
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    Then that's where I went wrong, I didn't explode the mesh before baking in Xnormal. And I'll figure out how to use the cage tomorrow morning, And I will post my progress here, And I'm really appreciating all the support and advice I'm getting here! Thank you all so much, If I could repay in any way let me know!

    Any way I decided to try and make a box in a rather unique way. I modelled a HP plane with a little bit of floating geometry. I then baked the Normal and Ambient Occlusion map in Xnormal (I love you!) and it came out great in my opinion. I then created a diffuse from the Normal Map. And from that I created 2 specular maps. The first one the grey metal came out good, But the grid wasn't that shiny. So I tried again and it came out nicely, I tried an emission (Glow map) to be used in UDK but it didn't come out too good, At least in blender's render engine it looks ok but not that efficient.


    @Snader: Thanks for the headsup, I haven't spent too much time on Polycount so I haven't really explored all the areas. Sorry if this was the wrong section to post this sort of topic! Won't do that again :) Looks like I reached my limit on Photobucket so all my images from there aren't showing any more :(

    bevel.png

    bevel2.png

    showfi.png

    show3.png
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
  • Dagon
    Options
    Offline / Send Message
    Dagon polygon
    used Xnormal again to make a bathroom tile texture, It came out excellent. I modelled the tiles with blender. Same technique as with the box above. I need to move on to more complicated models though, That's where the problems come in.

    tiles2.png
    tilest.png
    bakes.png
Sign In or Register to comment.