Sub topic 12
Baking the normal map
This chapter covers the bake itself: the settings, the image setup, the bake call, and the result. It assumes you can navigate Blender, edit materials in the Shader Editor, and unwrap a mesh with seams. It also assumes you have already prepared a high-poly and low-poly pair with applied transforms and clean, non-overlapping UVs. Earlier chapters cover the Selected to Active workflow and cage settings. Here they are used, not introduced.
What the bake produces
A tangent-space normal map stores, for each texel on the low-poly UV layout, the direction of the high-poly surface normal. That direction is expressed relative to the low-poly surface. The baker shoots a ray from each point on the low-poly surface toward the high-poly mesh, finds the hit, reads the high-poly normal, and converts it into the low-poly tangent frame. The result is an RGB image where a flat surface is a uniform light blue (about 0.5, 0.5, 1.0) and detail shows up as shifts away from that color.
Because the data is relative to the surface, the map keeps working when the low-poly mesh is posed or deformed. This is why tangent space is the usual choice for game assets and animated characters.
Step 1: Switch to Cycles and set the options
Baking happens in the Cycles render engine. In the Render Properties, set Render Engine to Cycles. Samples matter little for a normal bake because normals are not noisy, so a low value such as 64 is enough. Open the Bake panel and set:
- Bake Type: Normal.
- Space: Tangent.
- Swizzle: leave at +X, +Y, +Z for an OpenGL-style map. Engines that expect DirectX convention need a flipped green channel, which a later chapter covers.
- Selected to Active: enabled.
- Cage: off at first, with Extrusion around 0.02 and Max Ray Distance at 0.
- Margin: 16 px for a 2048 image.
Extrusion pushes the low-poly surface outward before rays are cast, so rays begin outside the high-poly mesh. Max Ray Distance limits how far a ray may travel. At 0 there is no limit, which is fine when the extrusion is large enough to clear the high-poly surface.
Step 2: Create the target image
The baker writes into whichever Image Texture node is active in the low-poly object's material. Without it, the bake stops with an error.
- Select the low-poly object and open its material in the Shader Editor. Create a material first if it has none.
- Add an Image Texture node and click New.
- Name the image, set 2048 x 2048, and turn off Alpha if you do not need it. Do not use a color-filled generated image for a data map without checking the next step.
- In the node's color space dropdown, choose Non-Color.
- Click the node so it is the active node (white outline).
The node does not need to be connected to anything. It only marks the target.
Step 3: Select objects in the right order
Selected to Active reads from every selected object and writes to the active one. Select the high-poly object first, then Shift-click the low-poly object so it becomes the active object. Check that the low-poly name is highlighted in the Outliner. If the order is reversed, Blender tries to bake onto the high-poly mesh, which usually has no UVs, and reports an error.
Step 4: Bake
Press Bake in the Bake panel. Blender shows a progress bar, then the target image fills in. Open the UV Editor with the image displayed to review it. The image is not saved to disk yet. Use Image > Save As and choose PNG, or leave it unsaved and pack it into the file. An unsaved, unpacked image is lost when you close Blender.
Scripted version
The same bake in Python is useful when you need to repeat it with different resolutions or objects. This script assumes objects named Asset_high and Asset_low, and that the low-poly object already has a material.
import bpy
high = bpy.data.objects["Asset_high"]
low = bpy.data.objects["Asset_low"]
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
scene.cycles.samples = 64
bake = scene.render.bake
bake.use_selected_to_active = True
bake.cage_extrusion = 0.02
bake.max_ray_distance = 0.0
bake.margin = 16
bake.normal_space = 'TANGENT'
img = bpy.data.images.new("Asset_normal", 2048, 2048)
img.colorspace_settings.name = 'Non-Color'
mat = low.active_material
mat.use_nodes = True
nodes = mat.node_tree.nodes
tex = nodes.new('ShaderNodeTexImage')
tex.image = img
nodes.active = tex
bpy.ops.object.select_all(action='DESELECT')
high.select_set(True)
low.select_set(True)
bpy.context.view_layer.objects.active = low
bpy.ops.object.bake(type='NORMAL')
img.filepath_raw = "//Asset_normal.png"
img.file_format = 'PNG'
img.save()Three details in the script map directly to the manual steps. Setting nodes.active is the equivalent of clicking the node. The select_set calls plus view_layer.objects.active reproduce the selection order. The // prefix saves the file relative to the .blend file, so save the .blend first or the path will not resolve.
Step 5: Check the result
Before using the map, look at it.
| What you see | Likely cause |
|---|---|
| Uniform light blue with faint detail | Extrusion too small or high-poly mesh too far away, so rays miss or hit little detail |
| Black or bright spots | Rays missed the high-poly mesh. Raise extrusion or use a cage |
| Visible lines along UV island borders | Hard edges on the low-poly mesh without matching seams or splits |
| Detail looks inverted | Wrong Y convention for the target engine |
| Staircase edges | Resolution too low for the detail size |
Then test the map in a material. Connect the image through a Normal Map node set to Tangent into the Principled BSDF Normal input. Rotate the viewport light and watch whether the details respond correctly. A later chapter walks through this setup and the fixes for each artifact above.
Edge cases
- Smooth shading mismatch. The bake captures the low-poly shading normals. If you change from flat to smooth shading after the bake, the map no longer matches. Set the shading and any Weighted Normal or Auto Smooth equivalent before baking, and do not change it afterward.
- Modifiers. The bake uses the evaluated mesh. A Subdivision or Mirror modifier on either object is included. Disable modifiers you do not want baked, and apply the ones you do.
- Multiple materials. Each material slot on the low-poly mesh needs an active Image Texture node pointing to the same image, or faces using other slots are skipped or fail.
- Overlapping UVs. Mirrored or stacked UV islands receive the same texels, so the last result written wins. Details on one side then appear flipped or averaged. Keep islands unique for a normal bake.
- Scale. Extrusion and ray distance are in scene units. A 2 m asset and a 20 cm asset need very different values. Scale-related misses are the most common reason a working setup fails on a new model.
Exercise
You select the low-poly mesh first, then Shift-click the high-poly mesh, and press Bake with Selected to Active enabled. Blender reports an error or produces an empty result. What went wrong, and how do you fix it?
Show answer
Selected to Active bakes onto the active object, and the active object is the one clicked last. Here the high-poly mesh is active, so Blender tries to bake onto it, and it typically has no UV map or active Image Texture node. Deselect everything, select the high-poly mesh first, then Shift-click the low-poly mesh so it becomes active, and bake again.
Exercise
After a successful bake, the low-poly mesh looks too dark and the details seem wrong when lit. The image was created with default settings. Which setting should you check first, and why?
Show answer
Check the image's color space. A normal map is data, not color, so it must be Non-Color. With sRGB selected, Blender applies a color transform to the stored vectors and distorts the directions. Set it to Non-Color before baking, and re-bake if the image was already filled under the wrong setting.