Scalar Map Adjust
The boring node that keeps your material maps honest
- image
- source_mask
- mask
- image
- mask
- scalar_map_info
Every material pipeline needs the same unglamorous fix sooner or later: a map that comes out with the wrong range, the wrong contrast, or the wrong polarity, and you need it clean before it can feed the next stage. x1ScalarMapAdjust is that fix, generalized. It takes any grayscale scalar - a channel, alpha, value, saturation, a detail pass, or an existing mask - and normalizes, remaps, inverts, and softens it into a clean working map. Boring, and exactly what production runs on.
It's the glue node of MKRShift Nodes' Surface/Maps family. The author's docs frame it precisely: it's the bridge between extraction nodes like x1CavityMap and the packing/preview nodes like x1PBRPack and x1PreviewMaterial. When the pack's own docs recommend shaping clearcoat_roughness, transmission, or thickness inputs before preview - that's this node's job.
How it works
It's the family's normalization vocabulary applied to a source you pick:
source_mode-luma,inverse_luma, individual RGB channels,alpha,max_rgb,value,saturation,detail, ormask(viasource_mask)normalize_mode-auto_percentile,manual_range, orauto_rangevalue_min/value_max,percentile_low/percentile_high- the range controlsgamma,contrast,blur_radius- shape the scalar after normalizationinvert_values- flip polarity (the classic "my clearcoat_roughness is backwards" fix)mask_feather/invert_mask- finalize the output mask
Unlike the settings-JSON nodes in this family, these are proper widgets - this is one of the friendlier nodes to tweak live.
Inputs and outputs
Required: image, source_mode, normalize_mode, the range controls, gamma, contrast, blur_radius, invert_values, mask_feather, invert_mask. Optional: source_mask and mask.
image- the adjusted grayscale mapmask- the normalized scalar as a MASKscalar_map_info- summary string of the resolved settings and normalization range
Why it earns its keep
Two real workflows. First, range rescue: every map extraction node can emit out-of-range or contrast-flattened results, and this is where you fix them before they poison a pack. Second, slot preparation: the pack's x1PreviewMaterial takes clearcoat_roughness, transmission, and thickness inputs that want clean 0-1 scalars, and this node is the sanctioned way to prepare them. It's also the node you reach for when a source_mode on a map node gives you the wrong signal - extract here with detail, shape it, feed it onward.
The scalar_map_info string is worth checking: it reports the real normalization range, which is exactly what you need when a map "looks fine but renders wrong."
Installing it
ComfyUI Manager (search "MKRShift Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
Restart, no requirements, no model downloads, no ffmpeg. It's a big pack for a utility node, but if you use the Surface branch at all, this is the node that keeps the other maps usable - it earns its place.
Where people get burned
Forgetting it exists and hand-wiring corrections with contrast nodes that don't share the family's semantics. Also: inverse_luma is a source mode, not an "invert" button - if your map reads backwards, first check whether you wanted inverse_luma as the source rather than invert_values on top of luma, since stacking both inverts twice and silently cancels out.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| source_mode | COMBO | 11 options: luma, inverse_luma, red, green, blue, alpha, +5 | |
| normalize_mode | COMBO | 3 options: auto_percentile, manual_range, auto_range | |
| value_min | FLOAT | 0.0000–1 | — |
| value_max | FLOAT | 1.0000–1 | — |
| percentile_low | FLOAT | 2.00–100 | — |
| percentile_high | FLOAT | 98.00–100 | — |
| detail_radius | FLOAT | 2.00.1–64 | — |
| gamma | FLOAT | 1.000.1–4 | — |
| contrast | FLOAT | 1.000.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 | — |
| scalar_map_info | STRING | — |