Home Technical Talk

Learning to bake

Nightmare106
polycounter lvl 4
Offline / Send Message
Pinned
Nightmare106 polycounter lvl 4
Hi guys, I have a request, I've been reading about baking and how it all works and what are do's and don'ts and for practice, I've decided to make a quick little asset I wanted to bake onto a low poly object. I plan on making a ton more assets as a practice in the next few months as soon as possible.  The only time I managed to succeed is when I build a really really low poly object that was only just covering the hipoly but it looked so cubic and ugly I decided to make the lowpoly a bit more detailed, rounded with rounded edges similar to hipoly. I've basically wasted my entire weekend with a large headache. I've been always scared of baking (except for the planar baking) because I always have trouble with it. So if anyone would be so kind as to quickly make a low poly version of my object and generate a normal map and explain it to me what I need to look out for I would be mighty gratefu! I am doing this to get a better grasp on how things works with baking if I could just nail down baking I could start making my own stuff. I'll also provide my own low poly object. The main trouble is these strong colors in my normals, purple colors and also missing on the sides details, when I modify the mesh to cover the side details better I then get a whole lot of other baking issues.

Here are the files, I will also provide my own low poly, the hipoly is unsubdivided so that's all you need to do.

Low poly with UV's, the way I 've decided to bake it right now is with the sides detached, so all you have to do is
detach the sides, offset them a little, clone and repeat for cage and it's ready to be bake.
https://drive.google.com/file/d/0B5LkU6iWBX0XNEtnRkE3cE1rSGM/view?usp=sharing

Hipoly
https://drive.google.com/file/d/0B5LkU6iWBX0XZU44YTBiclYyZzA/view?usp=sharing

EDIT:
Okay so to make things easier for you guys since making a low poly can be time consuming at times, I've constructed a quick low poly from the hipoly. I am not baking the entire mesh, just the main part of it. This is my area of problem if I can figure out how to bake it, I shouldn't have trouble baking other parts as well.

Here is the low poly mesh, there is some minor smoothing issue on the low poly


The cage is basically a push modifier applied to the mesh and another edit poly on top of it but here's the big problem:

