In this tutorial, we are going to learn how to bake the Normal and AO
(Ambient Occlusion) maps from the high-res model. In next-gen
gaming, Normal and AO maps are a very major part of the pipeline and we
have to generate these maps before texturing, because the texturing
process depends on it.
So let’s learn how we can bake a Normal and AO map using 3ds Max.
Correct placement of the high and low-res meshes is the most important
Here we start by arranging some layers, because it’s always
better to work using a proper naming convention and layers.
You can see I have placed the high-res mesh in a Hi_Mesh layer, and the low-res mesh in a LO_Mesh layer. Once done, position both meshes in the same place so they perfectly overlap each other. You can use the Align tool for the best fit.
The smoothing groups of the mesh should be separated according to how the mesh is unwrapped. There are two ways to assign smoothing groups to an object.
The first way is to manually select the polygons you want to smooth and choose a different
smoothing group number.
The second way is to use a good script
for this purpose. I prefer the Textools script. It’s a free
to download, easy to use and very helpful script. You can download it
It’s also very easy to install. Just drag and drop it onto the 3ds Max interface and choose Quick Install when prompted. Once installed, you will see a floating tool bar just like what's shown below.
With the Low-Res model selected, go to Tools > Smoothing Groups from UV shells.
This automatically applies several modifiers to the object as shown in the following image. Collapse all the modifiers, or Convert the mesh into an Editable Poly.
Sometimes you may face problems with your Normal and AO (Ambient Occlusion)
map, if you have overlapping UV faces. So you should always move any
overlapping parts out of the UV box.
Most of the time, I use the Absolute Relative Type Ins for this. With the overlapping parts selected, enter a value of -1 or 1 in U or V box and hit Enter. The selected unwrapped faces will be moved outside of the UV box.
You can also achieve the same task with the help of the Tex Tools script. It’s very easy and quick. First click on the Open UV Editor option.
You will get several new tools along the top of the UV editor window. Just click on the Shift Overlap button and all the overlapped parts will be moved out of the UV box.
After this, collapse the UVW Modifier by Right Clicking on it and choosing Collapse All.
2. Render to Texture Setup
Now press the 0 (zero) key, or go to Rendering > Render To Texture...
This opens the Render To Texture dialogue box.
First, we need to define the Output path or folder, so the generated maps can be stored there. Here I have made a new folder named Fire Extinguisher.
Now select the Low-Res mesh and click on the Pick... option.
Here select the High Res mesh, or "Target" mesh which will be projected onto the low-res mesh.
3. Adjusting Projection Settings
After adding the target mesh, you will see there is now a Projection modifier applied on the low-res mesh and a blue colored wireframe around the meshes. This is called the Cage.
Next click on the Cage roll-out tab to expand it.
Click on the Reset button, so the cage will be reset and firmly applied onto the mesh.
You can see the cage is now wrapped firmly around the mesh, so enable the Shaded and Point to Point options. When you enable the Shaded option, the cage turns into a face display mode.
Look at this! This is not the low-res mesh, but the cage has
been turned into faces because we've turned on the shaded display option. However you can
turn it back into wireframe mode again by switching off Shaded mode.
Push is an option which will help in covering the high res mesh with the cage. You can manually edit the vertices of the cage, or you can increase or decrease the overall size of the cage using the Push Amount and Percent options.
Note: The low-res mesh and high-res mesh should fit together and the cage should not intersect with either the high or low-res mesh. It should always be a little bigger than the mesh. For the best results, keep your meshes as close together as possible.
4. Render Settings
Once you have set the cage properly, move back to the Render To Texture window.
Here you will see is an option for Padding.
This depends on the pixel gap between the UV seams. We need some
extra pixels on the baked map outside of the seams, as they protect the
seams during compression or mip mapping.
I prefer to use a Padding value of 3 to 6 for a 2048 map, though it may vary from engine to engine based on compression and the specifications. Follow the same Mapping Coordinates settings as shown in the image below, and then click on the Add button.
This opens the Add Texture Elements window. Here you can
choose the desired elements like Normal, Ambient Occlusion, Shadow etc.
I prefer to use the Lighting Map option for Ambient Occlusion, so I have selected the NormalMap and LightingMap elements. Once you have made your selections, click on the Add Elements button.
You can see these two maps have been added to the Output table. Now click on the File Name and Type button.
Let’s define the proper file name and type. You can see that the file name is a combination of the mesh name and element type. Set the file type as .TGA and click on the Save button.
A confirmation window opens. Here choose the 32 Bit option and then click on OK.
Let’s go back to the Render To Texture dialog and select the Ambient Color option in the Target Map Slot.
Now select both elements one by one and define the map size. (I will select 2048x2048 for both.) To define the map size, first select the LightingMap and then click on the 2048x2048 option.
With the NormalMap selected, choose Bump in the Target Map Slot. Click on 2048x2048 and enable the Output into Normal Bump option.
Now it’s time to add lighting to the scene. So click on the Lights tab in the Create panel.
Select the Standard lights option instead of Photometric using the drop-down menu.
Add a Skylight into the scene.
Let’s go back to the Render To Texture window and click on the Options... button.
This opens the Projection Options window. Click on the Ray Miss Color check box. The default RGB value for the Ray Miss Color is 255,0,0. We have to change it to 127, 127, 255 as this is the base color of a Normal map.
Now click on the Global Supersampler, Setup... option.
Here we can setup the quality of the maps. We have to adjust the global super sampling and filters for better Antialiasing.
Enable the Global Supersampler option and choose Hammersley from the list. Then choose Mitchell-Netravali as the Filter.
There are many filters for antialiasing, but I prefer Mitchell-Netravali (for smooth results) and Catmull Rom (for a sharp arrangement of pixels).
For Global Super Sampling, there are two major samplers – Adaptive Halton and Hammersly. Both have 4 to 40 samples in the X and Y axis, but there is a big difference in the quality and output time.
Adaptive Halton is lesser in quality than Hammersly, but faster in rendering, so I prefer Adaptive Halton. But if you want a quality bake then choose Hammersley.
Next click on the Advanced Lighting tab.
Select the Light Tracer option from the drop-down menu.
Now let’s adjust the samples. For a standard output, the value could be 250-300, and for a quality output, 500-600 samples are fine. After setting the samples, click on the X button to close the window.
Now it’s time to bake the maps. Inside the Render To Texture box, go to the Baked Material roll-out and click on Render.
Here is the final rendered result.
Additional Notes: If the Normal and Ambient maps are not working well or show some artifacts after rendering, these may be the possible reasons:
- The smoothing groups are not setup correctly according to the UV Map seams.
- The high-res and low-res meshes are not aligned correctly.
- You are choosing the wrong mesh for the projection.
- The Cage is overlapping the projection mesh, or intersecting.
- There are some overlapping elements inside the UV box.
- You may have chosen the wrong UV Channel.
- The mesh normals are flipped.
- You have not added a Sky Light for the AO (Light Map).
- If the light map is looking flat, you should check the Light Tracer option.
- You are choosing an incorrect map or element for baking.
- Always use proper names for objects, so that you can be assured what you are selecting is correct.
- Bake smaller sized maps for testing and once you are assured the result is correct, make them larger.
- Bake the Normal Map first without using the skylight and Light Tracer option, because it takes a lot of time to render.
- You can sometimes paint out artifacts in Photoshop. So always rely on Photoshop for some post production work, and don’t hesitate at all to use it.
- If you find you're getting the same error again and again, try to Export the mesh as an .OBJ, and then re-import it and try again.