ComfyUI Node

Mask Multiply Zero Wins

The intersection that plays by boolean rules

By Ltamann·Created about a year ago·Updated 19 days ago· 156
Mask Multiply Zero Wins
  • mask1
  • mask2
  • mask
operation
clamp_resulttrue
round_resultfalse

The name is the spec: multiply two masks, and wherever either mask is zero, the result is zero. In mask space that's a hard logical AND - the output is bright only where both inputs were bright. A selection that's covered by either the segment mask or the hand-painted mask is out; a pixel needs to be selected in both to survive.

That's the entire feature. The node takes two masks, an operation dropdown, and a couple of post-processing toggles, and returns one MASK. It's the streamlined version of the pack's MaskMultiplyAdvanced - same core math, fewer knobs, and a name that actually tells you what the default multiply does.

The inputs

  • mask1 / mask2 - the two masks. If resolutions differ, mask2 is resized to match mask1 automatically.
  • operation - two choices. multiply is the AND/intersection described above. invert_multiply_invert computes 1 - (1-mask1)*(1-mask2), which is the soft union: bright where either mask is bright. That's the "but I wanted them combined" mode, and it's why the name says "zero wins" rather than just "multiply" - the zero-wins behavior is the point of the default, the union is the escape hatch.
  • clamp_result (default on) - clamp to 0–1.
  • round_result (default off) - snap to hard 0/1.

One MASK output.

When you'd reach for it

Any time you have two masks that must both agree before the sampler is allowed to do something. In ETUR-style refinement that comes up constantly: intersect a complexity map (only texture-rich areas) with a protection-aware inpaint mask (only regions you've flagged as free to rework), and the refiner gets a denoise budget only where both conditions hold. The "zero wins" framing is the safety property - a zero in either input can never leak through, which is exactly what you want when one of the masks is a hard "do not touch" boundary.

Installing it

Ships in the TBG ETUR pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Ltamann/ComfyUI-TBG-ETUR
cd ComfyUI-TBG-ETUR
pip install -r requirements.txt

Or ComfyUI Manager → search "TBG" → TBG_Enhanced Tiled Upscaler & Refiner FLUX PRO, restart.

Notes

Two honest caveats. First, if you only ever need intersection plus union, and you're the sort who likes fewer nodes in the graph, MaskMultiplyAdvanced covers both modes in the same file - but this one's simplicity is also a feature: one operation mode does what its name says, no threshold/weight inputs to second-guess. Second, remember the "zero wins" property cuts both ways: a mask that's slightly noisy (gray tails instead of clean black) will not zero out cleanly, because those gray values aren't zero. If your intersection keeps coming out muddier than expected, threshold the inputs first - either with MaskMultiplyAdvanced's multiply_with_threshold mode or a stock threshold node - and then the zero-wins behavior will finally look as crisp as the name promises.

CategoryTBG/Helpers/Mask

Inputs (5)

NameTypeDefaultDescription
mask1MASK
mask2MASK
operationCOMBO2 options: multiply, invert_multiply_invert
clamp_resultBOOLEANtrue
round_resultBOOLEANfalse

Outputs (1)

NameTypeDescription
maskMASK