Nodes/TrentNodes/Gray Paint Tracker
ComfyUI Node

Gray Paint Tracker

Paint a Blob on Frame One, Track It Through the Whole Clip

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
Gray Paint Tracker
  • video
  • images
  • masks
  • tracking_preview
mask_data
track_enabledtrue
anchor_modecentroid
anchor_x0
anchor_y0
gray_value0.50
expand_pixels0
draw_previewfalse
window_size31
pyramid_levels4
iterations10
smoothing0.30
search_radius_percent0

Wan VACE inpainting needs the thing-you-want-replaced painted over in gray, on every frame, with a matching mask. For a moving subject that means the gray region has to follow the subject - a static blob is useless the moment anything moves. Gray Paint Tracker is the node that solves both problems with one interaction: you paint a gray region on the first frame, it tracks a point through the clip, and the gray rides along with it. Outputs: the gray-composited video and a clean binary mask, both VACE-ready.

This is the kind of node that only makes sense if you've actually built a VACE inpaint pipeline and felt how much of the work is in the prep - compositing gray-over-original, tracking it, re-doing the mask every frame. The author of this pack clearly lives in that world; this node and the keyframe builder around it are the heart of why people know the pack's Wan tooling.

How it works

The interaction is deliberately two-run:

  1. Run once with your video connected. The first frame loads onto a paint canvas on the node.
  2. Paint a gray region over the subject, set your tracking anchor, and run again.

The painted mask (a base64 PNG in the hidden mask_data widget) is then carried through the whole clip. Tracking uses pyramidal Lucas-Kanade optical flow - the same robust point-tracking family as the pack's Point Tracker - with a template-match fallback for larger motion. The defaults (window_size 31, pyramid_levels 4, iterations 10) handle most footage; raise window_size toward 200+ and pyramid_levels toward 6–8 for fast-moving subjects. smoothing (0–0.9) damps jitter in the tracked path, which is often the difference between a clean mask and a wobbling one.

The knobs that actually matter:

  • anchor_mode - centroid (default) tracks the center of the painted region; manual tracks a point you clicked with "Set Anchor" on the canvas. Manual is better when the subject's meaningful center isn't the paint blob's centroid.
  • gray_value (default 0.5) - the fill gray. Leave it: 0.5 is exactly what VACE's filler expects.
  • expand_pixels - grows the mask outward with a hard edge before compositing. A little expansion keeps VACE from repainting right on the subject's boundary.
  • track_enabled - off gives you a static mask held across all frames, for the rare case the subject doesn't move.

Outputs: images (video with gray composited over the moving region), masks (binary, white where gray was applied - VACE-ready), and tracking_preview (a debug overlay with crosshairs; 1×1 placeholder unless you turn draw_preview on, which is slower and meant for diagnosis).

Install

Search "Trent Nodes" in ComfyUI Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/TrentHunter82/TrentNodes.git
cd TrentNodes
pip install -r requirements.txt

No models - the tracking is OpenCV optical flow (the pack's opencv-python requirement) and the compositing is GPU tensor math. Restart ComfyUI after installing. (The author has noted Manager install flakiness from an early repo rename; manual clone is the reliable path.)

Common issues

  • The gray drifts off the subject. That's tracking loss. Raise window_size and pyramid_levels for bigger motion, or switch anchor_mode to manual and anchor on a high-contrast feature (an eye, a corner).
  • Nothing shows until you run twice. Yes - the paint step happens on the node's canvas between runs. That's by design, not a bug.
  • The mask flickers. Increase smoothing, and check expand_pixels isn't so small that tracking noise shows at the edges.
  • Forgetting draw_preview is a speed trap. Leave it off in production; it's a debug aid.

For "erase this thing from my video with minimal fuss," this is the node that makes VACE inpainting feel like an edit rather than a pipeline. Paint once, track automatically, feed VACE, done.

CategoryTrent/Keyframes

Inputs (14)

NameTypeDefaultDescription
videoIMAGEVideo frames batch (B, H, W, C)
mask_dataSTRINGPainted mask (base64 PNG). Set automatically by the paint canvas - hidden in the UI.
track_enabledoptBOOLEANtrueTrack a point so the mask follows motion. Off = static mask held across all frames.
anchor_modeoptCOMBOcentroidcentroid = track the center of the painted region. manual = track the clicked anchor (use 'Set Anchor' on the canvas).
anchor_xoptINT00–8192Manual anchor X (click image to set)
anchor_yoptINT00–8192Manual anchor Y (click image to set)
gray_valueoptFLOAT0.500–1Gray level for masked areas (0.5 = mid gray, matches VACE default filler)
expand_pixelsoptINT00–256Expand mask outward by this many pixels before compositing (hard edge, no feather)
draw_previewoptBOOLEANfalseOutput a tracking_preview with crosshairs at the tracked point (slower; debug aid).
window_sizeoptINT3111–1025Tracking search window in pixels. Use large values (201+) for fast-moving objects.
pyramid_levelsoptINT41–8Pyramid levels (more = handles larger motion). 6-8 for very large motion.
iterationsoptINT103–50Iterations per level (more = accurate)
smoothingoptFLOAT0.300–0.9Temporal smoothing (0=none, higher=smoother)
search_radius_percentoptFLOAT00–100Template-match search as % of frame size. 0=use window_size, 100=search whole frame.

Outputs (3)

NameTypeDescription
imagesIMAGEOriginal video with solid gray composited over the (moving) masked region
masksMASKWhite (1) where gray was applied per frame, black (0) elsewhere - binary, VACE-ready
tracking_previewIMAGEOptional debug preview with tracked-point crosshairs (1x1 placeholder unless draw_preview is on)