Color Region Mask
Isolate a color family without a paint brush
- image
- source_mask
- mask
- image
- mask
- region_info
"Make a mask of just the red bits" is one of those jobs you end up hand-painting more often than you'd like. x1ColorRegionMask builds a grayscale mask for a selected color family - red, green, blue, any of the presets, or a custom hue center - from a texture or painted map, in seconds. It's from MKRShift Nodes' Surface/Maps branch, and it's aimed at material work: splitting a source into zones before you run roughness, metalness, wear, or packing passes on each zone separately.
The pack is young (no impressions yet, nothing on Reddit when I checked), so treat it as fresh but clean code. What it does, it does deterministically on the CPU - no models.
How it works
The mechanism is standard hue-based selection with one smart addition. It computes the hue of each pixel, selects a region defined by color_preset (or custom + hue_center), and opens it up with hue_width. Then comes the part that keeps the mask usable: it suppresses low-saturation and near-black pixels via saturation_min and value_min, so neutral shading and dark shadows don't flood the result. That's the difference between a hue mask that looks like a cloud and one that actually isolates the painted red zone. softness feathers the hue falloff, contrast punches the result, blur_radius cleans it up, and invert_values flips it.
Outputs: image (grayscale mask as an image), mask (the scalar mask - the thing you wire onward), and region_info (settings log). The optional source_mask gates the source sampling, and mask / mask_feather limit where the output is emitted.
Inputs that matter
color_preset- start with a family, switch tocustom+hue_centerwhen the preset is off by a few degreeshue_width- narrower isolates tighter,softnessadds the gentle edge when narrow is too harshsaturation_min- the anti-flood control; raise it when the mask is covering too much neutral area
The workflow it feeds
The author's own note is the best pointer: reach for this when a source is too messy for x1IDMapQuantize or x1IDMaskExtract. It's for splitting material zones - "the red part gets rough metalness, the blue part gets wear." x1ScalarMapAdjust is the designated follow-up when you want a harder or softer final mask.
Installing
ComfyUI Manager → search MKRShift Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
Restart ComfyUI. No models, no new dependencies.
Where people get burned
- Hue wraps around. Red lives at both 0° and 360°, so custom hue selection around red needs care - if your custom center is at the wrap point, the mask can grab the wrong half of the wheel. The presets handle this correctly; be careful hand-dialing near the wrap.
- Skipping
saturation_min. On flat, desaturated textures a hue-only mask is mostly noise; this node's flood control exists precisely because that failure is common. maskoutput vs.maskinput - the output is the derived scalar, the input is the emission gate. Same pack-wide convention.
For material zone splits, wear placement, or "this specific color becomes the roughness driver," it's the fast, honest way to get there.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| color_preset | COMBO | 8 options: red, orange, yellow, green, cyan, blue, +2 | |
| hue_center | FLOAT | 0.0000–1 | — |
| hue_width | FLOAT | 0.0800.001–0.5 | — |
| saturation_min | FLOAT | 0.180–1 | — |
| value_min | FLOAT | 0.040–1 | — |
| softness | FLOAT | 0.0500–0.5 | — |
| contrast | FLOAT | 1.150.1–4 | — |
| blur_radius | FLOAT | 0.00–128 | — |
| invert_values | BOOLEAN | false | — |
| mask_feather | FLOAT | 8.00–256 | — |
| invert_mask | BOOLEAN | false | — |
| source_maskopt | MASK | — | |
| maskopt | MASK | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| region_info | STRING | — |