Nodes/CMK Flow/CMK FaceRebuild SDXL · Advanced
ComfyUI Node

CMK FaceRebuild SDXL · Advanced

Three faces, three identities, one node

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK FaceRebuild SDXL · Advanced
  • MODEL
  • PROCESS
  • IMAGE
  • LOG
  • SOURCE FACE 1
  • SOURCE FACE 2
  • SOURCE FACE 3
  • VISUAL
  • MODEL
  • PROCESS
  • IMAGE
  • LOG
  • VISUAL
  • diagnostic
◄FACEREBUILD ENABLEtrue►
◄FACE 1 ENABLEtrue►
◄TARGET FACE 1Leftmost►
◄PASTEBACK NECK 1false►
◄SAMPLING START 10►
◄IDENTITY STRENGTH 11.00►
◄POSE STRENGTH 10.70►
◄FACE 2 ENABLEfalse►
◄TARGET FACE 2Center►
◄PASTEBACK NECK 2false►
◄SAMPLING START 20►
◄IDENTITY STRENGTH 21.00►
◄POSE STRENGTH 20.70►
◄FACE 3 ENABLEfalse►
◄TARGET FACE 3Rightmost►
◄PASTEBACK NECK 3false►
◄SAMPLING START 30►
◄IDENTITY STRENGTH 31.00►
◄POSE STRENGTH 30.70►
◄TOTAL STEPS20►
◄HEAD AREA0.75►
◄NECK AREA0.40►
◄MASK FEATHER32►
◄WORKING RESOLUTION1024►
◄DETECT MODELbuffalo_l►
◄DETECT SIZE640►
◄instantid_model▾►
◄controlnet_model▾►
◄providerCoreML►
◄cfg4.5►
◄identity_noise0.75►
◄samplereuler_ancestral►
◄schedulerkarras►
◄_cmk_content_guard_enabledtrue►

Two people in frame, and you only want one of them to become your reference person. Or three people, and you want a different reference on each. CMK FaceRebuild SDXL · Advanced is the version of the FaceRebuild executor that does exactly that: up to three slots, each with its own target face, its own source image, and its own strength values, executed in sequence by a single node.

The community has wanted this shape for years, for a specific reason. Detailing a group shot with a single identity produces clones - the same base-seed re-render applied region by region converges on one person. Slots let you say "leftmost gets reference A, rightmost gets reference B."

The slots

Each of FACE 1, FACE 2, FACE 3 has the same little block of settings:

  • ENABLE - off by default except for slot 1. Inactive slots are ignored completely.
  • TARGET FACE - which detected person this slot rebuilds: Largest, Leftmost, Rightmost, Topmost, Bottommost, Center. Three slots ship pre-seeded with Leftmost, Center, Rightmost, which is the sensible default for a group.
  • SOURCE FACE - the reference face image for that slot. Each slot can point at a different person.
  • IDENTITY STRENGTH (1.0) / POSE STRENGTH (0.7) - per slot.
  • SAMPLING START (−2 … +2, default 0). Tooltip: SOURCE (-2) to TARGET (+2). It's a relative position, not an absolute step: the code takes half of TOTAL STEPS as neutral and offsets from there, then clamps into range. Negative pushes the re-render earlier so more anatomical change is allowed; positive holds the existing layout.
  • PASTEBACK NECK - whether the generated neck ellipse makes it into the final composite.

Shared below the slots: TOTAL STEPS (20), HEAD AREA (0.75), NECK AREA (0.4), MASK FEATHER (32), WORKING RESOLUTION (768/1024/1280), DETECT MODEL and DETECT SIZE, and the InstantID stack - instantid_model, controlnet_model, provider (default CoreML), cfg (4.5), identity_noise (0.75), sampler, scheduler.

Wiring: MODEL, PROCESS, IMAGE, LOG in; MODEL, PROCESS, IMAGE, LOG, VISUAL, diagnostic out. VISUAL is optional on the input side and feeds the pack's central VISUAL chain so each rebuild stage can show up in the CMK Visualizer.

How it runs

Slots are resolved against the unmodified target: it detects once, maps each selector to an actual face box, then sorts the active slots largest-face-first. Then, one at a time, it crops, samples with InstantID, and pastes back into the working image, so slot 2 sees the result of slot 1. Results are cached internally against the resolved input signature, so a re-run that changes nothing doesn't redo all three passes.

