ComfyUI Node

MaskMultiplyAdvanced

Multiply, union, threshold, or weight — in one node

By Ltamann·Created about a year ago·Updated 19 days ago· 156
MaskMultiplyAdvanced
  • mask1
  • mask2
  • mask
operation
threshold0.50
weight11.0
weight21.0
clamp_resulttrue
round_resultfalse

If you've ever needed two masks combined and found yourself stacking invert nodes and wondering why the boolean logic doesn't compose the way you expect, MaskMultiplyAdvanced is the tool that stops the node spaghetti. It multiplies two masks with four selectable modes, plus a few post-processing toggles, and returns one clean MASK.

The four operation modes, decoded:

  • multiply - plain mask1 * mask2. Zero in either mask zeroes the result, so this is a soft AND / intersection: the output is only bright where both masks were bright. If you only need this, the sibling Mask Multiply Zero Wins is the same thing without the extras.
  • invert_multiply_invert - compute 1 - (1-mask1)*(1-mask2). That's a soft OR / union: bright where either mask was bright. This is the one people usually mean when they say "I just want these two masks combined" - and it's why the node has a mode at all rather than just doing multiply.
  • multiply_with_threshold - zero out anything below threshold in both masks first, then multiply. Use it to kill faint noise in two masks before intersecting them, so you don't end up with a result that's dominated by soft gray tails.
  • weighted_multiply - scale each mask by weight1 / weight2 before multiplying. Handy for "I want the overlap, but mask A should dominate" without a separate multiply-scale chain.

The inputs that matter

  • mask1 / mask2 - the two masks. If their resolutions differ, the node auto-resizes mask2 to mask1.
  • operation - one of the four above.
  • threshold (default 0.5) - only used by multiply_with_threshold.
  • weight1 / weight2 (default 1) - only used by weighted_multiply.
  • clamp_result (default on) - clamps output to 0–1. Leave it on; the math can otherwise push past 1 in the union mode.
  • round_result (default off) - rounds to pure 0/1, making a hard boolean mask. Turn on only if you want a hard-edged selection.

One MASK output. That's the schema.

Where it fits

Masks in ETUR's refiner travel in little chains: complexity maps, protection masks, segment masks, inpaint masks. MaskMultiplyAdvanced is the junction box. A typical move: take your segment mask (the object you care about) and union it with a hand-painted "also fix this spot" mask via invert_multiply_invert, then intersect the result with a complexity mask via multiply so the refiner only gets high denoise where there's both a selection and texture. Two modes in one node, no inverted spaghetti.

Installing it

It's part of 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

The one trap is forgetting that masks live in 0–1 float space, and "multiply" in that space is intersection, not "combine." Newcomers habitually wire two masks into multiply expecting a merge and get an intersection that looks almost empty - that's the invert_multiply_invert mode's job. If your output keeps coming out too dark, you almost certainly picked the wrong operation, not the wrong values. And if you're only ever doing one operation, the simpler nodes in this menu (Mask Multiply Zero Wins, MaskConditionalPaint) do the same math with less surface area.

CategoryTBG/Helpers/Mask

Inputs (8)

NameTypeDefaultDescription
mask1MASK
mask2MASK
operationCOMBO4 options: multiply, invert_multiply_invert, multiply_with_threshold, weighted_multiply
thresholdoptFLOAT0.500–1
weight1optFLOAT1.00–2
weight2optFLOAT1.00–2
clamp_resultoptBOOLEANtrue
round_resultoptBOOLEANfalse

Outputs (1)

NameTypeDescription
maskMASK