Clamp Mask
Stop out-of-range values from sneaking into your conditioning
- msks_list
- msks
Masks are supposed to live between 0 and 1. In practice they wander: a blurred mask, an aggregated mask, or a mask that came out of some arithmetic-heavy node can carry values slightly below 0 or above 1, and plenty of downstream nodes quietly misbehave when that happens. Clamp Mask is the one-node enforcement: it squashes every value into whatever range you declare.
That's genuinely all it does, and for a single-purpose node that's a feature. msks_list in, msks out - list to list, same shapes, no resizing, no relighting. It just runs torch.clamp over every mask with your chosen bounds.
The two dials
min_val(default 0.0) - the floor. Anything below gets pushed up to it.max_val(default 1.0) - the ceiling. Anything above gets pulled down to it.
Defaults are exactly right for standard mask use: values stay in [0, 1]. But the useful trick is that these bounds don't have to be 0 and 1. Set min_val to 0.2 and you've built a floor that guarantees every region keeps at least a faint presence - a way to stop a conditioning mask from fully zeroing an area. Set max_val to 0.8 and you've capped how strong any region can push. That's a crude-but-effective strength control that costs nothing.
Where it fits
Three places in a Pseudocomfy graph make this node worth having:
- After PseudoMaskAggregate. The
sum_normalizedandaverageoperations can leave values that aren't cleanly bounded, and the downstream conditioning nodes will thank you for clamping first. - After arithmetic. Any mask that's been multiplied, added, or rescaled is a candidate for a clamp before it reaches a mask-hungry node.
- As a safety rail at the end of a mask chain you don't fully control - e.g. masks you built yourself with other packs. One clamp node and you never have to wonder what range is arriving.
The honest caveats
It clamps values but it does not normalize - a mask stuck in [0.3, 0.8] stays [0.3, 0.8] after a 0–1 clamp. If you want the full dynamic range stretched back out, that's PseudoMaskRemap's job, not this node's. And there's no invert option here (unlike the blur and reshape siblings), so if you need a flipped mask as well, chain PseudoMaskInvert after it.
It's one of those nodes that feels like a no-op until the day it silently saves you from a render full of posterized masks. Ships with the pack - clone Pseudocomfy into custom_nodes and restart, or grab it from Manager.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| msks_list | MASK | — | |
| min_val | FLOAT | 0.000–1 | — |
| max_val | FLOAT | 1.000–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| msks | MASK | — |