Garment Skin Interaction Canny v5.1.0
Edges only where the garment meets skin
- garment_masks
- first_pass_images
- first_pass_masks
- IMAGE
Garment Skin Interaction Canny solves a specific artifact in two-pass try-on generation. After the first pass produces a rough result, the boundary where the garment meets the skin is usually the weakest part - edges wobble, the garment floats, or the skin bleeds over the fabric. This node runs Canny edge detection on that first-pass image, then keeps only the edges that fall inside the overlap of two masks: the garment mask and the first-pass mask. What survives is the interaction line - the crisp boundary where clothing should end and skin should start. That's the thing you want to lock down.
The mechanism is clean boolean pixel math on top of OpenCV Canny. Each garment mask is resized to the first-pass image's dimensions, both masks are inverted to "inside" regions, and the result is the intersection of (garment area ∩ first-pass garment area) multiplied by the Canny edge map. Thresholds are the standard Canny pair. Out comes an edge image you can feed straight into a ControlNet canny preprocessor - or use directly as canny conditioning - so the second pass is told "here is exactly where the boundary must be."
Inputs that matter
garment_masks- masks of the garment as it should be (from segmentation).first_pass_images- the actual generated try-on result from pass one.first_pass_masks- where the garment ended up in that result.lower_threshold(80) /higher_threshold(240) - the Canny thresholds. Lower them to keep weaker edges; the defaults are reasonable for most clothing.
Output
One IMAGE: the interaction edges, black where there's nothing to enforce, white lines exactly at the garment-skin boundary. This feeds a ControlNet / canny conditioning node.
Where it fits
This is the "pin the boundary" node of a two-pass pipeline: generate freely, then regenerate with the interaction edges as a hard constraint so pass two keeps the fabric on the right side of the line. It's opinionated and specific - it assumes the first pass already got the garment roughly right and just needs the edges held. If your first pass is a mess, this node faithfully encodes the mess as constraints.
Install and gotchas
Standard pack install (ComfyUI Manager → search "tri3d", or git clone https://github.com/TRI3D-LC/tri3d-comfyui-nodes into ComfyUI/custom_nodes, then restart). Keep the folder named tri3d-comfyui-nodes. OpenCV only - no model, no extra deps.
- All three inputs are IMAGE type (masks as images), not MASK - wire accordingly.
- The output is the raw edge map, not a ControlNet-ready preprocessed tensor with the exact color conventions some controlnet setups expect. You may need to route it through a canny/edge node or normalize it before it conditions well.
- Batch handling is fine (it loops per frame), but the node expects
garment_masks,first_pass_images, andfirst_pass_masksto have the same batch length - mismatched batches drop frames silently.
For the narrow job it names itself after, it's the right tool and there isn't a more standard equivalent in core ComfyUI. If your try-on results keep bleeding at the garment edge, this is the node that tells the sampler where the line is.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| garment_masks | IMAGE | — | |
| first_pass_images | IMAGE | — | |
| first_pass_masks | IMAGE | — | |
| lower_threshold | INT | 80 | — |
| higher_threshold | INT | 240 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |