Nodes/CMK Flow/CMK Flow · 02 Regional Conditioning SDXL
ComfyUI Node

CMK Flow · 02 Regional Conditioning SDXL

Two characters, one prompt, and the hair colour that keeps swapping

By CMKFlow·Created 3 months ago·Updated a day ago· 6
CMK Flow · 02 Regional Conditioning SDXL
  • PROCESS
  • IMAGE
  • LOG
  • VISUAL
  • PROCESS SDXL
  • IMAGE
  • LOG
  • VISUAL
  • diagnostic
◄region_1_positionLEFT►
◄region_1_sizeMEDIUM►
◄region_1_x0.00►
◄region_1_y0.25►
◄region_1_width0.50►
◄region_1_height0.50►
◄region_1_end1.00►
◄region_1_area_prompt►
◄region_1_strength1.00►
◄region_2_positionCENTER►
◄region_2_sizeMEDIUM►
◄region_2_x0.25►
◄region_2_y0.25►
◄region_2_width0.50►
◄region_2_height0.50►
◄region_2_end1.00►
◄region_2_area_prompt►
◄region_2_strength1.00►
◄region_3_positionRIGHT►
◄region_3_sizeMEDIUM►
◄region_3_x0.50►
◄region_3_y0.25►
◄region_3_width0.50►
◄region_3_height0.50►
◄region_3_end1.00►
◄region_3_area_prompt►
◄region_3_strength1.00►

Regional prompting is the standing answer to attribute bleeding: the girl on the left has red hair, the one on the right has blue, and a single prompt reliably swaps them. Conditioning applies to the whole canvas, so you split the canvas and give each area its own prompt. This node is the CMK Flow step 02 that registers up to three regions on the SDXL process before ControlNet and sampling ever run.

It stores the regions; the sampler does the work

If you open the source expecting attention coupling, you'll be disappointed in a good way. CMK Flow · 02 Regional Conditioning SDXL writes region dictionaries into the PROCESS pipe - prompt text, normalised geometry, strength, and a timestep window - and passes IMAGE straight through. The encoding happens later, inside CMK Sampler Prepare SDXL -Pipe-, which walks the region list and, for each one, encodes the area prompt with CLIP, wraps it in ConditioningSetAreaPercentage, clamps it with ConditioningSetTimestepRange, and ConditioningCombines it into the positive conditioning.

That's why the node's own docstring says it "deliberately does not encode text". It means region prompts inherit the CLIP and clip-skip settings of the module that samples, instead of having their own half-configured encoder. It also means a region you leave blank simply doesn't exist: empty area_prompt = skipped, no detection, no wasted work.

The handful of fields that matter

Each region block repeats the same nine settings. You'll set three of them and leave the rest.

  • region_N_area_prompt - the text for that area. This is the on switch. Nothing else in the block does anything until it has content.
  • region_N_position - TOP LEFT … BOTTOM RIGHT plus CENTER, or CUSTOM. Position and region_N_size (SMALL / MEDIUM / LARGE, i.e. 33 / 50 / 67% of the canvas) generate symmetric geometry for you. Pick CUSTOM and the x, y, width, height fields take over, all normalised 0–1.
  • region_N_end - how long into sampling this region keeps influencing the result, tooltipped as "how long this regional conditioning may influence sampling." This is the one people miss and it's the honest fix for the collaged-with-seams look: hold the mask through the composition phase, then blend back to base conditioning for the tail of the pass.

region_N_strength maps to ConditioningSetAreaPercentage's strength. Leave it at 1 unless a region is losing a fight with the main prompt.

Outputs are PROCESS, IMAGE, LOG, VISUAL and diagnostic. The IMAGE pass-through is the convenient part: the module sits inline in the generation chain, so you can drop it between 01 and 05 without re-routing anything. VISUAL accumulates into the Visualizer's provider chain.

Installation

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

Or via ComfyUI Manager - search CMK Flow, install the CMKFlow entry, restart, then run scripts/check_cmk_resources.py for weights. CMK needs the Vue Nodes / Nodes 2.0 setting on; without it dynamic nodes drop back to the LiteGraph look and the position/size dropdowns don't behave.

Gotchas worth knowing before you blame the model

The regions chain rather than replace. The node reads any existing region list off PROCESS and appends, and its log prints both ACTIVE REGIONS and TOTAL CHAINED - so two 02 nodes in one graph means up to six regions, not three. If your composition is fighting itself, that's usually why.

The other thing is scope: this is positional conditioning, not segmentation. Regions are rectangles over the latent, which is fine for "sky up there, water down there" and fights you when the subject is a person who ignores your rectangle. Give regions short, concrete prompts. red hair, freckles works better than a paragraph, because the region prompt is appended to the global one rather than replacing it. And it's SDXL-only by socket type - the process sockets are CMK_PROCESS_SDXL, so ComfyUI simply won't let you wire this into a Z-Image Turbo chain.

CategoryCMK/Flow/Conditioning

Inputs (31)

NameTypeDefaultDescription
PROCESSCMK_PROCESS_SDXL—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
region_1_positionCOMBOLEFT10 options: TOP LEFT, TOP, TOP RIGHT, LEFT, CENTER, RIGHT, +4
region_1_sizeCOMBOMEDIUM3 options: SMALL, MEDIUM, LARGE
region_1_xFLOAT0.000–1—
region_1_yFLOAT0.250–1—
region_1_widthFLOAT0.500.01–1—
region_1_heightFLOAT0.500.01–1—
region_1_endFLOAT1.000–1How long this regional conditioning may influence sampling.
region_1_area_promptSTRING—
region_1_strengthFLOAT1.000–2—
region_2_positionCOMBOCENTER10 options: TOP LEFT, TOP, TOP RIGHT, LEFT, CENTER, RIGHT, +4
region_2_sizeCOMBOMEDIUM3 options: SMALL, MEDIUM, LARGE
region_2_xFLOAT0.250–1—
region_2_yFLOAT0.250–1—
region_2_widthFLOAT0.500.01–1—
region_2_heightFLOAT0.500.01–1—
region_2_endFLOAT1.000–1How long this regional conditioning may influence sampling.
region_2_area_promptSTRING—
region_2_strengthFLOAT1.000–2—
region_3_positionCOMBORIGHT10 options: TOP LEFT, TOP, TOP RIGHT, LEFT, CENTER, RIGHT, +4
region_3_sizeCOMBOMEDIUM3 options: SMALL, MEDIUM, LARGE
region_3_xFLOAT0.500–1—
region_3_yFLOAT0.250–1—
region_3_widthFLOAT0.500.01–1—
region_3_heightFLOAT0.500.01–1—
region_3_endFLOAT1.000–1How long this regional conditioning may influence sampling.
region_3_area_promptSTRING—
region_3_strengthFLOAT1.000–2—
VISUALoptCMK_VISUAL_PIPE—

Outputs (5)

NameTypeDescription
PROCESS SDXLCMK_PROCESS_SDXL—
IMAGEIMAGE—
LOGCMK_LOG_PIPE—
VISUALCMK_VISUAL_PIPE—
diagnosticCMK_DIAGNOSTIC—