This is called an "Atlas" texture. Indeed this one will include all the textures + UVmaps that you could have added.
I will only develop here the case of a diffuse texture, simply because the effects of shine, reflection, blurring and others will be made from the engine to which these textures will be exported. That said, it is strongly recommended to make a normal map using the same method.
To make this atlas, you will need two things:
- UVmaps of each part of your model with a different texture.
- The image textures you use.
It is assumed here that all your materials are already created.
A little reminder to make an UVmap:
- Share your viewport in half if not already done. In one of the views, choose the "UV/Image Editor" view.
- In the UV editor, create a new UVmap ("+" button), name it for example "texture01.uvmap".
- Return to the 3D view, switch to edit mode and select the entire mesh.
- Hit « U ».
- Select « Smart UV Project », leave the other options by default then validate.
- First select your material from the appropriate tab.
- Return to the "UV Editor" view and split this viewport in two. In one of the two, choose the "Node Editor" view.
- 1 Texture image node (Shift+A→ Textures → Image Texture.).
- 1 Diffuse BSDF node (Shift+A→ Shader→ Diffuse BSDF).
- The Material Output node.
Using shaders instead of images for textures could give undesired results and I discourage the use of them for this tutorial.
We could perfectly replace all of this by a simple diffuse BSDF with the color of our choice.
- In the Node Editor view, Add another Image Texture node.
- Into this new node, select your UVmap, in our example: texture01.uvmap
In the current state of the operation, you could add a diffuse BSDF node to this new image texture and link it to the output of your material, allowing you to paint the texture directly onto the mesh.
- Now, go to the "Render" tab and scroll down to "Bake".
- Select "Diffuse", « Color », and deselect "Direct » and "Indirect".
Leave the default margin value (16px). This margin will be a "security" distance that will overflow the color on the uvmap to not see the seams.
- Click on "Bake" (see the progress bar at the top of the Blender interface).
- Return to the UV editor and save the new image.
- In the Node Editor add another Image Texture node.
- In this one, load the new image obtained.
- Connect this node to your material output via a Diffuse BSDF.
Building the Atlas
You must first enable the "UV Texture Atlas" plugin in your user preferences:
Once enabled and your user preferences saved:
- Create a new empty image in the UV editor.
- In the 3D view (or in the object tree), select the concerned meshes.
- Select the "Render" tab and scroll to "Texture Atlas".
- Create a new atlas with the "+" button. Leave the default name.
- Select "No Unwrap", as you already have an UVmap.
- Click on "StartManualUnwrap".
A temporary object will be created and automatically selected.
- Still in the 3D view, switch to Edit mode for this new object.
- Select the entire mesh.
- In the UV editor, select UV→ Average Island Scale.
- Press Ctrl+P for automatic reorganization.
You may have to reorganize your different parts according to the complexity of the uvmap. Indeed during the baking operation, some colours could overflow on others.
Now let's go to the materials tab and create a new one relative to this new object, you can remove the others from the list.
- Return to the "Render" tab and scroll down to "Bake".
- Select the "Selected to Active" check box.
- Select all your original objects by making sure you select the new object last.
- In the Node Editor, add a new Image Texture node in which you will load the new UVmap.
- Click on “Bake”.
- Once the baking done, and still in the "Render" tab, go to Texture Atlas then click on "FinishManualUnwrap".
- Save the new image.
In some cases, you may need to do some quick touch-ups with The GIMP (or any other image editor). But nothing too bad.