Normal Maps to Unreal Engine: Baking Normal Maps In Cinema 4D

Photo of John Burdock

Instructor John Burdock

Share this video
  • Duration: 12:22
  • Views: 1012
  • Made with Release: 18
  • Works with Release: 16 and greater

How to bake out textures using the bake texture tool.

In this video, you'll learn the full process of baking out textures inside of Cinema 4D, as well as go over all the baking attributes, that affect normal maps, and how they work. If you would like to follow along more closely, feel free to download the project file.

Less...

Transcript

- Now that we understand how normal maps work and we have xNormal installed on our system, we can finally start baking out our own normal maps inside of Cinema 4D. First off, though, I would like to talk about this object right here. The reason we're using such an organic shaped object is because it better shows the UV seams on the edges of our object inside of Unreal Engine. I've also applied two textures that I have stacked on top of each other with noise in their bump channel to create surface detail that will be baked out in our normal map. I've also applied a gradient in the alpha channel for this top blue texture to help reveal the one on the bottom. All this is to create the worst case scenario that is really going to push this technique to its limits and really show what it's capable of. Speaking of worst case scenario, let's head up and look at our UV map by clicking on Layout and then going to Body Paint UV Edit right here. Now that we're in the body paint UV editor, let's select our object first and then click on the UV polygon mode right here. Here is our UVs for this object and what I did to get this look here, is I went to Projection and then did a Box Projection. Next, I went to Optimal Mapping, to the Realign, and a spacing of 2%. Now, it's really important that you have at least 2% spacing to avoid overlaps of your UVs because this will create seams. To better understand how to create your own UVs and how important spacing is, feel free to check the link in the description of this video to learn more about that. It's very important that you have a properly mapped UV, which is a great time for me to point out that mine right here is actually very messy because there is so many pieces that have been cut off. Each piece will represent an area that will create seams onr objects. So we have a lot more potential areas to have seams in our normal map. So it's important that you have the fewest pieces that are broken off and separated. Again, to learn about this, definitely check out that link. Now that we understand all this, let's head back to the standard tab right here where we can finally started baking this object out. Do this first. Let's head to our model mode right here and then select our object. Next, let's click on Objects and then go down to Bake Object. This will bring up the bake object interface where we can bake out our normal map. First, I would like to talk about the fact that we are not going to be covering anything in here that does not have to do with normal maps. For example, we're not going be talking about Ambient Occlusion or Illuminate because these effects and tabs here do not have anything to do with creating normal maps. First up though, is we have Normals. If we have this checked on or off, it simply says whether we bake out a normal map or not. Since we do want to bake out a normal maps we'll leave this checked on. Next up, we have keep UVs. If we have this unchecked it will generate its own UVs through that same box projection process I just mentioned before. I highly recommend keeping this checked on as we want to use our own UVs that we created for the reasons that I stated earlier. Next up, we have single texture. If you have a multiple objects selected, for example, say four here, we can select all of them and bake them all out at once. If we have single texture checked off, it will bake all of them into each of their own textures. So we'll have four normal maps corresponding to our four different objects. If we have single texture checked on, it will actually bake all of them into a single texture. So all four of them will be stuffed into one gigantic normal or UV map here. There is reasons to do this, but we're not going to be talking about that in this course. Since I only have one object, it really doesn't matter which one I have. So I'm actually going to leave this unchecked. Next, is Replace Object. All this means is it will replace our default object here with the new one that's baked out. I prefer to leave this unchecked because I like to have a copy of my original that I can always go back to. Next up is Super Sampling. This is basically anti-aliasing for our object. So it just smoothes the normal map. Realize though, that if we turn this up to the max of 10, it will drastically increase the render time for our normal map. I found that the results in quality by having this maxed out so high is very negligible and almost unseeable in any sorts whatsoever. So for the sake of this course, I found that for this object it looks just as good by leaving that at zero. Next up is Pixel Border. This is getting a little bit more complicated so to better tell and describe what this does, I'm going to pull up my slides right here. On the left here, we have this representation of our UV maps. Our UV seams and edges can all be seen in here. For example, green represents the true size and shape of our UVs, whereas red demonstrates the expansion of the borders and this is exactly what pixel border does. It expands the borders of our UV map by whatever amount of pixels that we state. For example, here, that amount is 10. So the reason you do this is because game engines including Cinema 4D as well as other 3D engines, and game engines by that I mean Unreal Engine, have trouble reading the edges of a UV map. For example, they're going to try and decide do I read in here or do I read out here? If they choose to read out here, it's going to render the color of the background of your image or render that pacific shader. Now what does this all mean though? If they choose to render the background here instead of the inside here, it will create an issue where it'll look something like this right here. The background in this normal map is black as well as for the color texture so we're getting these black seams. Now realize most of these visible seams here are not from the normal map, but actually from the texture being rendered black instead of the actual color of this gradient. To fix this, you can expand your seams from 1 to, say, 10. This means when it tries to read on the edge of this, it'll always come up. Even if it makes a mistake and reads too high, it will still render the same color or still be part of that normal map and give you much less visible seams. For example, how this would look, if we go for a pixel border of 1, expand our edges out to 10, which then very clearly fixes that issue up. This is really important to have and I highly recommend doing this. Now I'm going to say something a little contrary to just what I mentioned right here and that is Pixel Border doesn't matter for Normal Maps when you're using xNormal. The reason for this is because xNormal has its own version of pixel border and it's called Edge Padding. So edge padding is the exact same thing as pixel border. So when you actually bring your normal map into xNormal, it's going to crop it back to this default original size of your UV map and then expand it back out to whatever padding level of pixels that you specify. So say you put in a pixel border from Cinema 4D, that's a level 10 would look something like this. It will then be cropped back to a level of zero and then pushed back out to whatever your padding level is. So it really doesn't matter what your pixel border is set inside Cinema 4D unless you go too far. This is important. There's a balance to this. If you go too far, you'll actually start intersecting into the UV map over here which will create seams. So it's a balance you don't want to go too little or too far. Now you may be wondering why use pixel border at all inside of Cinema 4D, just let xNormals do the work and that's because pixel border does matter for other maps so it's still important to use. For example, the color channel is not baked inside of xNormal so you will get seams if you do not have a pixel border. So it's still important to use that inside of Cinema 4D. A good rule of thumb is to have your UV map spaced out with a 2% spacing, have pixel border baked out with a 10-pixel expansion, and then inside of xNormal to use that same number of 10. This is what I found to work very well so definitely feel free to try and use that. Next up, before we head back to Cinema, I want to talk about one extra thing and that's width and height. Now, this might seem like something that's pretty simple, but there's actually some stuff to this. For one, it's important to make sure they're all divisible by two. That means they need to be evenly dividable by two for the graphic card to read them in the best performance. Here is some industry standard numbers that you can use that I have written out for you. So feel free to write these down. For the sake of this course, we're going to be using this number here as it's a good middle ground. Now that we understand all this, let's head back to Cinema 4D where we can start baking out our object. First off, we do want to keep our normals. We do want to make sure that we keep our UVs. We do not need to worry about single texture because we only have one object here. We don't want to replace our object because we want to have this original one as our backup. We don't need to have any supersampling because it looks just fine without that, and we do want to make sure we keep our pixel border set to a level of 10 because this will avoid those seam issues. Next up, we do want to make sure we keep our width at 2048 by the same number in the height and finally, we have our format. For me, I prefer to use a photoshop PSD or a TIFF file because these have little to no compression. For the sake of this course, however, we're actually going to use a PNG just because it's a little easier to work with. Next up is Color Depth. All this is is the bit depth for your texture. I highly recommend you use a bare minimum of a 16 bit though I recommend using more of a 24 bit for the best-looking image. Next, we have our Color Profile. This is just choosing whether you want to use sRGB or linear. I recommend using sRGB as Unreal Engine reads this perfectly fine and looks definitely okay with that. Finally, at the very last piece, we have our path name. This is just choosing the save directory for our file. Now you can use the default Cinema 4D search engine for that, though I much rather prefer navigating to the file inside of my folder on Windows 10 using my file explorer, selecting that path, right clicking and copying it so I can use the default search engine that I'm much more comfortable with. And then all I have to do is erase this old path information here just by using the backspace key and selecting it and I can then right click and you paste which will then paste that directory in there. We've now done all that, so all we have to do is click Bake. It is now baking out our object space normal map along with the color texture. Now that it's been baked out, I'm gonna drag my file explorer over here so you guys can take a look at that. Here is our object space normal map baked out and here is the color channel for our object. Notice we didn't have to set anything to bake out the color for our object. This is because it does this by default and another thing I like to note is we didn't have to do any settings to fix this. Most the time, this bakes out perfectly fine. Only thing you have to worry about for your color channel is just making sure you get that pixel border set up. Your color channel is much easier to bake out because it's far less complicated than that tricky normal map. Now that we've done all this, give yourself a big pat on the back because we've just gone through a ton of information. So to finish this all up, let's go through a review of what we just learned. So what did we just learn? We just learned why we're using this type of object for test baking. We learned how to open the Bake Object Interface. We also learned Ppixel Border doesn't matter for normal maps unless you make it too big where then it will intersect in the neighboring UV and create seams. So it's all about balance there. And finally, we learned how to save to a folder.
Resume Auto-Scroll?