Tutorial
Heading
Oct 6, 2023

How to bake textures in Blender

Merging the textures of an object that has different materials into one to optimize the project

Texture baking in Blender is an essential process in 3D graphics production and modeling. It allows for optimizing real-time performance, reducing model complexity, preserving visual details, improving the quality of animations and renderings, as well as ensuring compatibility with different rendering engines. Are these all advantages? Yes, they are.

This process is crucial to achieve a realistic and efficient look and feel in applications such as video games, film productions and 3D modeling projects.

In this tutorial, we will learn step by step how to merge the textures of an object that has different materials into one to optimize the project.

Let's get started!

Resources

Types of baking and texture images

Firstly, let’s differentiate two types of baking:

  • Texture baking with scene lights involves capturing direct and indirect lighting details in the resulting textures. This approach produces more realistic visual results and is ideal for projects that require high visual quality, such as final renderings. However, it tends to require more processing time due to the complexity of calculating lighting.

  • Texture baking without lights focuses on capturing static visual information, without including dynamic lighting data. This approach is highly efficient in terms of performance and resources, making it suitable for real-time applications such as video games. Although it does not provide realistic lighting, it is perfect for maintaining optimal performance in interactive situations.

On the other hand, you can bake up to three types of image textures into 3D graphics: Albedo (base colour), Roughness (roughness) and Normal (surface detail).

These textures are essential for defining the appearance and details of objects in a 3D environment. Baking them involves pre-calculating how light interacts with these textures to improve performance or consistency in rendering engines or games.

NOTE: texture baking only works in the render mode CYCLES!

Bake textures without lights

This process serves to merge all the textures of an object with different materials into one image and one UV map. This allows ua to have only one material for each object.

Join meshes

If we have separated meshes that make sense to join, we do so with "Ctrl + J". This consolidates them into one object, allowing us to assign only one material to it.

Prepare the UV map

We use a Smart UV Project to ensure all faces have a good distribution. Then, we create another UV map named "bake". In this new map, we will display the new UVs where we will bake the textures of the model.

Smart UV

Prepare the Shader Editor

To indicate Blender which UV map are we going to use for baking and which one we are baking to, follow these steps:

  • Duplicate the material: first, duplicate the material to avoid altering the original. This ensures that any changes made during the baking process do not affect the original material.
  • Add the UV map node: next, add a UV map node to the duplicated material. This node specifies which UV map Blender should use for texture mapping.
  • Connect the UV map node: connect the UV map node to the textures we need to bake.

Remember not to connect them to the Principied BSDF, as this node is used for shading and not for baking textures.

Shader Editor setup

As we have four materials in this model, we need to repeat this process four times for each material.

Baking

When we finish with the shader editor, we can start baking textures. As mentioned before, texture baking only works in the render mode CYCLES. It’s important to select the GPU Compute in the device option to speed up the process.

Render settings
Albedo bake settings

To do the baking, we need to have selected the images whee we are going to place the new texture and the object that we want to bake.

Albedo texture bake

For the roughness and normal bake, we follow the same process, but we need to change the bake settings as shown in the following images:

Roughness bake settings
Normals bake settings

It's very important to save the baked images to avoid losing them.

Save before leaving as a way of life

Material baked settings

After we've completed the texture baking process, we must set up the new material. We should adjust the color space of the roughness and normal images to be non-color.

Material baked nodes

Here is the final result!

Baked textures result

Bake textures with Alpha

This is commonly done when you need to capture not only the color and other material properties of an object but also its transparency, which is crucial for objects with areas that should be see-through or partially transparent.

Join meshes

Lamp mesh

In this process, we baked materials with fade textures. First of all, we have to join the meshes with "Ctrl + J", exactly the same as in the previous process.

Smart UV Project

We follow the same workflow that we used to bake textures: create a new UV map and make a Smart UV Project.

Lamp - Smart UV Project

Shader Editor

As in the previous case, we prepare the shader editor in the same way, but this time we only need the Albedo Image Texture.

We will add the UV map node to assign which UVs we want to bake, and we will create another node (Image Texture). Click on "New Image" and connect the UV map to that one.

Bake alpha textures in the Shader Editor

In this case, we have three materials, so we repeat this process three times. The logic is straightforward; simply repeat the process as many times as you have materials.

Baking

When we finished with the shader editor, we can start baking textures. Remember: the texture baking only works in the render mode CYCLES. We set exactly the same render settings and to bake the albedo.

To do the baking, we need to have selected the images to which we are going to apply the new texture and the object that we want to bake.

Baked lamp with albedo textures