The way I plan on solving it right now is by detaching the sides of the low poly and then baking the sides seperately (doing a planar bake with the UV's already unwrapped and packed. The same thing is for the front detail, it's a bit extruded and it causes a slight small gap but not enough to give me errors in bakes. Here is my bake by detaching the side of the low poly and doing a planar bake:

Okay so basically this idea worked and am finally getting a more proper bake, I am still getting some issues as you can see I think these I will solve more easily now but I will reupload my own new low poly  (basically the sides are just detached). Am gonna go back into Max and see what's causing these smaller artifacts in the mean time you guys can have a look at my low poly and hipoly by downloading. I'd love to hear your opinion because this is my first true hipoly to lowpoly bake. Thanks a lot!

Replies

  • ZacD
    Options
    Online / Send Message
    ZacD ngon master
    You might get more help if you post pictures of your high poly and low poly along with the downloads. 
  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    ZacD said:
    You might get more help if you post pictures of your high poly and low poly along with the downloads. 

    I've posted a picture. The download links are right there.
  • The Rizzler
    Options
    Offline / Send Message
    The Rizzler polycounter lvl 9
    The download links are right there.

    And you'd be lucky for anyone to download the files, let alone build a workable low poly for you. That takes time and effort which most people on this site can't spare. The best thing to do is make helping you as easy as possible by showing more pictures, trying to create a low poly yourself, showing the texture flat for the normal map etc. so we can steer you in the right direction at least. Making a few small props in succession sounds like a good idea. You didn't mention a cage, you are aware of how a cage factors into the baking process right? The laziest way to make one is to add a push modifier to the low poly and to export it as a separate cage file (if you were using xNormal - you'd use a projection modifier if you were baking inside max, but I don't prefer that way)
  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    I'd really love to get some feedback on this one, at least point me in the direction, I really want to bake  this one out, am assembling a whole new lowpoly mesh and I will post pictures of my bake so you guys see what problems I have.
  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    The download links are right there.

    And you'd be lucky for anyone to download the files, let alone build a workable low poly for you. That takes time and effort which most people on this site can't spare. The best thing to do is make helping you as easy as possible by showing more pictures, trying to create a low poly yourself, showing the texture flat for the normal map etc. so we can steer you in the right direction at least. Making a few small props in succession sounds like a good idea. You didn't mention a cage, you are aware of how a cage factors into the baking process right? The laziest way to make one is to add a push modifier to the low poly and to export it as a separate cage file (if you were using xNormal - you'd use a projection modifier if you were baking inside max, but I don't prefer that way)

    Thanks for the response, I'll be editing my original post now and yes am aware that I need a cage that needs to have it's normals averaged as well, right? I've been using a cage and I get these small rendering issues but the biggest problem that I have is with the side detail that is extruded outwards from the surface that the lowpoly cannot cover without creating a gap.  I've created a new lowpoly.
  • repete
    Options
    Offline / Send Message
    repete polycounter lvl 6
    Starting out like this is going to cause you headaches and frustration (been there done that) as you are now experiencing. Break the model down into manageable parts and go through the learning process. I would start on the lid/top and work on the low poly & bakes so you know what your doing.
    People will gladly help you and you will learn quicker.

    It may look like a simple dumpster but as you have found out it's not that simple.


  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    Am actually taking about the single part of the dumpster that am trying to get a good bake, if I can get a good bake with it, I'd work on the rest of the mesh, if necessary I'll reupload my hipoly to just include the dumpster's body, that will reduce file size and you guys will see what am focsuing on, you should be able to see on the picture what am talking about. I managed to solve the gap problem. Am looking at the places where the artifacts are occuring to see what might be the problem.
    Here is the mesh in UDK
    You can see some waviness, it's not straight, distortion of some sort, although it does not appear in the bake, the other side is completely fine, I've no idea why this side is a bit distorted, I've checked the UV's, they seem to be fine and relaxed completely. Am not doing hard edge baking, everything is averaged, am using the bevels around the meshes as support loops so this might be causing it? I need proper support loops?  Am going to try and do this with flat edge baking.

    Am reading up about how the baking tools work exactly and this is what I've found:

     Baking the normal map works by calculating the DIFFERENCE in the surface normal between a particular point on the low resolution mesh and the nearest point on the high resolution mesh. As long as they are sitting on top of each other, everything should work as expected.

    Meshes wireframe result

    Above you can see the two meshes are on top of each other (the middle image is only the wireframe of the left image, not another mesh) and the resulting normal map.

    So the position of the surface is used to determine which points on the low and high resolution meshes go together, the UV of the low resolution mesh is simply the target output of the bake and no UVs are used in the calculation of the normals, thus the high-res mesh doesn't need any.

    Also, clean topology is also important for correct deformation in rigged models. As long as there are no overlaps and the islands aren't too close together (3-5 pixels is usually fine) the quality of the UV map isn't too important.

    Ergo: This difference is what's causing the gradients, the difference is used to be added to the lowpoly normals to make the hipoly normals, right? I just don't get why am getting these seams all over my mesh, there is no uv shell bleeding, the normals aren't bleeding into each other I've left more than enough space between each shell. Am slowly beginning to understand baking  by baking and doing a bit of research but it would be much much quicker if someone actually stepped in, saw my lowpoly and told me exactly what am doing wrong and why it is wrong.


  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    Okay after a weekend filled with headaches and nerves running rampant, adjusting low poly, making a lowpoly for a 1000th time and finally calming down and doing some research for the past 2-3 days, I can finally say am close to getting to a perfect bake and fully understanding (finally, should 've done this a year ago and save me some trouble) baking process. I am getting a perfect bake with just one teeny tiny gradient that I can easily fix by adjusting the smoothing or moving the lowpoly a bit. Did a hard surface bake, the averaged smooth bake was close to being close but it was lacking the supporting loops which I didn't want to add as I alredy have enough UV seams that add to my vert count. But I will be doing averaged smoothing whenever I can since it saves up on the vert count.


  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4


    Here is a problem with smoothing I have, there's a seam right where the smoothing group is but am guessing this is normal and there's nothing that can be done about it, it's just the way the smoothing is. If anyone has any suggestions on how to fix this I 'd love to hear their feedback. In any case, thanks for the help and response guys. I 'll post the final pic of the dumpster, when am all done.
  • SoDakZBrusher
    Options
    Offline / Send Message
    SoDakZBrusher polycounter lvl 3
    You need to check out Glen Patterson's tutorial for baking in Substance Painter - https://www.youtube.com/watch?v=OhoOHzoVReQ. It starts with ZBrush for the modeling and UVs but the rest of the process was very helpful to me learning (I am a noOb when it comes to SP and Marmoset).

    Using Glen's tutorial I was able to use your hi res mesh to create the low (exported from ZBrush as an fbx) and high mesh (Exported as a hires obj) to bake some 2048x2048 maps.

    Using your "high res" mesh as a low res mesh starting point in ZBrush, I broke up and consolidated the parts of the main dumpster bin into the polygroups ZBrush needs to create UVs. Then I vertically aligned the UVs in ZB and then after about an hour I was done creasing the edges needed to maintain the mesh's final form after it is subdivided (the final high res had about 4mil quads). After a bit of bashing and denting the high res mesh I exported it from ZB as a high res obj. I then exported the low res mesh from ZB (with UVs assigned) as an fbx file, again using Glen's tutorials.

    Using the resulting baked maps I created using Glen's tutorial I then used Curious Engine's excellent Substance Painter tutorials at https://vimeo.com/user12201680 I was able to texture and export the maps needed for a quick render in Marmoset. I only worked the basic body of your dumpster, the same steps would be pretty easy to do with the rest of the model's parts.

    Like the others have said, the key is to use the resources that are "out there on the 'Net" and pay your dues to learn the apps you are learning.

    Good luck and don't ever give up learning.
  • SoDakZBrusher
    Options
    Offline / Send Message
    SoDakZBrusher polycounter lvl 3
    Almost forgot to add...the poly count for the low res was just under 4,900, the final high res mesh, undecimated, was just under 1.5mil. I should have decimated the high res...would of cut the poly count to under 1mil. Also, the final maps were only 2K. :/
  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    Wow, nicely done!!!!  Problem is, I am more focused on the 3ds max + Xnormal workflow, I got the both workflows nailed down right now (the all averaged method + skewmesh with object space and the flat edge method) but I don't have the time to finish the dumpster right now, I should be able to start working it tomorrow or day after. All of the parts and pieces need to be baked and then proceed to texturing. I got a perfect bake as you can see in the picture above with mild gradients on inner side but it is not noticeable in the engine so I guess I can get away with it. I love this site so much I've learned so much just by reading the sticky threads it helped a lot it! You guys are just amazing. Thanks a lot SodakZbrusher, for the effort and the time! Tomorrow when I have the time I'll try and finish it! :smile: 
    P.S. Merry Christmas and happy holidays to everyone, I know it's 2 days late but it's the thought that counts!
  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    Hi guys, happy new year! Came here to post an update, I've learned a lot about baking even from a simple thing like a thrash bag which I had to rebake like a 100 times and look at the missed spots and figure out why it wasn't capturing that detail (the normals weren't following the curvature properly to capture all of the detail - LEARNED something new!) So to post the pic of my final mesh, man this has been tedious and long voyage and I've definitely learned a lot and nailed the baking theory, at least I think?. Here is the mesh: 

    The normals are doing a great job, but there are still a few issues that I know how to fix easily, still some quick texture editing to do, to hide away the seams. I did notice strange something yesterday morning when I proceeded to check the mesh for any possible problems and I've tried fixing it to no avail, here is the problem:


    There are strang artifacts on my normals, at first I thought it was compression. So I went through the settings of the normal map, switched the U and V adressing to clamp instead of wrap to avoid any issues, I've tried turning off compression completely, reimporting, setting it to no compression mode and nothing, It's still there. The normal map is quite good, there are some gradients but it's not all bad, it worked fine before!
    Here's the normal map of the lid:


    I then looked at 3ds max and thought there might be a problem there (P.S. I didn't use hard edges, I've relied on supporting loops, yesterday I've tried
    using hard edges and am getting a bit better but still same result and now there's skewing along the handles, I guess it needs more edges around the
    handles for them to bake in nicely. So no change basically. What I did notice is that the artifacts in the engine looked similar to the overlaps of the lowpoly and the hipoly



    It's not looking the same as the artifacts on the normal map now but this is a different mesh right now, I'd have to retrace my files to find the original mesh, basically you can see the overlaps between hipoly and lowpoly being similar to that of the artifacts on the normal map. I've tried pushing out the lowpoly but it didnt' help the bake. Am still getting them. Using magic wand on the normal map with 0 tolerance I've found that the artifacts are in fact, there they 're just hard to spot. By overlaying the normal map a couple of times on top of itself, I was able to see this:

    How do I fix this? Am gonna try and render out a better normal map with hard edges again, I'll try to fix some of those issues but if anyone could help me figure out whats going on I'd be mighty grateful. If you guys need anything please let me know. I was planning on sharing the mesh and the textures once I was finished but if needed, I will post the files now, in this state, if it helps you guys to figure out what's going on. Once again, thanks a lot guys for taking the time to help me out, I've been through hell these last few days, the time I spent most was baking and reiterating trying to figure out what's wrong. I greatly appreciate all the help so far and hope to get some more feedback from you guys.


  • huffer
    Options
    Offline / Send Message
    huffer interpolator
    Those gradients aren't necessarily bad, gradients in the normal map compensate the vertex shading gradients in your low poly, getting it to look like your high poly in the end. Yes, you can get rid of them with hard edges or support loops, use an empty material on your low poly to identify any vertex gradients.

    The artifacts are probably due to to compression. If you bake in xNormal you can try saving a 16-bit TIFF, then in Photoshop set Image mode to 8-bit and save (don't use .jpg, .tga should be good), this will get rid of those artifacts but will introduce dithering to create the gradient, it might be less noticeable, also make sure there are no small gradients or weird shading on your high poly. If you bake in 3dsmax, the baker uses dithering by default.
  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    huffer said:
    Those gradients aren't necessarily bad, gradients in the normal map compensate the vertex shading gradients in your low poly, getting it to look like your high poly in the end. Yes, you can get rid of them with hard edges or support loops, use an empty material on your low poly to identify any vertex gradients.

    The artifacts are probably due to to compression. If you bake in xNormal you can try saving a 16-bit TIFF, then in Photoshop set Image mode to 8-bit and save (don't use .jpg, .tga should be good), this will get rid of those artifacts but will introduce dithering to create the gradient, it might be less noticeable, also make sure there are no small gradients or weird shading on your high poly. If you bake in 3dsmax, the baker uses dithering by default.
    Hey, thanks for response!!!

    The gradients in my normal map are not extreme if you look at them you 're definitely right, they are supposed to be there, they still come out same. Some of these gradients are there because my lowpoly parts are lying flat where there's a smooth bevel/corner and that gradient is representing that smooth corner I guess.
    EDIT: Should I use any special settings when saving to 8 bit TIFF? Also, any special reason why TIFF is better than TGA? I'm using UDK and UDK does not support tiff files but I will bake to tiff then save it as tga.



    The artifacts are a lot less visible now that I am using 16 bit converted to 8/bit per channel TGA but they are still present. Am starting to think I should add more edge loops around the area where the artifacts are, when I bake.



  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    Okay, so I added more support loops, the handles look less distorted, skewed and the artifacts are completely gone! While tiff 16 bit did help a lot to alleviate the issue, adding more loops at that area, completely removed them. Thanks, a lot huffer, I'd have to go through a ton of googling just to get this kind of info! The bake is fully perfect now. Going to wrap this up, quickly fix some smoothing issues, cover up the seams and call it done. Last post I make will include the finished mesh for you guys to download if you want to tinker around.
     
    Ooops.... got it wrong, it isn't fixed. Been scratching my head because the mesh got the artifacts again, so I recreated the mesh thinking some corruption must have happened and rebaked it a couple of times and then I noticed something... when I clicked defer compression, I would get a result like in the image above. So basically whenever I compress to TC_NormalMap the artifacts happens,  when I use 16 bit tiff it seems to help lessen the artifacts but they 're still there. I 've no clue how to fix this issue at this point on how to fix this. The only thing that comes to mind is to try and edit this in PS and try to match all the colors together.

  • Nightmare106
    Options
    Offline / Send Message
    Nightmare106 polycounter lvl 4
    Hey guys, it's me again. xDD Just posting my final update and the mesh files. After baking several times, recreating the lowpoly of the lid from the hipoly a couple of times, I've realized the lowpoly might not follow the curvature of the hipoly enough at some places and this is what's causing those artifacts. Those artifacts are basically 127,127,255 normals but not all of them are that values, the R and G values move by 2-3 values so, even though 16 bit mode tiff saving helped a lot, I decided it wasn't good enough, it just looks bad. This is essentially a perfect bake except for a couple of those place where it's not following the curvature properly and am already using more than necessary amount of polys for the lid just to follow the curvature, the problem areas are found at the handle and anywhere where there's some detail and those details need to be flat. Adding support loops helped a bit to remove artifacts by a bit. So I decided to force brute it, this is a perfect bake except for those places where the values were off by 2-3 points in the R and G. So I took a magic wand set the tolerance to 4 made the selection and filled them all with 127,127,255, Imported and compressed into UDK and voila! It worked like a charm! There's very little artifacting on the seams but it's barely noticeable, I could try removing it the same way but I'd risk losing some of those gradients that need to be there. The process is easy and quick though but it's barely noticeable so why bother with it?
    Here is the pic:



    All in all this was a great learning experience, I've actually learned a lot, from you guys, from researching and really focusing on nailing that one thing that's crucial in getting perfect bakes. I'd like to thank ZacD, The Rizler, a whole lot of thanks to SodakZbrusher, who even took the time to make a bake and texturing pass of his own and most of all - Huffer, his tip is something I am definitely not going to forget soon! xDDD  Thanks guys, much appreciated for your time! And also to the community in general for those awesome sticky threads that were mighty useful in figuring out how it all works, what are do's and dont's and etc.
    You can download and view the mesh in sketchfab, the textures are downscaled but they look a lot more worse than in UDK. Wish I spent more time texturing this though and setting up the UV's than baking.
    https://skfb.ly/JM9K



  • huffer
    Options
    Offline / Send Message
    huffer interpolator

    Hey, thanks for response!!! If you scroll up higher where I was trying to understand how to bake properly by understanding how baking actually works, this is where I got that aha! moment, I figured out how it works (or at least I think I do/did?), when baking, the bake tool uses the lowpoly's normal and hipoly's normal and looks at the difference between the two vectors and cretes the difference vector which I guess is written into the normal map, this is where those gradients are coming from. So basically: Hipoly normal - lowpoly normal = difference, (B-A=C), this is my normal that goes into normal map, so when I add the the difference (normal map) and lowpoly normal together, I get my hipoly normal, so, as the difference between the lowpoly and hipoly gets smaller, so do the gradients in the normal map which are there to compensate for the shading in the lowpoly. This is why I would want to have my low poly to have shading and normals similar to that of hipoly and to help capture the hipoly normals properly without gaps. This difference becomes 0 or very small. I might have understood this too simplistically, there's probably a ton more to it but I think this might be the general idea of baking.

    EDIT: Should I use any special settings when saving to 8 bit TIFF? Also, any special reason why TIFF is better than TGA? Am using UDK and UDK does not support tiff files but I will bake to tiff then save it as tga.

    The artifacts are a lot less visible now that I am using 16 bit converted to 8/bit per channel TGA but they are still present. Am starting to think I should add more edge loops around the area where the artifacts are, when I bake.

    Yes, the data in the normal map influence the per-pixel shading of the low poly, making it look like the high poly once the map is applied, but if your low poly has some soft edges in such a way the low poly has vertex shading gradients, the normal map will also have gradients to compensate. This is a good thing, it means it works right, and the low poly will look as flat as the high poly with the normal map. The low poly doesn't necessarily have to be so similar in shading to the high poly, you get gradients in the normal map is if the low poly has vertex shading artifacts (think of a cube with a single smoothing group or 90 degree angles between surfaces with soft edges).

    Also think of this - I remember reading that with idtech engines they used all soft edges on small props, I believe even the new Wolfenstein used this..so the normal maps were full of gradients, and it's not a bad thing, it means you don't have to split every hard edge on the UV's, you can avoid seams, and you save on the vertex count (since hard edges count as vertex splits), it saves time, etc.

    The only reason to save to TIFF (16-bit) in xNormal is so you get the full 16-bit baked map (if I remember correctly .tga doesn't support this) - once you set image mode to 8-bit and the gradients get dithered, there's no reason to save anything other than .tga.

    It's very good that you figured out how to fix these, but remember that artifacts like these will not be so visible once you add textures, and generally they will be accepted (sometimes the baked map will be downscaled in-engine), they're mostly visible if you use a very reflective material, like a mirror, but in that case, if you want crystal clear reflections, it might be better to not bake, and use chamfers to make the low poly. :)
Sign In or Register to comment.