Nodes/Nukun_ComfyUI_Nodes/Native Regional Rect Conditioning (Nukun)
ComfyUI Node

Native Regional Rect Conditioning (Nukun)

Regional prompting without another dependency tree

By OnekoSL·Created 3 months ago·Updated 11 days ago· 1
Native Regional Rect Conditioning (Nukun)
  • conditioning_1
  • conditioning_2
  • conditioning_3
  • conditioning
  • mask_1
  • mask_2
  • mask_3
width1024
height1024
region_count3
x_10.00
y_10.00
w_10.35
h_11.00
x_20.35
y_20.00
w_20.30
h_21.00
x_30.65
y_30.00
w_30.35
h_31.00
soft_edge0
strength_11.00
strength_21.00
strength_31.00
set_cond_area

Regional prompting - different prompts for different parts of the frame - is one of those things every ComfyUI user eventually wants and few want to set up. The classic path drags in DenseDiffusion or a regional-conditioning pack with its own model patching and its own failure modes. This node takes the other route: it builds your rectangular masks and applies them to per-region conditionings using only ComfyUI's core ConditioningSetMask metadata. No model patch, no extra dependency, no reason to trust a third-party patcher with your UNet.

That's the pitch, and it's genuinely the right tool when your regions are rectangles and you're on an SDXL-lineage model (Pony v6, Illustrious, or anything booru-trained) where regional conditioning has a long track record of working well. If your regions are wonky shapes, you want a mask-based approach - but for split-screen or panel-style layouts, rectangles are what you'd draw anyway.

How it works

You feed in up to three already-encoded conditionings, plus a width and height. Each region has x, y, w, h controls in the 0.0–1.0 range - percentages of the canvas, not pixels, so a w_1 of 0.35 means "left 35% of the image." The node builds three masks, applies each mask to its conditioning with the region's strength_1..3 as mask_strength, and returns one combined conditioning for the sampler's positive path.

The default layout is three full-height columns: left 35%, middle 30%, right 35%. That's a sensible starting point for a triptych; change h_1 etc. to 0.5 and you're doing a 2x2 grid instead.

Two settings matter more than the rest:

  • soft_edge - blurs the rectangle edges (0–256 px). Rectangles without soft edges leave visible boundaries on some samplers; a value around 16–32 hides them on Pony-class models. Your mileage varies, which is why the mask preview outputs exist.
  • set_cond_area - default conditions the whole masked area; mask bounds shrinks the conditioning to the mask's bounding box. mask bounds is often crisper for tight regions, at the cost of a harsher cut.

Inputs and outputs

Required: conditioning_1, conditioning_2 (plus conditioning_3 if region_count is 3), width, height, region_count, and the twelve rect coordinates. Outputs: one combined conditioning, plus mask_1..3 so you can preview exactly what you're telling the model. Wire conditioning into your KSampler's positive slot and you're done - that's the whole integration story.

Installing it

Standard pack install, nothing special:

cd ComfyUI/custom_nodes
git clone https://github.com/OnekoSL/Nukun_ComfyUI_Nodes.git

Restart ComfyUI after cloning, or use ComfyUI Manager (search "Nukun"). No companion packages required - this is the whole point of the "Native" naming. One nice touch: the node ships a browser-side rectangle editor, so you can drag the region boxes on a canvas instead of typing coordinates. Right-click the node and look for the rectangle editor option.

Common issues

The most common mistake is leaving region_count at 3 and forgetting to connect conditioning_3 - the node raises a clear error for that, which is friendlier than most. Next: regions that don't add up to a full canvas. Unlike the DenseDiffusion variant, uncovered pixels here are just… uncondensed. That's fine with a strong base prompt, but if you see washed-out or empty areas, either cover the canvas or accept that you're effectively doing inpainting-style masked generation. And if your layout has overlapping rects, the later region wins in the overlap - order matters.

CategoryNukun/Conditioning

Inputs (23)

NameTypeDefaultDescription
conditioning_1CONDITIONING
conditioning_2CONDITIONING
widthINT10248–16384
heightINT10248–16384
region_countINT32–3
x_1FLOAT0.000–1
y_1FLOAT0.000–1
w_1FLOAT0.350–1
h_1FLOAT1.000–1
x_2FLOAT0.350–1
y_2FLOAT0.000–1
w_2FLOAT0.300–1
h_2FLOAT1.000–1
x_3FLOAT0.650–1
y_3FLOAT0.000–1
w_3FLOAT0.350–1
h_3FLOAT1.000–1
soft_edgeINT00–256
strength_1FLOAT1.000–10
strength_2FLOAT1.000–10
strength_3FLOAT1.000–10
set_cond_areaCOMBO2 options: default, mask bounds
conditioning_3optCONDITIONING

Outputs (4)

NameTypeDescription
conditioningCONDITIONING
mask_1MASK
mask_2MASK
mask_3MASK