Now we will change the "Bake Type" to "Diffuse", just to bake only the albedo of the model on the new image. Remember to uncheck the direct, indirect and influences; we only want the color one.

Then we save the baked image, et voilà!

SAVE, SAVE, SAVE

Alpha material baked settings

If the textures that we are baking have a fade effect, we need to make a special node distribution and some changes in the material settings to see this effect correctly. To do this, copy the node settings from the image below:

Nodes settings

Also, we need to change the blend mode in the "material viewport display" settings from "Opaque" to "Alpha Clip".

Material blend mode - alpha clip

In this case, when we inspect the baked textures in the material preview mode of "Viewport Shading", we observe that the transition zones appear quite harsh. However, when we view them in the cycles render, we appreciate their improved appearance.

Final result - Material preview
Final result - Render view (Cycles)

Bake textures with lights

By baking textures with light, our objective is to consolidate the materials within a single object. Additionally, we aim to bake the lighting effects that are both received by and emitted from this object.

As in the previous example, where the lamp had an emission material, we have the option to bake this effect as well.

Scene preparation

To initiate the baking process, we require light sources within the scene. In this scene, we have lamps with their own emission properties, and the bell structure that receives the light. Furthermore, we have introduced an additional light source to enhance the visibility of this effect.

Scene lights
Scene lights render view

This texture bake serves to incorporate the materials with the lighting effect baked onto the image texture, allowing us to view it in render mode without lights settings.

Smart UV Project

We follow the same workflow that we used to bake textures: creating a new UV map and performing a Smart UV Project.

Lamp - Smart UV project
Bell - Smart UV project

Shader Editor

We must specify to Blender which UV map to use for extracting the texture and which UV map to use for the baking process.

When baking lights, we only require the albedo texture. However, if the material has a fading effect, we follow a similar process, but it may involve additional nodes, especially for objects like lamps.

Bell bake lights Shader Editor

Same for the lamp materials, and we will do it as many times as materials the object has.

Baking

To begin the baking process, we need to have the images selected where we'll place the new texture, as well as the object we want to bake. In the bake settings, under bake type, we select "combined".

Bake lights settings

After selecting the "image texture" where we want to bake the combined texture with lights, click "bake". Repeat the same process for each object you have, following the steps as with the bell.

Bell baking lights

Material baked settings

If the textures we are baking have a fade effect, we need to create a special node setup and make some changes in the material settings to correctly display this effect. Pay close attention!

Materials with fade effect node set up

We will create two Image Texture nodes with their respective UV maps and add a Transparent BSDF node, which we will mix with a Mix Shader.

Next, we will connect the Alpha output of one image texture to the Fac input of the Mix Shader. Then, we will connect the Transparent BSDF and the other Image Texture to the Shader input to incorporate transparencies.

Finally, we need to change the blend mode in the Material Viewport Display settings setting from Opaque to Alpha Clip.

Material Blend Mode - Alpha clip

To view this effect without any light settings in render mode, we connect the baked image texture to the material output node. Then, we can remove the lights of the scene.

Final result

If we delete all light sources from the scene, we will observe that the objects which were baked already contain the lighting in the textures. The plane may not be visible because we have removed the lights, and its textures have not been baked with lighting information.

Frequent errors

Object instance

If we export a scene from Unity as an FBX file and import it into Blender, it's possible that if the same object is duplicated multiple times in Unity, it will be saved as an instance in Blender.

The issue here is that if we make changes to the material of one instance, the material of all instances will change as well. This can create difficulties when trying to bake textures correctly, as the material changes will be applied uniformly to all instances, potentially leading to undesired results.

Instance object error

To solve this problem, we duplicate the object with "Shift + D" and delete the previous one. Now we can change the material of each object indepently .

Object duplication

There is another way to make each instance individual. Select the instanciated objects and go to "Object → Relations → Make Single User → Object & Data".

This action will make each instance unique, allowing you to modify their materials indepently.

Conclusion

As we have seen, texture baking is a truly valuable process for achieving a realistic look in our 3D assets and environments while optimizing our projects.

We've covered texture baking for textures with lights, without lights, and even for assets with transparencies, which behave in a slightly different manner. While the process is generally similar in all cases, there are some specific details to consider.

Blender
Art
Polygonal Mind
Creative Development 3D Studio

Since 2015 creating cool experiences, games and avatars on digital platforms

Tutorial
How to import Decentraland SkyboxEditor into Unity
Tutorial
Doing a MANA transaction in a Decentraland scene
Tutorial
Canvas (2D UI) Manager in Decentraland