Two behaviours worth knowing:

  • Duplicate targets are a hard error. If two active slots resolve to the same detected face you get "two active slots resolve to the same target face; choose a different TARGET FACE in one of those slots." Good error, but it's the one that bites when a selector lands on a face you didn't expect.
  • The experimental landmark shape warp is suspended here. The engine has code for deforming the target geometry toward dense source landmarks, and Prepare exposes it, but this node deliberately passes SHAPE STRENGTH = 0.0. Don't expect the tooltip language about SOURCE/TARGET to mean geometry transfer in Advanced - it's sampling position.

Install and requirements

cd ComfyUI
git clone https://github.com/CMKFlow/cmk_nodes.git custom_nodes/cmk_nodes
python3 custom_nodes/cmk_nodes/scripts/install_cmk_requirements.py

Manager: search CMK Flow (cmk-flow), then restart. Turn on Vue Nodes / Nodes 2.0 - with 30-odd widgets on this node you want the frontend that handles automatic sizing and advanced folding.

Budget the cost honestly: three slots means three InstantID sampling passes plus detection. On a 12GB card, keep total steps low and expect this to be the slow node in the graph. InstantID itself is SDXL-only and its reference repo has been dormant since mid-2024 - on anything past SDXL this whole family is the wrong tool.

CategoryCMK/Flow/Face

Inputs (42)

NameTypeDefaultDescription
MODELCMK_MODEL_PIPE—
PROCESSCMK_RESULT_PROCESS—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
FACEREBUILD ENABLEBOOLEANtrue—
FACE 1 ENABLEBOOLEANtrue—
TARGET FACE 1COMBOLeftmost6 options: Largest, Leftmost, Rightmost, Topmost, Bottommost, Center
SOURCE FACE 1IMAGE—
PASTEBACK NECK 1BOOLEANfalse—
SAMPLING START 1INT0-2–2SOURCE (-2) to TARGET (+2). Zero selects the face-size balance automatically.
IDENTITY STRENGTH 1FLOAT1.000–1—
POSE STRENGTH 1FLOAT0.700–1—
FACE 2 ENABLEBOOLEANfalse—
TARGET FACE 2COMBOCenter6 options: Largest, Leftmost, Rightmost, Topmost, Bottommost, Center
SOURCE FACE 2IMAGE—
PASTEBACK NECK 2BOOLEANfalse—
SAMPLING START 2INT0-2–2SOURCE (-2) to TARGET (+2). Zero selects the face-size balance automatically.
IDENTITY STRENGTH 2FLOAT1.000–1—
POSE STRENGTH 2FLOAT0.700–1—
FACE 3 ENABLEBOOLEANfalse—
TARGET FACE 3COMBORightmost6 options: Largest, Leftmost, Rightmost, Topmost, Bottommost, Center
SOURCE FACE 3IMAGE—
PASTEBACK NECK 3BOOLEANfalse—
SAMPLING START 3INT0-2–2SOURCE (-2) to TARGET (+2). Zero selects the face-size balance automatically.
IDENTITY STRENGTH 3FLOAT1.000–1—
POSE STRENGTH 3FLOAT0.700–1—
TOTAL STEPSINT201–200—
HEAD AREAFLOAT0.750–2—
NECK AREAFLOAT0.400–2—
MASK FEATHERINT320–64—
WORKING RESOLUTIONCOMBO10243 options: 768, 1024, 1280
DETECT MODELCOMBObuffalo_l1 options: buffalo_l
DETECT SIZEINT640128–1280—
instantid_modelCOMBO1 options:
controlnet_modelCOMBO1 options:
providerCOMBOCoreML4 options: CoreML, CPU, CUDA, ROCM
cfgFLOAT4.50–10—
identity_noiseFLOAT0.750–1—
samplerCOMBOeuler_ancestral44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBOkarras9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
VISUALoptCMK_VISUAL_PIPE—
_cmk_content_guard_enabledoptBOOLEANtrue—

Outputs (6)

NameTypeDescription
MODELCMK_MODEL_PIPE—
PROCESSCMK_RESULT_PROCESS—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
VISUALCMK_VISUAL_PIPE—
diagnosticCMK_DIAGNOSTIC—