Nodes/ComfyUI-FitDiTx/FitDiT Generate Mask
ComfyUI Node

FitDiT Generate Mask

FitDiT's quiet front half — the mask node that decides whether the try-on works

By ihmily·Created 7 months ago·Updated 7 months ago· 0
FitDiT Generate Mask
  • model
  • model_image
  • masked_image
  • mask
  • pose_image
categoryUpper-body
offset_top0
offset_bottom0
offset_left0
offset_right0

FitDiT is a two-step pipeline, and this is step one: it looks at your person photo, figures out where the clothing actually is on the body, and hands back the mask plus a pose skeleton that the try-on node needs. It's the least glamorous node in the pack and it's tempting to rush past it to the "real" node - don't. The mask it draws is the single biggest lever on try-on quality. Garbage mask in, seams everywhere out.

How it works

The Load Model node already loaded two ONNX preprocessors alongside the big transformers: DWPose for the skeleton and a human-parsing model that labels body regions. Generate Mask runs both on your photo (resized to 768 internally), then combines the parsed body labels into a garment-agnostic mask using the classic recipe from the VITON-HD / OOTDiffusion lineage. The torso/garment region gets marked for regeneration; everything else is treated as untouchable context. This is exactly what the Gradio demo's "Step1: Run Mask" button does, exposed as a node.

The inputs that matter

  • model - the FITDIT_MODEL from FitDiT Load Model.
  • model_image - the person you're dressing.
  • category - Upper-body, Lower-body, or Dresses. This must match the garment you're about to try on; use Dresses for anything one-piece. Get it wrong and the mask lands in the wrong place.
  • offset_top / offset_bottom / offset_left / offset_right - pixel nudges (−200 to 200) that expand or shrink the mask on each side. These are the "mask offset" sliders from the demo, exported as integers. If the auto-mask misses a sleeve or bites into the waist, nudge the matching side and rerun.

Outputs

  • masked_image - a preview of the person with the garment area greyed out. Mostly a sanity check that the agnostic region landed where you think it did.
  • mask - the actual MASK tensor. Wire this into FitDiT Virtual Try-on.
  • pose_image - the DWPose skeleton render. Wire this into FitDiT Virtual Try-on as the pose condition. It's what keeps the subject's pose from drifting during the try-on, and it's a genuine advantage over CatVTON, which has no pose control at all.

Troubleshooting

  • Mask misses stuff. Nudge the offsets, or skip this node's mask entirely: draw your own and feed that to the try-on node. FitDiT doesn't care where the mask came from, and a hand-tuned mask on a tricky garment beats an automatic one every time.
  • "Mask generation failed." The image isn't parsing as a person - weird crop, obscured face, or a non-human subject. The parsing model needs to see a body.
  • Offsets feel huge. They're in pixels of the internally-resized 768px image, so values that look enormous relative to your full-res photo are normal.
  • Double-check category first. It's the thing people forget before blaming the offsets.

Install and models are shared with the rest of the pack (ComfyUI Manager search "ComfyUI-FitDiTx", or git clone + pip install -r requirements.txt). The ONNX preprocessing models ship inside the FitDiT_models download, so this node adds nothing extra - the mask node is cheap, and it's also where you should look first when the try-on looks off.

CategoryFitDiT

Inputs (7)

NameTypeDefaultDescription
modelFITDIT_MODEL
model_imageIMAGE
categoryCOMBOUpper-body3 options: Upper-body, Lower-body, Dresses
offset_topINT0-200–200
offset_bottomINT0-200–200
offset_leftINT0-200–200
offset_rightINT0-200–200

Outputs (3)

NameTypeDescription
masked_imageIMAGE
maskMASK
pose_imageIMAGE