Nodes/MKRShift_Nodes/Scalar Map Adjust
ComfyUI Node

Scalar Map Adjust

The boring node that keeps your material maps honest

By criskb·Created 7 months ago·Updated 5 months ago· 0
Scalar Map Adjust
  • image
  • source_mask
  • mask
  • image
  • mask
  • scalar_map_info
source_mode
normalize_mode
value_min0.000
value_max1.000
percentile_low2.0
percentile_high98.0
detail_radius2.0
gamma1.00
contrast1.00
blur_radius0.0
invert_valuesfalse
mask_feather8.0
invert_maskfalse

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, or mask (via source_mask)
  • normalize_mode - auto_percentile, manual_range, or auto_range
  • value_min / value_max, percentile_low / percentile_high - the range controls
  • gamma, contrast, blur_radius - shape the scalar after normalization
  • invert_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 map
  • mask - the normalized scalar as a MASK
  • scalar_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.

CategoryMKRShift Nodes/Surface/Maps

Inputs (16)

NameTypeDefaultDescription
imageIMAGE
source_modeCOMBO11 options: luma, inverse_luma, red, green, blue, alpha, +5
normalize_modeCOMBO3 options: auto_percentile, manual_range, auto_range
value_minFLOAT0.0000–1
value_maxFLOAT1.0000–1
percentile_lowFLOAT2.00–100
percentile_highFLOAT98.00–100
detail_radiusFLOAT2.00.1–64
gammaFLOAT1.000.1–4
contrastFLOAT1.000.1–4
blur_radiusFLOAT0.00–128
invert_valuesBOOLEANfalse
mask_featherFLOAT8.00–256
invert_maskBOOLEANfalse
source_maskoptMASK
maskoptMASK

Outputs (3)

NameTypeDescription
imageIMAGE
maskMASK
scalar_map_infoSTRING