Sub topic 6
Creating the bake target image and Image Texture node
Cycles does not write a bake result to a file. It writes pixels into the image that is loaded in the active Image Texture node of the low-poly material. If that node is missing, empty, or not active, the bake fails or goes to the wrong place. This chapter covers how to set that target up and the mistakes that cause most failed first bakes.
This chapter assumes you can open the Shader Editor and the UV Editor. It also assumes the low-poly mesh already has a clean, non-overlapping UV layout, covered in the previous chapter. Color space is only introduced here and gets its own chapter.
How Cycles chooses the bake target
When you start a bake, Cycles looks at the material on the active object (the low-poly mesh). In each material slot that the mesh uses, it looks for the active Image Texture node. It writes the baked pixels into that node's image, using the object's active UV map to decide which pixel receives which surface point.
Three consequences follow:
- Every material slot on the low-poly mesh needs an active Image Texture node with an image. A slot without one makes the bake fail with an error about a missing image target.
- The node does not have to be connected to anything. Cycles reads it only to find the target image.
- The UV map used is the active one on the low-poly object. If the mesh has several UV maps, check which one is active before baking.
Creating the image
You can create the image in the UI or in Python. Both give the same result.
In the interface
- Select the low-poly object and open the Shader Editor.
- Make sure the object has a material. If the Shader Editor shows a New button, click it.
- Press Shift+A and add Texture > Image Texture.
- In the node, click New.
- Set a name such as
Asset_normal, a width and height such as 2048 by 2048, and turn off Alpha unless you need it. - Leave 32-bit Float off for a normal or AO map that you will save as PNG. Turn it on only if you plan to save as EXR for extra precision.
- Click the node's header so it is highlighted. This makes it the active node.
The Color swatch in the New Image dialog sets the starting fill. For a normal map, a neutral fill is a flat normal, which is RGB (0.5, 0.5, 1.0). Pixels the bake never touches stay at this fill, so a flat value avoids visible shifts in areas without baked detail. The default black fill is fine for AO if you are happy with unbaked areas being black, but you will usually fill the margin anyway (see the margin chapter).
In Python
import bpy
low = bpy.data.objects["Asset_low"]
mat = low.active_material
mat.use_nodes = True
img = bpy.data.images.new("Asset_normal", width=2048, height=2048, alpha=False)
img.colorspace_settings.name = 'Non-Color'
nodes = mat.node_tree.nodes
tex = nodes.new('ShaderNodeTexImage')
tex.image = img
nodes.active = texThe line nodes.active = tex does the same job as clicking the node in the editor. Without it, Cycles may pick another Image Texture node already in the material, or none.
Why the node must be active, not just selected
In the Shader Editor a node can be selected without being active. Active is the node with the brighter outline, the one you clicked last. When a material contains several Image Texture nodes, such as a base color texture you already painted, Cycles bakes into whichever one is active. This is how people overwrite an existing texture by accident.
A safe habit:
- Keep the bake target node separate from your shading nodes. Place it off to one side, unconnected, and label it (for example "BAKE TARGET").
- Click it right before every bake.
- After the bake, check the image in the UV Editor to confirm it received the result.
Naming, size, and one image per map
Use one image per baked map type: Asset_normal, Asset_ao, and so on. Each bake pass overwrites the image in the active node, so reusing the same image for both normal and AO destroys the first result.
For resolution, match the texel density and size you chose during UV layout. Common sizes are 1024, 2048, and 4096. Larger images cost more VRAM, and a bake takes time roughly proportional to the pixel count times the sample count. A good workflow is to test at 512 or 1024 with low samples, confirm the setup is correct, and only then raise the resolution for the final bake.
| Setting | Test bake | Final bake |
|---|---|---|
| Image size | 512 or 1024 | 2048 or 4096 |
| Cycles samples | 1 to 16 | 64 or more for AO |
| Float image | Off | On only if saving EXR |
Normal maps converge quickly because they sample a single surface direction per pixel. AO is noisy at low sample counts and benefits most from a higher final sample count.
Setting the color space
Every pixel in a normal map is a direction, not a color. Blender must not apply its sRGB-to-linear conversion when it reads or writes those values, or the direction is distorted. Set the image's color space to Non-Color in the Image Texture node's color space dropdown, or in Python with img.colorspace_settings.name = 'Non-Color'.
Set it before you bake, not after. For a generated image, the setting affects how the baked values are interpreted when saved and reloaded. The next chapter explains this in detail.
Saving the image
A baked image created with New lives only in the current Blend session until you save it. It shows an asterisk or a "packed" state in the Image Editor menu. If you close Blender without saving, the bake is lost.
To save it from the UI, open the UV Editor or Image Editor, choose Image > Save As, and pick a format. PNG is fine for 8-bit maps, and OpenEXR is better when you need float precision. In Python:
img.filepath_raw = "//Asset_normal.png"
img.file_format = 'PNG'
img.save()The // prefix means a path relative to the .blend file, so the .blend file must be saved first. If you try to save a relative path from an unsaved file, Blender cannot resolve it.
Common failures
| Symptom | Likely cause | Fix |
|---|---|---|
| Error that no image is found to bake to | The material has no active Image Texture node with an image | Add the node, assign an image, click the node to make it active |
| Bake finishes but the image stays blank | A different Image Texture node was active | Click the intended target node, then bake again |
| Bake overwrote a painted texture | The painted texture's node was active | Undo, use a separate target node and image |
| Error mentions a material slot | One slot of the low-poly mesh has no target node | Add a target node to every slot, or remove empty slots |
| Result lands in the wrong place on the image | Wrong UV map is active | Make the intended UV map active on the low-poly mesh |
Exercise
You added a new Image Texture node to the low-poly material and assigned a 2048 by 2048 image to it. The material already has another Image Texture node holding a painted albedo texture. After baking, the albedo looks changed and the new image is blank. What went wrong, and what two steps prevent it?
Show answer
The albedo node was the active node, so Cycles baked into the albedo image instead of the new one. To prevent it, click the new target node so it becomes the active node before baking, and keep the target node separate and labeled so it is not confused with shading nodes. Creating a fresh image per bake and saving results under new file names also protects existing textures.
Exercise
Why should the normal map and the AO map each use their own image rather than reusing one image for both passes?
Show answer
Each bake writes into the image of the active node and overwrites its previous contents. Reusing one image means the second bake destroys the first result. Separate images such as Assetnormal and Assetao keep both maps.