Wan VACE → Video (hybrid subject swap)
Swap a subject into a scene and keep the lighting — Wan VACE hybrid swap
- positive
- negative
- vae
- control_video
- source_video
- control_masks
- reference_image
- positive
- negative
- latent
- trim_latent
VACE's headline trick was reference-to-video: feed it a character image and a pose-driven control video, and it moves the character the way the control says. That works, but it tends to throw away what was actually in the original footage - lighting, texture, background - because the model just rebuilds everything. This node is the controllable version of that idea. It's a "hybrid subject swap": structural control drives the motion, a character reference pins identity, and optional source-RGB context lets you keep the original luma, detail, and background. Blend them by channel and you get anything from a clean swap to an illustrated-over-live-action composite.
How it works
The mechanism is genuinely a composition, done before anything reaches the VAE. It builds a subject mask from control_masks (feathered by mask_feather_px; no mask means the whole frame is subject), then composes a guidance video structure-first:
- Control structure - your pose/depth control video, scaled by
control_strength. This is the skeleton. - Source luma - the original footage's brightness, added inside the subject region at
source_luma_strength. This is how the swapped subject inherits the scene's actual lighting. - Source detail - high-frequency texture from the source, at
source_detail_strength, so skin/fabric read as the same material. - Background preserve - outside the mask, the source RGB is pushed back in at
background_preserve_strength, so the scene the subject sits in isn't rebuilt from nothing.
All four strengths are normalized against the strongest active channel, so pushing one up doesn't overdrive the whole conditioning. The composite is then encoded as VACE's inactive/reactive control plates with the subject mask as the VACE mask; a reference_image, if given, is prepended as a first frame (that's what trim_latent accounts for).
Inputs and outputs that matter
control_video- the pose/depth driving video (the structural control).reference_image- the character you want to swap in.source_video- the original footage whose lighting/detail/background you want to keep.control_masks(optional) - a subject mask; omit it and the whole frame is treated as subject.- The dials:
source_luma_strength(0.25),source_detail_strength(0.1),background_preserve_strength(0.8),mask_feather_px(8.0).control_strengthandreference_strengthdefault to-1, which mirrors the globalstrength; set them to0to disable a channel.
Read those defaults as the author's hard-won balance: background preservation is high because that's what usually falls apart in swaps, detail is low so you don't bake the source's old subject into the new one. Outputs are positive, negative, latent (into your KSampler) and trim_latent (an INT you feed to the trim step, 1 if a reference image was prepended).
Install
Same pack - ComfyUI Manager, search Sweet Tea Nodes, restart, or clone the repo into custom_nodes; only dependency is tqdm. It needs a Wan model with VACE support plus its VAE. Speed reality check applies here too: VACE 14B runs 15–40 minutes per clip on a 4090 in the knowledge base's accounting, so bring CausVid or a step-distilled LoRA.
Common issues
Experimental flag is on, and this pack has essentially no community footprint yet - you're early, so debug like a pioneer. Grounded gotchas: if identity drifts, raise reference_strength and check that your reference_image is a clean, front-facing frame; if the background wobbles, raise background_preserve_strength or - better - actually provide control_masks so the model knows where the subject boundary is instead of guessing whole-frame; if the swap feels like the source is showing through too much, you've got source_detail_strength or source_luma_strength up too far. This is the node the pack's own test suite exercises most heavily (four public hybrid-subject contracts), which is a decent sign it's the author's real production path, not a toy.
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| width | INT | 83216–16384 | — |
| height | INT | 48016–16384 | — |
| length | INT | 811–16384 | — |
| batch_size | INT | 11–4096 | — |
| strength | FLOAT | 1.000–4 | — |
| control_strength | FLOAT | -1.00-1–4 | — |
| reference_strength | FLOAT | -1.00-1–4 | — |
| source_luma_strength | FLOAT | 0.250–4 | — |
| source_detail_strength | FLOAT | 0.100–4 | — |
| background_preserve_strength | FLOAT | 0.800–4 | — |
| mask_feather_px | FLOAT | 8.00–128 | — |
| control_videoopt | IMAGE | — | |
| source_videoopt | IMAGE | — | |
| control_masksopt | MASK | — | |
| reference_imageopt | IMAGE | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent | LATENT | — |
| trim_latent | INT | — |