Nodes/ComfyUI_RP_Cast/RP KSampler (SDXL)
ComfyUI Node

RP KSampler (SDXL)

Where regional conditioning actually happens in SDXL

By AISeDam·Created 4 months ago·Updated 4 months ago· 4
RP KSampler (SDXL)
  • model
  • clip
  • vae
  • regional_prompts_nolora
  • regional_col_n_row
  • regional_lora_map
  • negative
  • threshold
  • latent_image
  • divide_mode
  • latent
  • image
seed0
steps20
cfg7.0
sampler_name
scheduler
denoise1.00
use_basefalse
use_commontrue
base_ratio0.2
steps_add_per_div0
cfg_add_per_div0.0
lora_weight_adj0
debugfalse

The real engine

RP Prompt Parser prepares the text; this node is where the regional magic happens. RP KSampler (SDXL) is a drop-in KSampler replacement for SDXL and SD 1.x that encodes each region's prompt as its own conditioning area and blends them during sampling. For SDXL workflows in this pack it replaces the normal KSampler entirely - checkpoint and EmptyLatentImage feed in, and you get a latent plus a preview image out.

How the blending works

Under the hood it uses ComfyUI's area conditioning: each column prompt applies only to its rectangle of the canvas (from divide_ratio), the base prompt fills the whole frame, and the two are mixed by base_ratio. A base_ratio of 0.2 means 20% base + 80% region; 0.2,0.3,0.5 gives per-region control. The common prompt is pre-merged into every region's encoding exactly once, so it shows up everywhere without doubling.

The inputs that matter

  • use_base: must match what you set on RPPromptParser, or regions mis-map.
  • use_common: applies the COMMON text to all regions - leave on.
  • base_ratio: the big creative dial, 0.2 default.
  • threshold: connect threshold_out from RPRatioParser; this is the end-step ratio that lets regions relax back into the base composition.
  • steps_add_per_div / cfg_add_per_div: extra steps or CFG per region (total = steps + n_div × steps_add_per_div). Both default to 0, a no-op - reach for them when a 3-4 region grid needs more time to resolve.
  • lora_weight_adj: multiplier for the combined LoRA weight, 100 = unchanged, 50 = half, 200 = double.

Here's a trap worth calling out: lora_weight_adj defaults to 0, which disables LoRAs entirely. If you wire a LoRA through the parser and see zero effect, this is almost certainly why - set it to 100.

Outputs

latent (LATENT) → VAE decode or upscale; image (IMAGE) is a convenience preview. Wire the latent into the detailer or a VAE Decode and you're done.

The honest trap: per-region LoRAs

The README is admirably straight about this: ComfyUI can't safely hot-swap LoRA weights mid-sample, so all region LoRAs get averaged into a single shared model applied to the whole image. Your "blonde on the left" and "dark hair on the right" LoRAs blend globally - use lora_weight_adj to scale the combined weight, but don't expect isolation here. True per-region character reinforcement happens at the detailer stage, where each YOLO-detected person is inpainted with their own prompt and LoRA.

Common issues

  • Smeared or bleeding characters → base_ratio too high or too low; try 0.20.3, or per-region values.
  • LoRA seemingly doing nothing → lora_weight_adj at 0 (off). Set 100.
  • Regions in the wrong place → use_base mismatch with the parser, or stale divide_ratio; reconnect from RPRatioParser.
CategoryRegional Prompter

Inputs (23)

NameTypeDefaultDescription
modelMODEL
clipCLIP
vaeVAE
regional_prompts_noloraRP_SUBPROMPTS
regional_col_n_rowRP_REGIONS
regional_lora_mapRP_LORA_MAP
negativeCONDITIONING
thresholdRP_THRESHOLD
latent_imageLATENT
seedINT00–18446744073709550000
stepsINT201–200
cfgFLOAT7.00–30
sampler_nameCOMBO44 options: euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, heunpp2, +38
schedulerCOMBO9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3
denoiseFLOAT1.000–1
use_baseBOOLEANfalseSet the same as use_base in RPPromptParser.
use_commonBOOLEANtrue
base_ratioSTRING0.2BASE:REGION blend ratio. 0.2 → 20% BASE + 80% REGION. Per-region: '0.2,0.3,0.5'
steps_add_per_divINT00–20Add steps per DIV region. Total steps = steps + (n_div × steps_add_per_div)
cfg_add_per_divFLOAT0.00–5Add CFG per DIV region. Total cfg = cfg + (n_div × cfg_add_per_div)
lora_weight_adjINT00–500LoRA weight multiplier (%). 0=disabled, 100=original, 50=half, 200=double
debugBOOLEANfalsePrint debug log when enabled.
divide_modeoptRP_DIV_MODEHorizontalConnect divide_mode from RPPromptParser.

Outputs (2)

NameTypeDescription
latentLATENT
imageIMAGE