IDMapper

by varkenvarken in Scripts and Addons

IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel.

It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models.

It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts.

IDMapper also provides a Face Paint mode that complements Blender's vertex paint mode. It provides options to manipulate colored regions while keeping the colors of individual faces uniform.

IDMapper also offers operators to combine vertex color layers and to copy a vertex color layer from a low poly mesh to a high poly one. 

IDMapper

Creating id-maps the easy way

coverimage.png

When rendering realistic and highly detailed models, memory is often scarce, especially on GPUs where also the number of textures that can be held in memory simultaneously is often severely limited. Physically based  rendering (PBR) often uses four or more textures per material and if you have many materials on your model this adds up. Combining textures used by all the materials on a model may save memory and will reduce the number of textures. 

Texture painting programs like Substance Painter can paint anything you like into a single set of maps. However, you must be able to identify and select groups of polygons on your model that use the same material in order to paint a material at the right place. A convenient way to do this is to supply the texture painting program with an ID-map in the form  of a vertex color layer. Each color in this layer identifies faces that that should be assigned the same material.

A vertex color layer can be painted by hand in Blender, but Blender’s vertex paint tools are focused on painting freehand rather than applying colors to specific groups of vertices.

IDMapper will generate different colors for related polygons automatically. This can save you a lot of time, especially with high poly models. Which polygons are considered related can be configured with several options that you can explore interactively.

If the automatic detection of related faces is not sufficient an extra menu option is provided to set selected faces to the current vertex paint brush color, copy colors from one group of faces to another and more, including the option to copy a ID-map from a low poly mesh to a high poly one. 

In short, IDMapper aims to provide you with a versatile toolkit to create id-maps easily.

Installation

Installing IDMapper is simple:

  • Unpack the .zip file 

you probably already have done that as it contains this document (IDMapper.pdf) and the add-on itself (a Python file, idmapperyyyymmdd.py, where the yyyymmdd portion of the name is a timestamp that may vary)

  • Select File → User Preferences ... → Add-ons from the menu

  • Click ‘Install from file …’ (at the bottom of the screen) and select the idmapperyyyymmdd.py file

  • Click ‘Install from file ...’ (at the top right of the screen)

  • Check the enable check box to the left of the add-on you just installed

The add-on will now be available in Vertex Paint mode from the Paint menu as IDMapper.

Installing an updated version of IDMapper

If you want to replace a previous version of IDMapper you have to remove the old version first. to do this, go to File → User preferences … → Add-ons and either search for IDMapper or go to the ‘Paint’ category where it will be located. Click on the add-on and then on the ‘Remove’ button. after removing the old version follow the instructions above to install the new version.

Workflow

IDMapper is a tool to create an ID-map in a few easy steps. If you have both a high poly mesh and a low poly mesh available, you would normally create a basic ID-map on the low poly mesh first because then it can delimit areas to sharp corners which would be undetectable in the high poly mesh when this high poly mesh was for example created by applying the bevel modifier. In a second step you can then copy this ID-map from the low poly mesh to the high poly mesh.

A short video that shows the workflow is available on YouTube. [Opens new tab]

With your low poly mesh object selected:

  • Go to Vertex Paint mode

  • Select IDMapper from the Paint menu

  • Change options to get a good initial ID-map

  • If necessary, go to Face Paint mode, either by pressing ‘P’ on your keyboard or by selecting Face Paint from the Paint menu.
    Now you have several options to paint individual faces or change colored regions as a unit. You can leave face Paint mode by pressing ‘ESC’ or by right mouse click.

  • If you have a high poly mesh that you wish to transfer the ID-map to, select this high poly mesh

  • Go to Vertex Paint mode again

  • Select Vertex Color Copy from the Paint menu.
    Of course you can tweak this high poly ID-map in Face Paint mode as well.

  • Finally, export your model using a format that stores vertex colors too. FBX is commonly used when exporting to Substance Painter.

Options reference

the ID-mapper operator comes with many options. Most options affect the way boundaries between regions are detected while others limit the faces to which new colors will be applied.

Boundaries

Most options either determine what should be seen as a material boundary or influence the way separate but related regions are merged.

By Material id

If checked, faces will be assigned a color according to their material id. This is mutually exclusive with all other boundary options.

Display color

If selected, faces with the same material ID will be assigned the diffuse color of the corresponding material instead of a random color. Only available if By material id is checked.

