Mastering ComfyUI — Part 5: Advanced Conditioning
Move past single-subject generation into techniques that give you real control over composition — regional conditioning, distinct-pose composition, two-pass inpainting compositing, and ControlNet structural guidance.
Goal for this part: move past single-subject, single-pass generation into the techniques that actually give you control over composition — multiple subjects, precise edits to existing images, and pose/structure guidance.
Previous: Part 4 — LoRAs & Model Customization
Prerequisite: comfortable with the six-node core workflow from Part 3. Everything here inserts into or extends that skeleton.
The problem these techniques solve
A plain text prompt gives the model a bag of concepts and hopes it arranges them sensibly. That works fine for one clear subject. It breaks down fast the moment you want two or more distinct subjects, precise placement, or a specific existing image edited rather than regenerated from scratch — because CLIP text encoding has no real concept of spatial layout. It blends every token's meaning across the entire image rather than understanding "this concept goes on the left, that one goes on the right."
Everything in this part is a way of giving the model more explicit spatial or structural control than plain text alone provides. A common concrete example is composing a scene with several people in it — a group portrait, a couple of characters in an illustration — where plain prompting tends to blur their distinct features together.
Technique 1 — Regional conditioning (partial fix)
Nodes: Conditioning (Set Area), Conditioning (Combine)
The idea: encode each subject's prompt separately, then tell each one which pixel region of the canvas it should influence, before merging everything into one conditioning that feeds KSampler.
Setup:
- One
CLIP Text Encodeper subject, each with its own concrete visual description - Each subject's
CONDITIONINGoutput → its ownConditioning (Set Area)node, where you setwidth,height,x,yto define its region, andstrength(default1.0) for how strongly it applies - Chain the results through
Conditioning (Combine)nodes (each one merges two inputs, so chain multiple if you have more than two subjects), along with an unrestricted "base/scene" conditioning covering the whole canvas - Final combined output → KSampler's
positive
Two rules that matter more than they seem:
- Match each region's
heightto your full canvas height whenever your canvas size changes — a mismatch here means only part of the vertical frame gets subject-specific reinforcement, and the rest renders generically. - Overlap regions slightly (10–25%) instead of splitting the canvas with a hard boundary. A clean seam tends to produce an awkward gap or visible dividing line between subjects.
This is a soft nudge, not a hard constraint. Set Area biases which attributes show up in a region — it doesn't guarantee two separate figures actually exist there. The base, unrestricted conditioning can still let the sampler commit to a single-figure composition during early denoising steps, before region-specific conditioning has much influence. For two visually similar subjects with no pose differentiation, this technique can still produce one hybrid figure carrying both subjects' attributes rather than two distinct ones. That's a real ceiling of the technique, not a sign you configured it wrong.
Technique 2 — Distinct poses (often better than regional conditioning)
Before reaching for the node-based fixes above, consider whether your composition itself gives the model enough to work with. Subjects in visibly different poses or positions relative to each other separate far more reliably than subjects in similar, symmetric poses — "two figures standing side by side" is prone to merging, while "one figure seated at the center, a second standing behind them, a third off to one side" gives the model strong distinct spatial anchors and tends to compose correctly with plain prompting, no extra nodes required.
This is worth trying first, before regional conditioning — it's free, and it sidesteps the technique's actual limitations rather than fighting them.
Technique 3 — Two-pass inpainting compositing (the reliable fallback)
Nodes: Load Image, Mask Editor (built into the image viewer), VAE Encode (for Inpainting)
When regional conditioning genuinely isn't enough — usually for multiple visually-similar subjects with no natural pose differentiation — generate and composite in two passes instead:
- Generate your first subject alone, biased toward one side of the frame (add something like "standing on left side of frame" to the prompt).
- Load that output back in with a
Load Imagenode. Right-click its thumbnail → Open in MaskEditor, and paint over the empty region where your second subject should appear. - Feed the image and mask into
VAE Encode (for Inpainting), along with your checkpoint'sVAE. - Wire its
LATENToutput to KSampler'slatent_image, switchpositiveto your second subject's prompt, and setdenoisearound0.9–0.95. - Run — the masked region regenerates with your second subject; everything else stays untouched.
This guarantees separation because you're explicitly directing where new content goes rather than hoping conditioning math keeps two subjects apart.
Inpainted region doesn't change at all. Almost always an empty mask, even
when every wire is correct. Temporarily connect your Load Image node's MASK
output to a Preview Image node — a mask renders as black-and-white, and solid
black means nothing is actually marked for inpainting. If it's blank, the mask
editor save didn't take, or the wrong source image got reselected afterward
(easy to do if you reopen the Load Image dropdown and pick the plain original
file instead of the mask-painted version that has your paint baked in) —
repaint and reconfirm before rewiring.
Positive prompt seems ignored even after switching it. In a graph with
leftover nodes from an earlier regional-conditioning attempt, double-check
KSampler's positive input is actually wired to the node you think it is, not
looping back through an old Combine chain still sitting in the graph. When in
doubt, delete unused legacy nodes entirely rather than leaving them connected
to nothing — a dangling but still-wired old path is a common source of "I
changed it but nothing happened."
Technique 4 — ControlNet (structural guidance)
ControlNet is a separate, complementary model that conditions generation on a structural input — a pose skeleton, a depth map, an edge outline — rather than text. If you need subjects in an exact physical arrangement (specific poses, specific distance apart, specific camera angle) that prompting alone can't reliably produce, ControlNet with an OpenPose skeleton is the most direct route: feed it a reference pose (drawn, extracted from a reference image, or posed manually with a skeleton-editing tool), and the sampler treats that structure as a hard constraint rather than a suggestion.
Setting up ControlNet requires: a ControlNet model file (separate download,
matched to your base checkpoint's architecture — SDXL ControlNets don't work
with Flux and vice versa), a preprocessor node (to extract the pose/depth/edges
from a reference image, if you're not supplying a pre-made control image
directly), and a ControlNetApply node inserted into your conditioning chain.
This is genuinely more setup than the techniques above, and worth reaching for
specifically when composition/pose accuracy matters more than anything else in
the shot.
Next: Part 6 — Upscaling & Post-Processing.
Previous: Part 4 — LoRAs & Model Customization