Nodes/ComfyUI Field/Field Remap
ComfyUI Node

Field Remap

Levels and Curves, for Masks

By jeremieLouvaert·Created 3 months ago·Updated 24 days ago· 1
Field Remap
  • field
  • mask
◄invertfalse►
◄normalizefalse►
◄in_low0.00►
◄in_high1.00►
◄gamma1.00►
◄contrast0.00►
◄pivot0.50►
◄out_low0.00►
◄out_high1.00►

It's a levels adjustment, and it works on anything

Field Remap does to a mask what a levels-and-curves panel does to a photo: stretch the input range, bend the midtones, clamp the output. It doesn't generate anything and it doesn't know or care where the mask came from - Perlin noise, an edge map, a distance field, a hand-painted alpha, ComfyUI's own segmentation output. There's nothing in the node that's field-specific except the units convention.

That generality is the point. Every other reshaping node in this pack assumes something about its input - Field Distance needs a binarisable mask, Field Threshold wants a distribution, Field Morphology wants geometry. Field Remap assumes nothing. It's the node you reach for when the mask is roughly right and needs the black point raised or the ramp softened.

A fixed pipeline, not a mode dropdown

The node applies stages in one order, always:

invert -> normalize -> input window -> gamma -> S-curve -> output window -> clamp

That's a design decision worth noticing: there's no "which operation do you want" selector to get wrong. The cost is that the order is fixed and you have to reason in that order - but it means what the node does is inspectable rather than emergent from a mode.

Every stage skips itself entirely at its identity value. invert=False, normalize=False, in_low=0/in_high=1, gamma=1, contrast=0, out_low=0/out_high=1 - all at once is a bitwise no-op. If you wire it in and nothing changes, that's not a bug, that's the defaults.

The one stage with real subtlety is normalize. It re-applies the probability integral transform to the actual incoming pixels, independently per batch item. The generators can probe a continuous field to work out the transform; a filter only has the pixels it was given, so normalize does it empirically. Turn it on when you want the mask to use its full range regardless of how dark or compressed it arrived.

The widgets

  • field - the MASK to reshape.
  • invert, normalize - booleans, both off by default.
  • in_low / in_high - the input window. Everything below in_low goes to 0, above in_high to 1, and the middle is stretched. This is your black point and white point.
  • gamma - the midtone bend. The tooltip says it plainly: gamma > 1 brightens. That's the opposite convention from a lot of tools, so set it once and check the preview rather than trusting muscle memory.
  • contrast and pivot - the S-curve amount and its centre. pivot only does anything when contrast isn't 0.
  • out_low / out_high - the output window, which compresses the result into a sub-range. Useful for "never let this mask go fully hard".

Output is a single mask.

Install

ComfyUI Manager → search ComfyUI Field, or:

cd ComfyUI/custom_nodes
git clone https://github.com/jeremieLouvaert/ComfyUI-Field

Restart. No dependencies beyond torch; nothing to download. Category AKURATE/Fields/Reshape.

When to use this instead of Field Threshold

Both can make a mask harder or softer, and people mix them up. The split is roughly: Field Threshold thinks in statistics, Field Remap thinks in levels.

If your goal is "select the top 30% of this image whatever its histogram looks like", that's Field Threshold's coverage mode - it rank-transforms and gives you a quantile. If your goal is "everything above 0.6 should be solid and the ramp between 0.4 and 0.6 should be gentler", that's Field Remap's input window and gamma. Threshold's smooth and band modes are for shaping around a specific level or band; Remap is for reshaping the whole curve.

The two compose fine, and often should: remap to get the mask into a sensible range, then threshold to make a decision about it.

Traps

The ordering trap. Because normalize runs before the input window, switching normalize on can change what the window does - you're now stretching an already-stretched input. If you turn normalize on and the result goes flat and clipped, in_low/in_high are still where they were and now they're cutting into a different distribution.

Second: contrast with a pivot you left at 0.5 will push bright pixels brighter and dark pixels darker around the midpoint, which on an already-binary mask means almost nothing happens. Binary inputs have nowhere left to go, so all these midtone controls look inert. Remap wants a soft input to do anything interesting.

CategoryAKURATE/Fields/Reshape

Inputs (10)

NameTypeDefaultDescription
fieldMASK—
invertBOOLEANfalse—
normalizeBOOLEANfalse—
in_lowFLOAT0.000–1—
in_highFLOAT1.000–1—
gammaFLOAT1.000.01–10gamma > 1 brightens
contrastFLOAT0.00-1–1—
pivotFLOAT0.500–1S-curve centre. Only used when contrast != 0
out_lowFLOAT0.000–1—
out_highFLOAT1.000–1—

Outputs (1)

NameTypeDescription
maskMASK—