Seams

If checked, edges marked as uv-seams will delimit a region.

Bevel threshold

If  a non zero value is selected, edges with a bevel weight greater than this value will delimit a region.

Crease threshold

If  a non zero value is selected, edges with a crease weight greater than this value will delimit a region.

Smooth

If checked, connected faces with a different smooth attribute will be part of different regions.

Merge

If selected IDMapper will try to merge faces that are neighbors but were assigned to a region of their own. This will for example assign faces that belong to a thin ribbon that separates larger areas but are assigned different colors to a single region of their own.

(Similarity was set to 0.94  for both images but on the right Merge was checked. Each vertical face was different enough to be assigned a different color but merge will gather strips of faces with different colors to a single region)

Match

If selected, regions that have received a different color but have the same number of faces will be assigned the same color anyway. This will enable you to assign the same id to mesh parts that are assigned a different color but are perhaps copies. An example would be nuts and bolts in a hull plate.

Closeness

Numbers higher than 0 will restrict the matching of regions with the same number of faces. The higher this number the more strict the matching is.

Restrict map to

These options limits the collection of faces which IDMapper considers when assigning colors.

Only selected

If checked, only selected faces will be assigned vertex colors according to the region they belong to. Non selected faces will be assigned the Base color. This base color can be changed with a color selector.

Only material ID

If selected, faces are assigned a color based on their assigned material. This is useful if you have assigned materials already but decide to combine everything to a single material later, after converting the material IDs to an id-map first.

Base color

This color will be assigned to any faces that are not assigned a color explicitly. IDMapper also provides a small utility in Paint → Vertex Color Merge that lets you add or multiply two vertex color layers. This way you can generate two vertex color layers with different restrictions and settings and later add (if black is chosen as a base color) or multiply (if white) the two layers (See also )

Options

Similarity

This slider lets you specify how similar faces should be to be considered part of the same region. A value of 0 will group all faces into the same region (if no other delimiters are specified) while a value of 1 will only assign neighboring faces to the same region if their face normals are identical. Selecting a value slightly lower than 1 will allow you to group polygons in slightly curved regions as well.

(From left to right a similarity of 1.0, 0.97 and 0.91 respectively)

Seed

Each seed value will produce a unique but reproducible set of colors.


Vertex Color Merge

IDMapper also provides a small utility to merge (i.e. add or multiply) two vertex color layers. This is intended as an easy way to combine different id maps that were restricted to different selections. Non selected faces will receive a base color and the default black color will let you combine two different layers by adding them.

The utility is available from the menu Paint → Vertex Color Merge and will create a new vertex color layer with the result of the operation. It has the following options:

Mode

Either Add or Multiply

Layer 1

Lets you select the first vertex color layer

Layer 2

Lets you select the second vertex color layer

Vertex Color Copy

A new option is provided in Paint → Vertex Color Copy. It allows you to copy the vertex colors from another mesh to the vertex color layer you are currently working on. This will work even if the meshes do not have the same number of vertices. In fact, its primary purpose is to copy an ID-map from a low poly mesh to a high poly copy of that same mesh. Because it is often easier and less work to create an ID-map on a low poly version first, this potentially saves quite some time.

The operator has the following options:

Source mesh

lets you select the mesh to copy the vertex colors from. It will always copy from the active vertex color layer of the selected mesh (if present)

Set Colors From Selected

A new option is provided in Paint → Set Colors From Selected. It will set the vertex color of selected faces to the color of the current brush. This might help if the automatic detection of related faces is not quite what is needed.

Face paint

in addition to automatically assigning colors to faces, IDMapper also provides some extra tools to color faces.  Vertex paint mode in Blender is mainly focussed on applying vertex colors in a painterly manner: colors are applied to vertices and blended in several ways. This is less convenient when using vertex color layers as id-maps because here we typically want every face to have a uniform color. 

Face paint mode (available in Paint → Face Paint, shortcut key ‘P’) offers a few options to make applying uniform colors simpler. 


Key

Action 

Modifier

Modified action

Left mouse

Paint

Alt

Restrict paint to region

S

Pick color



K

Fill region

Alt

Fill all regions with similar color

P

Apply color to selected faces



Numpad +-

Resize region

Alt

Restrict resize to brush color

W

Smooth region

Alt

Restrict changes to current brush color

F

Brush size



Numpad /

Normalize



Ctrl-Z

