Color to Mask


Description

The Color to Mask node groups similar colors in the input texture into regions. For each region, it creates a grayscale mask output, containing a representation of that region.

You can control which colors the node treats as similar via the Threshold property. Higher values make the node more likely to group similar colors into one region, and lesser values make color identification more precise.

The node can identify and output up to a total of 10 color regions and their corresponding masks. It also outputs an ID Map, containing a representation of all regions in one texture. In the ID Map, each region is represented with a different solid color as per the region’s properties.

Usage

To use Color to Mask, follow these steps:

  1. Create a new Color to Mask node on the Node Graph. It can be found under the Paint category in the Node Library.
  2. Connect the texture where you want to identify color regions into the Input port on the node.
  3. Set the Max Output Dimensions property to the desired output resolution.
  4. Adjust the tolerance of the color grouping using the Threshold property.
  5. View the result by bringing the Color to Mask  node into the 2D and/or 3D Viewports.
  6. Access the individual region masks via the Region (1-10) outputs in the node.

Node Reference


Node categoryPaint
Node execution styleAutomatic

Ports

Input NameInput TypeDescription
InputBitmap

The texture input in which the node identifies color regions and transforms them into masks.

Output NameOutput TypeDescription

ID Map

Bitmap

Contains the texture with all of the regions that the node identifies, each of them represented with a solid color as per that region’s properties.

Region (1-10)

Bitmap (Mask)

Contains the grayscale mask for the identified region within the input texture. There can be up to 10 region outputs in this node, depending on how many regions the node identifies.

Properties

Property/SettingDescription

Max Output Dimensions

Set the output resolution of this node, in pixels. This determines the resolution of both the ID Map and the region masks. Note that this will not upscale the output if the chosen resolution is higher than the input resolution.

Threshold

Set the tolerance of the color grouping algorithm, as a value between 0 and 100. At higher values, the node is more likely to group similar colors into one region. At lower values, similar colors are more likely to form new regions instead.

Opacity

Set the opacity of the ID Map overlay in the 2D Viewport, as a value between 0 and 100 percent.

Per-region settings

These properties are specific to each color region.

The number of per-region settings available varies, based on how many regions the node identifies in the input.

Property/Setting

Description

Region Name

Set the output name of the region.

Feathering

Set the amount of feathering applied to the region mask, as a value between 0 and 50 pixels. This uniformly expands the edges of the mask, blurring them in the process.