Nodes/ComfyUI-TP-OmnimatteZero/πŸ” Omnimatte Mask Gen
ComfyUI Node

πŸ” Omnimatte Mask Gen

Omnimatte Mask Gen

By tpc2233Β·Created 7 months agoΒ·Updated 7 months agoΒ· 36
πŸ” Omnimatte Mask Gen
  • pipe
  • video
  • object_mask
  • total_mask
β—„dilation5β–Ί

You paint a rough mask around the thing you want gone. OmnimatteTotalMaskGen is the node that turns that sloppy blob into the total_mask the removal node actually wants - and it's the least glamorous, most quietly load-bearing node in this pack.

The name is the giveaway. This is an omnimatte pack, and the whole thesis of the research behind it is that an object in a video isn't just its pixels - it's also the shadow it casts, the reflection it leaves in the puddle, the splash it kicks up. Remove the object but leave the shadow and everyone notices. So the pipeline wants a mask that covers the object and its effects: a total mask.

What it actually does under the hood

Three things, in order. First it aligns your video to what the LTX VAE demands - frame count of k*8+1 (so 9, 17, 25…), spatial dimensions divisible by 32 - trimming frames rather than interpolating, so it never invents motion. Then it takes your object_mask, pads or trims it to that exact frame count, and resizes it to match. Then it dilates it by dilation pixels (default 5) so the region the removal model regenerates has a little breathing room and you don't get a hard seam.

It also runs one full transformer forward pass on your video while hooking the self-attention maps. That's the omnimatte machinery - in the research code, attention propagation is how a coarse object mask grows into a matte that reaches the object's effects. In this port, the practical output is your mask, aligned and dilated; the attention pass is mostly what makes this node slow and VRAM-hungry rather than instant.

The inputs that matter

  • pipe - from OmnimatteLoader. Nothing else works.
  • video - the clip you're cleaning.
  • object_mask - a MASK, one per video frame. The sample workflow gets it from core ImageToMask on a single frame and lets this node propagate it across the whole clip; you do not need to hand-paint every frame.
  • dilation - 0–20, default 5. This is the one dial you'll actually touch. Too small and removal leaves seams; too big and the model regenerates background you liked.

Output is a single total_mask (MASK), which wires straight into OmnimatteObjectRemoval.

How to install it

Same as the rest of the pack - install once, use everywhere. Via ComfyUI Manager search for "ComfyUI-TP-OmnimatteZero", or:

cd ComfyUI/custom_nodes
git clone https://github.com/tpc2233/ComfyUI-TP-OmnimatteZero.git
pip install -r ComfyUI-TP-OmnimatteZero/requirements.txt

Restart ComfyUI. There are no extra model files for this node - it piggybacks on the LTX model the Loader already pulled down (that's the ~48 GB download you may have noticed).

Where people get burned

  • It looks like it's hanging. This node runs a full transformer forward pass on your whole video before it outputs anything. It's slow by design, not broken. On a small card with cpu_offload on, allow real time.
  • Cranking dilation to fix a bad mask. No. A lazy mask makes a lazy total mask; dilation covers seams, it doesn't rescue a mask that misses the object. Redraw or use a better detector.
  • Frame-count mismatch errors from the VAE - you shouldn't see them here, because the node aligns everything for you, which is exactly the point of it. If you do see dimension errors, they're coming from the video feed before this node, so check your video input is a proper frame stack.

Mask quality is the single biggest lever on the whole object-removal workflow. Get this node a clean object_mask and the rest of the pack gets to show off.

CategoryOmnimatteZero

Inputs (4)

NameTypeDefaultDescription
pipeOMNIMATTE_PIPEβ€”
videoIMAGEβ€”
object_maskMASKβ€”
dilationINT50–20β€”

Outputs (1)

NameTypeDescription
total_maskMASKβ€”