Undo




Painting colors on faces

Left clicking with the mouse will apply the current brush color to the face under the cursor. Pressing the Alt key will restrict painting to coloring just those faces that have the color of the face under the first click.  Moving the mouse wheel while painting will change the size of the brush.

Selecting the brush color

Pressing the ‘S’ key will set the brush color to the color of the face under the cursor. You can hold the ‘S’ key and move the cursor around to pick the color you like.

Note that unlike picking colors in Blender’s regular vertex paint mode, shading is not taken into account. This means that you will always pick the true face color. 

Filling a region with color

Pressing the ‘K’ key will apply the current brush color to the region with same color as the face under the cursor.

Pressing the Alt key will will apply the color to all faces with the same color as the face under the cursor.

Applying a color to faces that were selected in edit mode

Pressing the ‘P’ key will apply the current brush color to all faces that were selected in edit mode. Because you can switch to edit mode and back again using the TAB key this allows you to use convenient face selection options like selecting face loops etc.

Resizing a colored region

Pressing the ‘Numpad +’ key will increase the size of the colored region under the cursor. Pressing the Alt key will restrict the expansion to faces with the same color as the current brush (remember that you can select the brush color with the ‘S’ key).

 ‘Numpad -’ key shrinks the region. Pressing the Alt key will restrict the shrinking to faces with the same color as the current brush.

Smoothing a colored region

Pressing the ‘W’ key will smooth the colored region under the cursor. This means that faces with the matching color but with just one neighbor of the same color or with the non matching color but two or more neighbors that do match will be recolored, reducing the raggedness of the area boundary.

Pressing the Alt key will restrict this behaviour to faces that are neighbors to faces with the same color as the current brush.

Normalizing face colors

Pressing the ‘Numpad /’ key will normalize the colors of faces. This means it will randomly select the color of one of the vertices of a face and apply it to all vertices.

Undoing changes

Face paint has it own (limited) undo stack. This means that while face painting you can undo most operations with Ctrl-Z up to a certain depth.

Navigation

Rotating (Click and Drag Middlemouse) and zooming (Mousewheel up/down) works like before as does centering (Numpad .) and toggling edit mode (TAB).

What is IDMapper?

A Blender add-on to create vertex color layers that can be used as an ID-map

Why would I need an ID-map

If you have a mesh with lots of materials you can create a set of textures for each material but with lots of textures you will quickly hit the the limitations of your GPU memory. Also a lot of space in each texture will probably not be  used efficiently.

Texture painting programs like Substance Painter can of course create one texture set for the whole mesh but then you need an easy way to select which parts of a mesh should get which type of material. Providing an ID-map in the form of a vertex color layer is the simplest way to achieve this. Substance Painter will use this by default when baking textures and offers the option to add a color selection mask to each material where you can pick one or more colors from your ID-map with an eye-dropper.

Are these ID-maps only useful for Substance Painter?

No, any program that can utilize a vertex color layer for this purpose will probably work, but I tested it with Substance Painter.

Why did you provide a Face Paint mode on top of the existing vertex paint mode?

Blender's vertex paint mode applies colors to vertices, not to faces. This is very useful if you want to use vertex colors artistically, for example as input for a shader where blending colors over a face is an advantage but ID-maps mostly expect each face to have a uniform color so we need a way to paint and manipulate regions of color on a face-by-face basis. IDMapper's Face Paint mode provides exactly that.

Item Rating

This item has an average rating of 5 from 3 ratings by the community.

67%
34%
0%
0%
0%
  • 1b7fa0a291557df950bbda57a9929e32

    scigor about 2 months ago

    Bought recently but it was able to speed up right away my Blender- Substance workflow of 10 times. And I've only scratched the surface of this valuable addon!
  • C65299c72d0fa02c24af1392831cd714

    AlanShukan about 2 months ago

    Exactly what i need for my blender and substance painter workflow, i had a really pain doing mask on substance painter coz the lack of appropriate ID color mapper on blender (the are some methods that helps you get the id color but never gives you the results you want\need), now with this addon i can work straight away with no more riddles; its fast, clear and concise with the documentation, if you need a tool for substance this is a most have.
  • 8da34ce738d050bbd457d5b48b536ad7

    larry3d about 2 months ago

    I've only tried a few basics. And it works as I wish. I'm excited. Finally another workflow for me. great :)

Purchase this item to leave a review!