Download

Blender to Substance to Unreal

I’m pretty new to modeling/texturing. After I make a model I assign materials to certain faces and make the UV seams, I import the model to substance painter where I create/edit and apply the textures. My question is when I import to Unreal engine I end up with 4-6 different materials for my model. Is there a way to reduce number down to one or 2 while keeping all the same materials or am I doing something wrong, also is it bad to have this many materials for lets say one weapon or is it normal? Will multiple materials make the game harder to run?

Hi Benz1n3,

I found the same problem myself. Yes, it is possible to reduce the number down to 1 or 2 using an id map. Though there are a lot of good video tutorials out there, I can’t think of one that covers the whole process in full detail in one go, so here is a long answer. Note: in Blender I am using “Cycles render” not “Blender render” (the setting for this is at the top of Blender as you probably know.)

The problem I believe you’re having basically starts in Blender. If you assign materials to different parts of your mesh in Blender, then export your model as an fbx, then import the fbx into Substance Painter, everything appears to go well. The different materials appear listed in the “TextureSet List” window in Substance, making it easy to select parts of your mesh and paint the model. However, when you come to export textures from Substance Painter, the program will export a separate set of textures for every material. Currently (and frustratingly), I don’t believe there is a way to tell Substance Painter to simply combine all of the materials during export. The end result is that you need as many materials in Unreal as you originally assigned in Blender.

The way round this is to use an “id map”. Here is an example to demonstrate the procedure. I will use a cube, as it is easy to see what is going on. I want the cube to have 2 materials, one on the top and one everywhere else.

Step 1: Set up the model.
I will use a simple cube as it is easy to see what is going on. Don’t assign materials to the faces. Assign just one material to the whole object. Then add seams and UV unwrap. Now export the model as an fbx. If you open this in Substance Painter you will see just a single material in the “TextureSet List” window.

Unwrapped cube.jpg

Substance_singleMaterial_a.jpg

Step 2: Create an id mask in Blender.
Now that the fbx export is done it is time to assign different materials to different faces in Blender. For each material, use just a single distinct color. I will make the top of the cube red, and the rest of the cube blue.

AssignMaterials_a.jpg

In the “UV/Image editor” window in Blender, click on the “new” button at the bottom and create a new image. Choose a resolution and give it a name. I’ve chosen “id_mask”. For the moment this image is completely black.

Prepare mask_a.jpg

Now for the hard-to-remember fiddly bit. Open the node editor. For each material in turn, add an “image texture” node into the material’s node tree and select your newly created image. Note: the nodes don’t have to be connected to anything, they just have to be there somewhere. Here is the result for the material on the top of my cube.

Node_a.jpg

Go to the Render tab and scroll down to Bake. There are several settings here. I choose “Diffuse” for the bake type and turn off Direct and Indirect (we aren’t interested in lighting at the moment). I then lower the margin to something like 4 px as 16 pixels seems a lot. Then hit bake. Voila, one id mask! In this mask, every material corresponds to a different color. In the UV/image editor, click on “image” and then “save as image”. (When baking the id map, the colours on the map will bleed outside the borders of the mesh on the UV map. I think a bit of color bleed is useful to guarantee that points on the edge of mesh are definitely included in the color corresponding to the correct material. Margin controls how much bleed there is.)

Id_masking_a.jpg

Step 3: Use the id mask in Substance Painter.
Open Substance Painter if you haven’t already, and import your model. Bake any textures you want to bake inside Substance Painter as you normal would. Then, go to “File” at the top and “Import image in project”. Import your new id mask. In the TextureSet settings window, click on select id mask and choose the id mask from Blender.

To use the id map, select a layer you wish to mask and create a new mask by clicking on the filled circle in the Layers window. Choose “Add mask with color selection.” In the properties panel, click on the color selection eye-dropper and choose the appropriate material. In the example below, I have selected the red color from the id mask, so the masked “Cap” material is on the top of the cube and “Caiman back scales” is everywhere else.

Subst_texutring_a.jpg

Step 4: Export textures
Go to “file” and “export textures”. If you click on export, you will find that now only one texture set is produced - meaning only one material will be needed in Unreal!

Does this answer your main question?

Hey there, Yes that is quite the tut, thank you very much that was very helpful. I’m sorry for the delayed response for some reason the unreal forum displayed that I never created this thread??? Strange. Anyways this worked perfectly thank you very much.
I just started modeling/texturing 3 months ago and I’ve been slamming my head against the wall, good know there’s a place to come to with some decent replies.