Gray Paint Tracker
Paint a Blob on Frame One, Track It Through the Whole Clip
- video
- images
- masks
- tracking_preview
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:
- Run once with your video connected. The first frame loads onto a paint canvas on the node.
- 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;manualtracks 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_sizeandpyramid_levelsfor bigger motion, or switchanchor_modetomanualand 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 checkexpand_pixelsisn't so small that tracking noise shows at the edges. - Forgetting
draw_previewis 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.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| video | IMAGE | Video frames batch (B, H, W, C) | |
| mask_data | STRING | Painted mask (base64 PNG). Set automatically by the paint canvas - hidden in the UI. | |
| track_enabledopt | BOOLEAN | true | Track a point so the mask follows motion. Off = static mask held across all frames. |
| anchor_modeopt | COMBO | centroid | centroid = track the center of the painted region. manual = track the clicked anchor (use 'Set Anchor' on the canvas). |
| anchor_xopt | INT | 00–8192 | Manual anchor X (click image to set) |
| anchor_yopt | INT | 00–8192 | Manual anchor Y (click image to set) |
| gray_valueopt | FLOAT | 0.500–1 | Gray level for masked areas (0.5 = mid gray, matches VACE default filler) |
| expand_pixelsopt | INT | 00–256 | Expand mask outward by this many pixels before compositing (hard edge, no feather) |
| draw_previewopt | BOOLEAN | false | Output a tracking_preview with crosshairs at the tracked point (slower; debug aid). |
| window_sizeopt | INT | 3111–1025 | Tracking search window in pixels. Use large values (201+) for fast-moving objects. |
| pyramid_levelsopt | INT | 41–8 | Pyramid levels (more = handles larger motion). 6-8 for very large motion. |
| iterationsopt | INT | 103–50 | Iterations per level (more = accurate) |
| smoothingopt | FLOAT | 0.300–0.9 | Temporal smoothing (0=none, higher=smoother) |
| search_radius_percentopt | FLOAT | 00–100 | Template-match search as % of frame size. 0=use window_size, 100=search whole frame. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | Original video with solid gray composited over the (moving) masked region |
| masks | MASK | White (1) where gray was applied per frame, black (0) elsewhere - binary, VACE-ready |
| tracking_preview | IMAGE | Optional debug preview with tracked-point crosshairs (1x1 placeholder unless draw_preview is on) |