Nodes/ComfyUI-MagicDance/Magic Dance Encoder
ComfyUI Node

Magic Dance Encoder

How MagicDance locks in your identity

By bombax-xiaoice·Created 2 years ago·Updated 2 years ago· 2
Magic Dance Encoder
  • pipe
  • image
  • reference

MagicDanceEncoder is the smallest node in the pack and the one that decides whether the person in your output is actually your person. It takes your single reference photo, runs it through the SD 1.5 VAE, and hands the resulting latent to the sampler, which uses it to hold the appearance constant while the pose sequence drives the motion. No encoder, no identity - you'd just get some random person hitting the poses.

The pack is a ComfyUI port of MagicPose (USC + ByteDance, Nov 2023), the research model for pose-driven human animation. The "one reference image only" rule isn't a bug or a missing feature - it's the design. MagicDance keeps identity via that single image_control branch in the sampler; there's no face-embedding or multi-view system, and the model was trained exactly this way. So the encoder takes exactly one image, and the whole workflow is built around that.

How it works

It's a standard VAE encode with a small twist. The code normalizes the image to the -1..1 range, moves the VAE encoder onto the right device and dtype (so it cooperates with ComfyUI's low-VRAM offloading), runs encode_first_stage, and then puts the VAE encoder back where it came from - that shuffle is the pack playing nice on an 8GB card, which the README confirms is the minimum sane target. The output is a reference latent you thread straight into MagicDanceSampler alongside your poses.

Inputs and output

  • pipe - the MAGICDANCEPIPE from LoadMagicDanceModel.
  • image - your reference photo. One image. Feed it a batch and it'll quietly encode just the first frame.

Output is reference, a LATENT.

One sizing note that bites people: the sampler requires its starting latents to match the reference image's dimensions, and there should be as many of them as you have poses. So pick a reference at the resolution you actually want (SD 1.5-friendly, say 512–768 on the long side) and build your EmptyLatentImage from it - don't upscale a tiny reference and expect magic.

Installing and gotchas

Install via ComfyUI Manager (search "ComfyUI-MagicDance") or:

cd ComfyUI/custom_nodes
git clone https://github.com/bombax-xiaoice/ComfyUI-MagicDance
pip install -r ComfyUI-MagicDance/requirements.txt

Then restart. The shared pack traps apply here too: the folder must stay ComfyUI-MagicDance or the imports break, the ~2.3GB checkpoint downloads on the loader's first run, and requirements.txt is a giant flattened list - if something like triton or xformers won't build, skipping it usually works since ComfyUI brings its own. A last tip from experience: a clean, front-facing reference with your face and outfit in frame gives the appearance branch the most to hold onto. Wild angles or heavy motion blur in the reference and the identity drifts by frame 20.

CategoryMagicDance

Inputs (2)

NameTypeDefaultDescription
pipeMAGICDANCEPIPE
imageIMAGE

Outputs (1)

NameTypeDescription
referenceLATENT