Nodes/ComfyUI/Create SCAIL-2 Colored Mask
ComfyUI Node Runs on cloud

Create SCAIL-2 Colored Mask

The color-by-numbers step behind SCAIL-2 character animation

By Comfy-Org·Created 4 years ago·Updated about 10 hours ago· 130,663
Create SCAIL-2 Colored Mask
  • driving_track_data
  • ref_track_data
  • pose_video_mask
  • reference_image_mask
object_indices
sort_byleft_to_right
replacement_modefalse

If you've ever watched a SCAIL-2 workflow and wondered where those garish rainbow masks come from, this is the node. SCAIL is ByteDance's animation-style video model - a Wan-family fine-tune that takes a pose-driving video and a reference image of a character and makes the character dance. The catch: SCAIL doesn't understand "the girl in the red dress." It understands colors. Each identity in the driving video has to be a specific color in a mask, and each identity in your reference image has to be the same color. SCAIL2ColoredMask is the node that renders those colored masks from tracking data, and it exists specifically so the same person keeps the same color across both outputs.

How it works

You feed it tracking data (from the SAM3 video tracking nodes) for the driving pose video, and optionally tracking data or a plain mask for your reference subject. The node renders each tracked object as a solid palette color on a background, producing two image outputs: pose_video_mask (the driving video, colored) and reference_image_mask (the reference, colored). Because the reference is what tells SCAIL who the character is, the two masks have to agree on which color is which person - hence the sort_by parameter (default left_to_right), which decides how palette colors map to objects and applies the same ordering to both outputs so identity stays locked to color.

The replacement_mode toggle (default off) flips the background conventions: off is "Animation Mode" (pose mask on black, reference on white), on is "Replacement Mode" (reversed). Pick the mode that matches what you're trying to do - animate a character into a scene, or replace a person in existing footage - and don't mix them up, or the model will read the masks backwards.

Inputs that matter

  • driving_track_data (required) - SAM3 track of the pose-driving video.
  • ref_track_data (optional) - SAM3 track of the reference, or a plain MASK (rendered as a single identity).
  • object_indices - comma-separated person indices to include ("0,2,3"); empty = everyone. Use it to drop tracking noise.
  • sort_by - left_to_right / area / none; controls color assignment order.
  • replacement_mode - flips background colors as above.

Outputs are the two IMAGE masks, which feed into WanSCAILToVideo alongside your reference image and text.

Where it fits

Ships with ComfyUI core (SCAIL-2 landed June 2026). The SCAIL checkpoint goes in your ComfyUI model folders - and good news for small cards: the fp8 build runs on ~16GB VRAM, which is why this one got traction over heavier animation models.

Common issues

The usual failure is color flicker - a character changing color mid-clip because the tracking lost them and the ordering shifted. That's what sort_by and object_indices are for: lock the ordering, filter out the stray tracks. Another classic: using a SAM3 track for the reference when a plain mask of the subject would be more stable, or feeding a reference with multiple people when you only want one identity tracked. And if the output looks inverted (background where the person should be), you've got replacement_mode backwards - flip it and the masks swap conventions.

Categorymodel/conditioning/wan/scail

Inputs (5)

NameTypeDefaultDescription
driving_track_dataSAM3_TRACK_DATASAM3 track of the driving pose video. Will be rendered into the pose_video_mask output.
object_indicesSTRINGComma-separated list of person indices to include (e.g. '0,2,3'). Applied to both reference and pose video masks. Empty = all.
sort_byCOMBOleft_to_rightOrder in which palette colors are assigned to the tracked objects (applied to both reference and pose video so each identity keeps the same color). Objects that appear in earlier frames always come first; within a frame, left_to_right = leftmost object (by centroid at first appearance) gets the first color, area = biggest object (by mask area at first appearance) gets the first color; none = keep SAM3's order.
replacement_modeBOOLEANfalseFalse = Animation Mode (pose_video_mask has black background, reference_image_mask has white background). True = Replacement Mode (pose_video_mask has white background, reference_image_mask has black background).
ref_track_dataoptSAM3_TRACK_DATA,MASKSAM3 track of the reference image(s) (one identity per object, colored in batch order), or a plain MASK of the reference subject (rendered as a single identity).

Outputs (2)

NameTypeDescription
pose_video_maskIMAGE
reference_image_maskIMAGE