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 modelling. It allows 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. 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 modelling 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.
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. 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: the textures baking only works in the render mode CYCLES!
Bake Textures without lights
This process serves to merge in one image and one UV map all the textures that have one object with different materials. On this way we have only one material for each object.
If we have some separated meshes that make sense to join them, we can make it with Ctrl + J. On this way we have one object and can put only one material for it.
Prepare the UV map
We make a Smart UV Project to have all the faces with a good distribution. We create another UV's map and call it bake, then in this new map we will display the new UV's, where we will bake the textures of the model.
Prepare the Shader Editor
We need to indicate Blender from which UV map are we going to take the texture and to which one we are going to bake it.
To assign the UV map we want, we will first duplicate the material to avoid breaking the original, add the UV Map node and connect it to the textures we need to bake. Remember to not connecting them to the Principied BSDF.
As we have four materials in this model, we need to repeat this process four times.
When we finished with the Shader Editor, we can start baking textures.
As we said before, textures baking only works in the render mode CYCLES. It’s important to select the GPU Compute in the device option to agility the process.
To do the baking we need to have selected the images which we are going to put the new texture and the object that we want bake.
For the Roughness and Normal bake we follow the same process, but we need to change the Bake Settings as the following images:
It's very important to save the baked images to avoid losing them.
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.
Here is the final 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.
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 use to bake textures: create a new UV map and make a Smart UV Project.
As in the previous case, we prepare the shader editor as the same form, but we only need the Albedo Image Texture.
We will add the UV Map node just to assign which UV's we want to bake and we will create another node (Image Texture), Click on New Image and connect the UV Map to that one.
In this case we have three materials, so we do this process three times. The logic is overwhelming, just repeat the process as many times as you have materials.
When we finished with the Shader Editor, we can start baking textures. Remember: the textures 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 which we are going to put the new texture and the object that we want to bake.
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 image baked et voilá!
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:
Also we need to change in the material Viewport Display settings of blend mode from Opaque to 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.
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.
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.
This textures bake serves for can have the materials with the lights effect baked on the image texture, and we can see it in render mode without lights sets.
Smart UV project
We follow the same workflow that we used to bake textures, we create a new UV map and we make a Smart UV Project.
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.
Same for the lamp materials, and we will do it as many times as materials has the object.
To do the baking we need to have selected the images which we are going to put the new texture and the object that we want to bake. In the bake settings, in bake type we select Combined.
Then select the Image Texture where we want to bake the Combined texture with lights, and click Bake. Repeat the same process as with the bell, or with whatever object you have.
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. Look closely!
We will create two Image Texture with their respective UV Maps and add a Transparent BSDF node that we will mix with a Mix Shader.
We will connect the Alpha of the image to the Fac of the Mix Shader then we will connect the Transparent BSDF and the other Image Texture we have to the Shader in order to have transparencies.
Then we have to change in the material Viewport Display settings of blend mode from Opaque to Alpha Clip.
To see this effect without a light settings in render mode, we connect the image texture baked with the material output node. And we can delete the lights of the scene!
If we delete all light sources that we have on scene, we will see the objects baked already have the light on the textures. We don’t see the plane because we have deleted the lights and their textures have not been baked.
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.
To solve this problem we duplicate the object with Shift + D and delete the previous. Now we can change the material of each object.
There is another way to make each instance individual, select Instanciated objects and go to Object → Relations → Make Single User → Object & Data.
As we have seen, texture baking is a really interesting process to achieve a realistic look in our 3D assets and scenarios and to optimize our projects.
We have given an overview of texture baking for textures with lights, without lights, and even for assets with transparencies that behave a bit peculiar. As we have seen, the process is quite similar in all cases, but there are some details to take into account
Creative Development 3D Studio
Since 2015 creating cool experiences, games and avatars on digital platforms