MOSS Storyboard Face Swap
The defaults are an 8-step recipe for a LoRA you probably haven't wired
- model
- clip
- vae
- ref
- image
- mask
- image
- report
Here's the trap first, because it costs people an hour every time. The node ships with 8 steps, cfg 1.0, euler, simple - the eight-step distilled recipe. Without the DMD2 distillation LoRA and the Moss-Image-Edit LoRA chained in front of the model, those defaults give you a blurry image of a stranger. The node doesn't check. It just runs.
What this node actually is
It is not a pixel-level swap like Reactor, and it's not an IP-Adapter. It's generative reference editing: the reference photo goes in through the clip input's Qwen3.5 vision tower - the identity channel - and the model redraws the target region with that person in it. So the failure mode differs. A post-process swap transplants pixels and takes whatever you give it; this one re-imagines the face under your prompt, so lighting and pose adapt, and identity is a suggestion rather than a guarantee. The author is blunt about it: "Face Swap is a tool, not a promise." The mental model is the split with its sibling: Paste handles geometry, writing an edited panel back at exact spec coordinates; Face Swap handles identity. Chain them: crop a panel, edit it, swap the face, paste it back.
How it works
With spec connected (from the Storyboard Layout or Sampler node) you feed it the whole board and it crops the index panel itself, 0-based, row-major. That panel is lifted to sample_edge on its long side first: a 4-panel board gives each cell about 0.135 MP, so a face lands at roughly 50×27 pixels and nobody is recognisable. Then it's VAE-encoded, denoised with your prompt plus the reference conditioning, decoded, scaled back and composited. Every other panel and the grid lines stay pixel-identical.
The mask is computed after the crop - the right order, and one that goes silently wrong in a lot of inpainting nodes. auto_mask (default on) runs insightface to find the face; face_pick picks one when a cell has a crowd (largest, left, right). Hand-wire mask and the automatic one stands down.
The numbers that decide the result
denoise is the "how much do I replace" dial, and the arithmetic is counterintuitive. The host truncates sigma by int(steps / denoise), so at 8 steps anything from 0.875 to 0.99 evaluates to 1.0 - you think you asked for a light touch, you asked for a total rewrite. Keep 0.95 for the intended full redraw, or drop to ≤0.875 to preserve source composition. report prints the effective value.
vision_megapixels is the sneaky one. Default 1.05 (~1024×1025) is the measured production value. Drop to the host's own default of 0.147 and identity cosine falls to 0.008 - the reference contributes nothing. Around 0.30 you're in the collapse band where you get a different person; 0.59 (768²) is the stated safe floor. Leave it alone unless you're fighting for VRAM.
prompt has to be in English and has to mention the reference: "A medium shot photograph of the man in Picture 1, sitting at a wooden table in a warm cafe." Don't write the Picture 1: prefix yourself - the node builds it.
Then ref (a tight close-up beats a full-body shot; two viewpoints measured worse than one), steps, cfg, and optional sample_edge, negative (dead at cfg 1.0 - the host skips that branch), width/height (empty-latent path only).
Outputs
image is the composited board or single image - to SaveImage, or to the Paste node at scale. report gives the geometry source, the real denoise value, and how many faces were detected and which was used. Swapped the wrong person? That line is the first place to look.
Install and dependencies
Manager, search MOSS Storyboard, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/ZenHG/ComfyUI-MOSS-Storyboard
Core deps are zero. Automatic masking is the exception: insightface and onnxruntime, plus det_10g.onnx in ~/.insightface/models/buffalo_l/ (or wherever MOSS_INSIGHTFACE_ROOT points). The node never downloads weights - it raises a clear error and waits. If insightface won't install, wire a mask by hand or turn auto_mask off.
The three MOSS files: moss_image_sft_bf16.safetensors in models/diffusion_models/, the Qwen3.5 encoder in models/text_encoders/ (CLIPLoader type moss_image), flux2-vae.safetensors in models/vae/.
One licensing footnote: InsightFace's face models are non-commercial, and auto-mask inherits that. For paid work, hand-paint the mask - which you wanted anyway, since a hard edge seams.
Where it bites
Two errors worth knowing: init=source 需要 image (source unconnected) and 解码尺寸 ... 小于布局下限 2048x1152 (input smaller than the board you're compositing into). Want "reference face + prompt → one posed image"? Set init to empty - that skips the source, along with denoise, sample_edge, auto_mask, face_pick and index.
Inputs (23)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | 【接线】MOSS-Image 模型。产线配方:先接 8 步 DMD2 蒸馏 LoRA,再接 Moss-Image-Edit 编辑 LoRA。 | |
| clip | CLIP | 【接线】CLIPLoader,type 必须是 moss_image。 参考图就是从这里进 Qwen3.5 vision tower 的。 | |
| vae | VAE | 【接线】FLUX.2 VAE。源图要它编码成 latent(图生图),结果也要它解码。 | |
| ref | IMAGE | 【接线】身份参考图,**紧特写**最好(脸占画幅越大越好)。 ⚠ 只给一张:实测双视角比单张更差(0.384 vs 0.463,视觉 token 被摊薄)。 | |
| prompt | STRING | 【填什么】重画时用的场景描述,**用英文写**,并且要提到参考图,例如: A medium shot photograph of the man in Picture 1, sitting at a wooden table in a warm cafe, soft warm light on his face. ⚠ 不要自己写 `Picture 1:` 前缀,节点会自动拼。 | |
| steps | INT | 81–200 | 【填什么】默认 8 = 8 步 DMD2 蒸馏 LoRA 的口径。 没接蒸馏 LoRA 时按模型卡 50 步。 |
| cfg | FLOAT | 1.00–30 | 【填什么】默认 1.0 = 蒸馏档。cfg=1.0 时宿主跳过负面分支,负面提示词填了也不生效。 |
| sampler_name | COMBO | euler | 【填什么】默认 euler = 实测配方。 |
| scheduler | COMBO | simple | 【填什么】默认 simple = 实测配方(8 步档)。 |
| seed | INT | 00–4294967295 | 【填什么】随机种。同种子同参数才可复现。 |
| denoise | FLOAT | 0.950.05–1 | 【填什么】降噪强度。这是「换多少」的总闸: · 0.95(默认)= 实测配方,**8 步下等价于 1.0**:源图被完全丢弃,构图由提示词决定,身份由参考图决定。 · ≤0.875 才真的保住源图构图(8 步时 0.875 是分水岭:int(8/0.875)=9>8 才触发 img2img)。 ⚠ 宿主按 int(步数/降噪) 截断 sigma,所以 0.875~0.99 之间在 8 步下**全部等于 1.0**。report 会打印真实生效值。 |
| vision_megapixels | FLOAT | 1.050–4 | 【填什么】每张参考图进 vision tower 前的像素预算。 · 1.05(默认)= 实测产线值,约 1024×1025 · 0 = 原生分辨率,不缩放 · 0.59 = 768²,实测安全线 ⚠ 0.147 是宿主默认值,那个值下身份余弦只有 0.008;0.30 会**变成另一个人**(塌陷带)。 |
| imageopt | IMAGE | 【接线】要换脸的图。接了 spec 时给**整张宫格**,节点自己裁第 index 格;不接 spec 就当单格处理。 ⚠ `init=source` 时**必填**;`init=empty` 时不用接。 | |
| specopt | STRING | 【接线】接 Layout/Sampler 的 spec:给整张宫格 + index,只换那一格。 不接就按单格处理(整张 image 当成一张图)。 `init=empty` 时若接了它,画布用 spec 的整张宫格。 | |
| indexopt | INT | 00–143 | 【接了 spec 时生效】换第几格,**0 起、行主序**。 |
| sample_edgeopt | INT | 10240–2048 | 【可留 1024】单格抬到多长边再采样,采样完缩回格子。 4 格 496 长边时一格只有 0.135MP,脸约 50×27 像素——那个尺度认不出是谁。 0 = 不抬(严格按格子尺寸采样,最省显存)。 |
| negativeopt | STRING | 【可选】负面提示词。默认 cfg=1.0 时宿主跳过负面分支,填了也不生效。 | |
| auto_maskopt | BOOLEAN | true | 【默认开】用 insightface 自动找脸并生成蒙版,不需要手画。 ⚠ 需要 `pip install insightface onnxruntime`;没装会明确报错。 接了 `mask` 就以手接的为准(自动让位)。 |
| face_pickopt | COMBO | largest | 【换哪一张脸】一格里有好几个人时用这个点名: largest = 面积最大那张;left / right = 最左 / 最右那张。 report 会写「检测到 N 张脸,用了哪张」,换错人先看这行。 |
| maskopt | MASK | 【接线,强烈建议】只重画蒙版内的区域,蒙版外**逐像素保留**。 ⚠ 不接 = 整格重画:整张图的影调会被重算,**画风与色调一定变**(实测同一张图,仅换提示词,R 通道偏移 +24~+43)。 蒙版可以直接给整张宫格的,节点会按 spec 裁到目标格;带羽化更好,硬边会看到接缝。 | |
| initopt | COMBO | source | 【从哪开始】换脸 / 生成是同一件事的两个特例,差别只有这一个旋钮: · source(默认)= 吃 `image`,图生图。有蒙版就只重画蒙版内(换脸)。 · empty = **不吃 `image`**,从空 latent 开始,全图由提示词 + 参考图生成。 这就是「参考图 → 一张带指定动作的图」那条路。 ⚠ empty 下 denoise / sample_edge / auto_mask / face_pick / index 都不生效,report 会写明。 |
| widthopt | INT | 102464–2048 | 【只在 init=empty 且没接 spec 时生效】画布宽,必须是 16 的倍数。 接了 spec 时画布由 spec 决定,这两个值被忽略。 |
| heightopt | INT | 57664–2048 | 【只在 init=empty 且没接 spec 时生效】画布高,必须是 16 的倍数。 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| report | STRING | — |