Substance Painter and Blender: masks with Color Selection and ID Mask from Vertex Colors
In this tutorial, created with the 2019 version of Substance Painter (but also valid in other versions, earlier and later), we will see how to recover the ID Colors of a model, where present, to use them to quickly create layer masks.
ID Colors are, as the name suggests, colors associated with vertices or faces of a 3D model; it is not the colors that are displayed during the rendering phase, but additional information stored in the "Vertex Colors" information channel of the object: the RGB values of a color are actually numbers, so they can be used as parameters for filters and other tools.
Substance Painter (and other software and tools as well) are able to retrieve this information and use it for various purposes; for example, in Substance we can create layer masks by selecting in one go all the geometries that have the same Vertex Color.
When we add a layer mask to a Material in a project, among the effects available for the mask we also have the "Color Selection" item; however, once an element of this type has been added, it may happen to find the word "ID not found", while the "Pick Color" tool does not detect any color in the geometry ...
In fact, during the introduction of this tutorial I specified "where present" because these colors are supplied, when exporting a model, to the information channel "Vertex Colors" of the object, but this operation is not always carried out, so sometimes they are absent ... so let's move in Blender 3D (version 2.92, in this particular case) to see how to provide Vertex Colors to parts of objects before exporting them for Substance Painter.
In the example I am using, we want to identify at least 4 areas: the cable, the two glossy plastic containers, the metal part of the connectors and the opaque plastic separators.
Let's take a look at the UV unstitching of the object: we note that the various parts have actually been separated (through the "seams"), so they are arranged on different "UV islands", but these are not easily identifiable (and indeed, in this particular model the "UV islands" are few, but you will certainly see much more complex UV unstitching); for this reason, we decide to assign Vertex Colors.
In the 3D view, we switch to Vertex Colors mode and, above all, we activate the face selection mode, in the 3D view header, then we deselect everything (with ALT + A, or Select - None in the view header), so that we can start selecting the various parts and assigning them colors.
The selections can be made with the various tools made available by Blender; since, in this example, the various parts have been unstitched and arranged on different UV islands, I can easily select them by pressing the L key (for "Linked": linked parts) while the mouse cursor is on one of them.
I then proceed by selecting, to begin with, the parts of the glossy plastic connectors, which will change color (and will no longer show the edges of the geometry) as I select them.
To assign a Vertex Color to these parts, I first select a color in the Vertex Paint Properties panel (which can be closed or opened with the shortcut N), then press SHIFT + K (or choose Paint - "Set Vertex Color" , in the header of the 3D window).
To move on to the next group, we deselect everything with ALT + A, then repeat the operations: selection of the various islands that interest us, choice of color, then "Set Vertex Color" and so on for all the other groups (four in our case).
When choosing colors, I suggest you choose different colors, if possible, in order to make the areas stand out at a glance, both in Blender (to quickly identify missing or incorrectly assigned parts) and in Substance Painter (in order not to be mistaken, in the selection phase, with shades of color too similar to each other).
Once this work is finished, all that remains is to export the 3D model in a format that supports Vertex Color information, such as the FBX format, and then return to Substance Painter ...
Once the model file has been imported into Substance Painter, click on "Bake Mesh Maps" in the "Texture Set Settings" tab.
In the Baking window, we deselect the items that do not interest us and leave "ID" selected, of course, but before clicking on the Bake button we open the tab of this channel, to make sure that the "Color Source" (source of the colors to be use to generate the map) is set to "Vertex Color": Substance will then access this additional information of the model to create the ID map.
Click on Bake and wait for the map to be processed, which we will find both in the ID section of "Texture Set Settings" and in the "Properties - Color Selection" tabs of the various "Color Selection" tools created for the project masks.
At this point, by clicking on "Pick Color" we will be able to select an ID Color from the project and the mask will be generated on the fly, associating that material to all the areas of the model provided with that Vertex Color.
The operation can then be repeated for the other materials, IF we deem it appropriate: this, in fact, is a tool that can be useful in certain circumstances, but obviously, depending on the case, a selection with Brush, Polygon, UV Chunk, etc, would be easier; ID Mask is just another tool!
In summary: if a model is provided with Vertex Colors, it is possible to obtain this information in Substance Painter by performing a Bake of the ID map (taking care to specify "Vertex Colors" as the source of the information we want to recover from the model), after which it will be possible to add a "Color Selection" component to the masks of the various materials and, using the "Pick Color" tool, generate a mask that will include only the geometries provided with the selected Vertex Color.
That's all for this videotutorial! See you soon!