Aggregate Masks
Fold a whole list of region masks into one, five ways
- msks_list
- msk
Regional prompting hands you a list of masks - one per material, per region, per object - and sooner or later you need them to stop being a list. You want the union of "where is anything happening," or the overlap, or a single combined region to feed something that accepts one mask. Aggregate Masks does the fold: it takes a whole list of masks on one wire and returns a single combined mask.
The code traces back to the Impact Pack lineage (Pseudocomfy's README credits ltdrdata's pack for the adapted mask utilities), and it's the same spirit: unglamorous, universally useful, no models involved.
The one choice that matters: operation
Five operations, and they behave differently enough that picking wrong gives you subtly wrong results:
sum_clamped- adds all masks and clamps to [0, 1]. Where any region is white, the result is white; where several overlap, it stays 1.0 (no brightness stacking). The default mental model for "union."sum_normalized- adds all masks then normalizes the sum across the image, so the brightest areas map to 1.0 and dimmer overlaps stay proportional. Different feel: the strongest overlap becomes the peak.average- the pixelwise mean. Overlaps stay mid-gray instead of saturating. Good when you want a soft, blended region rather than a hard union.max- each pixel takes the brightest value across all masks. A true union with no softening; the composite keeps every mask's hardest edge.min- each pixel takes the dimmest value. Only pixels white in every mask stay white: the strict intersection.
There's also an invert toggle (default off) that flips the combined result - 1 - mask - so "union of regions" becomes "everything except the regions," which is exactly what you want when the combined mask is destined for a background pass.
Practical notes
- Input is
msks_list(a MASK list - wire it from PseudoUnpackModelSnapshot or PseudoProcessMaterialPrompts), output is a singlemsk. All masks must share the same dimensions; stacking will fail loudly if they don't. sum_clampedis the safe default for most "give me one mask of the whole scene" jobs. Reach formaxwhen you need hard edges preserved,averagewhen you want feathering,minwhen you genuinely need the intersection.- The inverted result isn't clamped to a range in all paths, so if you're feeding it to a picky node, run it through PseudoMaskClamp afterward.
It's a compact node that earns its place because list-to-single conversions are the kind of thing that otherwise becomes three reroute nodes and a headache. Pack-standard install: clone Pseudocomfy into custom_nodes and restart, or grab it from Manager.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| msks_list | MASK | — | |
| operation | COMBO | 5 options: sum_clamped, sum_normalized, average, max, min | |
| invert | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| msk | MASK | — |