Nodes/ComfyTV/Shape Mask
ComfyUI Node

Shape Mask

Procedural Stencils That Sweep Across the Frame

By jtydhr88·Created 3 months ago·Updated about 16 hours ago· 725
Shape Mask
  • video
  • shape_image
  • video
force_run_token0
project_id
parent_output_id0
map_kindradial
threshold0.50
softness0.10
invertfalse
animatestatic
outputstencil
seed7

Masking in ComfyUI usually means one of two things: SAM finding an object, or you drawing a spline by hand. Shape Mask is the third option nobody talks about - a procedural mask, built from math instead of detection or drawing. Under ComfyTV/VideoFX, it generates a grayscale map from gradients and thresholds it into a mask, and because the shape is procedural, it can animate - which makes it the sneaky-good node for vignettes, wipes, and animated transitions that would otherwise need keyframing.

map_kind picks the source function: radial (default) or the linear/bilinear axes - a soft radial falloff from the frame center is the classic vignette shape. threshold (0–1, default 0.5) slices the gradient into a hard stencil, and softness (0–1, default 0.1) blurs that slice so it's a soft-edge mask rather than a hard matte. invert flips it. Then the two knobs that make it a video tool:

  • animate - static, sweep_in, or sweep_out. The sweep modes push the shape across the frame over the clip, which is exactly the wipe/title-reveal mechanic you'd otherwise build in an NLE.
  • output - stencil (default) or matte. Stencil vs matte is a classic compositing distinction: a stencil is the sharp thresholded shape; a matte is the softer, graded version with edge falloff. Wire whichever your composite stage expects.

There's also a seed (reproducibility for the animated noise-free variants), and two optional inputs: video (the footage you're masking against - needed for animated modes) and shape_image, which swaps the procedural gradient for any grayscale image you feed it. That's the underrated path: generate a noise or displacement image in another stage, wire it in, and the Shape Mask becomes "threshold this arbitrary map," which is how you get organic, non-gradient masks without any segmentation model.

The practical take

Don't reach for this to isolate a person - that's SAM territory. Reach for it when you want a soft, procedural, animating mask: vignettes, corner reveals, gradient transitions, or "threshold an arbitrary grayscale map." The default is deceptively simple (a radial threshold), and the moment it earns its keep is sweep_in + a slightly lowered threshold for a gentle wipe.

Install

With ComfyTV:

cd ComfyUI/custom_nodes
git clone https://github.com/jtydhr88/ComfyTV

Restart ComfyUI; under ComfyTV → VideoFX. ComfyUI Manager: search "ComfyTV". Desktop/macOS: clone into the running instance's absolute custom_nodes (startup-log path), fix any ComfyTV/ComfyTV/ nesting, full backend restart. No models, no extra deps.

Troubleshooting

  • Hard-edged stencil when you wanted a soft mask. Lower softness is the dial - wait, the opposite: raise softness toward 0.3–0.5 for a feathery edge, or switch output to matte.
  • Animated mode does nothing. sweep_in/sweep_out need the clip's duration, so wire the video input; without it there's no timeline to sweep across.
  • Mask covers the whole frame. Threshold at 0 with a radial map is "everything." Raise threshold.
CategoryComfyTV/VideoFX

Inputs (12)

NameTypeDefaultDescription
force_run_tokenINT00–2147483647Internal — bumped on Run to invalidate ComfyUI's input cache.
project_idSTRINGInternal — populated by the projectStore on the frontend.
parent_output_idINT00–2147483647Internal — lineage parent set by spawn handlers on the frontend.
map_kindCOMBOradial16 options: linear_x, linear_y, bilinear_x, bilinear_y, radial, square, +10
thresholdFLOAT0.500–1
softnessFLOAT0.100–1
invertBOOLEANfalse
animateCOMBOstatic3 options: static, sweep_in, sweep_out
outputCOMBOstencil2 options: stencil, matte
seedINT70–99999
videooptCOMFYTV_VIDEO
shape_imageoptCOMFYTV_IMAGE

Outputs (1)

NameTypeDescription
videoCOMFYTV_VIDEO