4
$\begingroup$

I created a low poly scooter and applied different materials to different parts of the mesh for obvious reasons (check the photo below).

enter image description here

There are two things I need to do :

1) I want to put all the color from my multiple materials onto a single material or onto the UV map (whichever is easier) so I can export a single diffuse texture.

2) I want to create a specular map based on my materials so that the metal parts look shiny and the other parts don't.

What is the best or easiest way to do it?

$\endgroup$
3
$\begingroup$

Shaders can be made to use several different types of masks but the types of passes available for baking are currently limited but this can be overcome with a bit of extra setup.

Cycles works well for doing this but the masks are not necessarily all going to translate over to other rendering engines perfectly calibrated. Some fine-tuning is likely to be necessary whether you use Cycles or Blender Internal for creating masks for other renderers since everyone uses slightly different(or very different) math for their shaders.

The following is an example of how you can bake an Exponent mask(Roughness) using Cycles.

This first image shows 1 object that has 2 materials. Each material is a Glossy node and they both have different values for Roughness.

enter image description here

Now you can bake these values to a texture by using Emission Nodes with the strength value set to the same Roughness used for the Glossy shaders. This will bake a black and white mask that has the values for Roughness baked in.

enter image description here

The sphere on the left is using only one material now instead of 2 and uses the baked texture to control the roughness for both surfaces. The sphere on the right is still using 2 different shaders to control both surfaces.

Here is a diagram that attempts to show the part of the shader formula which is making use of the Exponent mask that was just baked.

enter image description here

You can also bake what people are calling a 'metalness' mask using the same technique shown above using Emission shaders for the exponent mask values.

Here's a turntable animation the shows several different masks in use to control only one GLSL shader for the armor. Notice how the specular bright-spot's radius changes as the light plays across the bronze color to the plastic parts and then across the Blender Logo. It's a specular exponent mask that controls the highlight's radius. The shader also uses a masks to control the different paths the GLSL shader code will take since it's programmed for more than one type of effect.(sort of like a mini uber-shader)

https://vimeo.com/109779858


Extra reading: If you have a look at the following diagram for Valves DOTA2 modding documentation, you will see that there are several types of masks used to control various aspects of their shaders and since many of them are greyscale, 4 different masks can be stacked into just 1 texture.

enter image description here Here's the Title and link for the Valve PDF
DOTA 2 - Character Shader Masks Guide

http://media.steampowered.com/apps/dota2/workshop/Dota2ShaderMaskGuide.pdf

$\endgroup$
2
$\begingroup$

First, in order to create the unified UV-Map, you need to combine all the separate objects into a single mesh object by selecting them all and then pressing "CTRL + J" on your keyboard to join them.

They will still have individual materials assigned and, but now you can create a UV map for the whole object. If you want to tweak the material settings later on you can go into edit mode and open the materials tab in the properties panel. If you want to separate the objects again, press "P" in edit mode and separate the objects "By loose parts".

Now you select the parts of the mesh where you want to change the material (when you press "L" you can select all the faces that are connected to your selection, useful for selecting previously unjoined parts of the mesh) and in the materials tab you select a material from the list. To assign the material just press "Assign" underneath the materials list.


Now to create the diffuse map you need to "bake" the diffuse color into a texture. I will try to explain the process using the Cycles engine (because your render looks like that's what you are using), but I'll try to keep it short. If you need further details, either comment on this answer or search for yourself (just look up "cycles baking").

In order to bake the texture you have to have the UV-unwrapped model with all the materials assigned. When that that is all prepared, you need to go into the node editor and make some changes to your materials:

For each material you need to add a new Image Texture node and connect a UV-Map node to it. This Image Texture will be used exclusively for baking. You have to assign a texture to the Image Texture node(this will be your baked map). To assign the texture you have to create it first:

Go into the UV/Image Editor and click new (or the "plus" symbol next to the texture selection menu). A popup will appear where you can give your texture a name and set the resolution. When you have created the texture you go back to the node editor and assign the newly created texture to each of your material's Image Texture nodes.


Before you go on to baking, make sure that, in each material, you have selected your Texture-node containing the bake-map.

Finally, to bake the diffuse colors, you go to the render tab in the properties panel and scroll all the way down until you see the bake menu. There you can set the type of data to bake (go ahead and change it to "Diffuse color") and, among others, a Margin setting. If you are having problems with jagged edges on you textured model, or if your different UVs are very close to each other so that the baked texture overlaps in some places, you can turn this value up or down.

When you have made all the changes you want, make sure to check again, that the right texture is selected in the materials (selecting a different texture will overwrite it and possibly destroy data) and you can press the "Bake" button. Depending on the complexity of the object and the resolution of the texture, baking might take a while, but when it's finished, you should have a full diffuse map for your object.

To bake the specularity map you need to create a new texture and change all the Image Texture nodes to bake onto that texture. In the baking options simply change the data type to "Glossy Color" and bake again.

$\endgroup$
  • $\begingroup$ Thank you, I knew the seperate texture process but hoped there would be an easier way, as for the specular map I had no idea, thank you very much! $\endgroup$ – Klint Mane Oct 30 '14 at 20:04
  • $\begingroup$ You mean having one texture in each material? I hope to find an easier way to do that too.. $\endgroup$ – therufuser Oct 30 '14 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.