The fundamentals of Game Art will now be a weekly post covering the most important aspects of our craft, how they work, and why they exist. After this brief introduction to the new series, let's get on with it!
Texture Baking is responsible for the highly detailed surfaces we see in our games.
For starters, it is the process of transferring details from one model to another, usually a "high poly" to a "low poly" mesh, with the intention to preserve the surface information, curvature, and overall look of a denser and more detailed object and reduce its triangle cost.
The result of a bake is usually a Normal Map. We can generate all sorts of textures like Curvature, Ambient Occlusion, and Material ID maps, among many others. We can also copy the Albedo, Roughness, Metalness, etc., from one object to another.
Now we know what baking does. It is usually not a complex process for every map except for one.
Normal Maps require a lot of care when being generated, so this short guide will focus on them. As per my view on the subject, if you know how to bake normals very well, the rest of the maps are usually an extra click or two to being generated just fine.
Let's start with the basics of any type of baking. UV Unwrapping and Model Smoothing.
When preparing your model for baking, you'll need to keep some things in mind. The first one will be the number of UV islands you want to have. UV islands can be understood as the unique pieces that compose a model UVs.
As you can see in the image above, I have ten UV islands in this model, which I divided into quarters to save UV space and have a better texture resolution.
For this bake to work, I'll need a smoothing group per UV island or simplifying it, a hard edge between the cuts, represented in green on the image above.
Each UV island is separated by a number of pixels. This is called padding, which prevents mipmapping (the lowering of texture's resolution due to distance, for example) from drawing one island's texture into another, causing a non-smooth look.
This is mandatory if we want a smooth result. I'll later exemplify what happens if we don't follow these rules.
Under perfect circumstances, the previous methodology is the one you'll want to follow to get a perfect bake. Some occasions ask for different workflows tho.
Take a look at the following example.
Notice how the same object is now using less than half the space the model above was using. This allows for more objects to make it into the texture, as we are not using any space for padding within this object's UV islands.
However, this comes at a cost, a non-flat normal map, which might be desired if we want to generate maps from it, for example.
As per the previous point's rules, each UV shell has one smoothing group, meaning the entire object is shaded smooth.
There are more advanced techniques for preparing objects, like chamfering hard edges and applying weighted normals to the object, but I won't get into that as it isn't the preferred solution in almost any case.
It is not common to see it being used, as it is more expensive than a regular bake and doesn't significantly boost the look of the object.
Let's now look at the two different examples in action. Let's transfer the roundness from our higher poly model to the lower one.
First, we need to place our objects in the same position so that they overlap each other. I won't get too much into detail on the parameters I use for baking. Just know that I use Marmoset Toolbag.
Something important when baking hard-edged models is the cage.
Our cage will determine how far the renderer needs to look for objects. A huge cage will introduce other objects that we might not want to bake into the normal map. A cage too small will not reach the boundaries of the high poly, which will generate artifacts.
As you can see, cages matter a lot.
Added to cages, we have another element of control in some software like Marmoset Toolbag. Skew.
Skew controls the ray direction when baking a model. Under the perfect circumstances, you want to use both cage and skew controls. Let's take a look at what skewing does.
I added two elements to the high poly that I want to be baked into the low poly.
When baked without a proper skew (Image Above), we can see a heavy object distortion. When skew is properly set up (Image Below), we get a perfect result.
Back in the day, when these controls weren't used, we had to add support loops to the geometry that we were baking, which for a smoothed model that will alter the shading completely.
I want to exemplify what happens when we don't follow the smoothing group rules to wrap this up.
I will bring in various examples to demonstrate the importance of following the guidelines that I mentioned in this tutorial. We will also see examples of a smooth object bake, which I explained the pros and cons of a few paragraphs ago. Let's take a look.
On the left, a hard edge object with one UV island. A perfect one in the middle, following all the rules under perfect conditions, and a rounded one on the right with a single UV island.
All three might look similar, but their normal maps don't.
The right object's normal map won't allow for easy changes within photoshop, like fixing a baking error.
If we look close enough, the object on the left has a visible seam on the object's edge.
This seam will accentuate even more the further we are from the object due to mipmapping, which I'll cover in another article. I would discard this as a method entirely.
The middle shows the perfect bake, which can't always be used due to its heavy use of padding. It's always a tradeoff between those two.
I hope I didn't forget anything. If that's the case, don't hesitate to ask your questions in the comments or via our discord.
If you want to learn more about baking, this Marmoset Toolbag 3 could very well complement this article.
Thank you for reading, and have a great time baking!