ComfyUI Node

Regions Apply

Regional LoRAs on Krea 2 — the node that keeps character A's delta off character B

By Nynxz·Created 10 months ago·Updated a day ago· 0
Regions Apply
  • model
  • regions
  • model
track0.40
commit_at0.30
preheat0.35
release0.15
smooth1
isolation0.0
ramp0.20
refine2
route_at0.50
route_blocks3
sharpness2.0

Put two character LoRAs in one Krea 2 generation and they smear into a blended face. Every trick short of structural - prompt engineering, attention bias, CFG games - reduces the bleeding but never removes it, because a merged LoRA is a weight patch and both deltas fire on every token. Regions Apply from ComfyUI-NynxzNodes is the structural fix: it runs each LoRA unmerged as a live side branch with a per-token gate, so character B's delta never touches character A's tokens. It's the sink node at the end of the Regions pipeline - regions with LoRAs bound go in, a patched model comes out, and the sampler never sees a merged character at all.

Two honest caveats up front. It's Krea 2 only: the routing map is read out of that DiT's per-block attention hooks (keyed off the txtfusion stack no other architecture has), and the node fails loudly rather than silently gating nothing - load a non-Krea model and you get a clear error, not a weak LoRA. And it's experimental. This is a "the thing to beat" node: turn every mechanism off and it's plain static-mask regional LoRA, which is the baseline it has to beat.

What you set

The defaults are a sane starting point; you'll touch a handful of these. The mechanisms, in the author's words:

  • track (default 0.4) - how far a region may follow its subject off the mask. 0 pins it exactly (the static-mask baseline); 1 lets the image's own clustering decide the shape, with the mask only choosing which cluster belongs to whom. This is where a subject that drifts out of its box doesn't lose its LoRA.
  • commit_at (default 0.3) - the fraction of steps after which the map freezes and LoRAs ramp to full. Before it, layout is the base model's to decide; after it, identity gets locked in.
  • preheat (default 0.35) - LoRA strength multiplier before the commit. Deliberately not 0: with nothing applied early, the base model commits a generic identity that the LoRA then has to overwrite late. Set 1 and it disables the schedule entirely (full strength from step 0).
  • release (default 0.15) - the LoRA's minimum strength outside its own region after commit. A hard edge is right while identity is placed and wrong once texture is written across it - that hard edge is what makes a gated subject look cut out of the image. This is bleed by definition; keep it small.
  • smooth (default 1) - box-blurs the gate map in canvas tokens, closing the speckled holes that read as punch-outs and feathering the boundary in one pass.
  • isolation (default 0) - an attention-logit penalty keeping each region's canvas tokens off the others'. This is the one leak per-token gating can't close (A's tokens attend B's, whose K/V ran with B's branch live). Costs shared lighting and contact shadows, so keep it low - past ~2 you get a collage.
  • ramp (default 0.2), refine (default 2), route_at (0.5), route_blocks (3), sharpness (2) - the scheduling and clustering plumbing. refine=0 turns tracking off entirely regardless of track.

Inputs are model (must be Krea 2) and regions; the output is the patched model, wired to KSampler (via Differential Diffusion, if Region Latent is in the edit path).

Where people get burned

If "regional LoRA" looks weak, check the model isn't the problem first - Apply errors loudly on non-Krea, so read the message. Then suspect the schedule: with low preheat and a late commit_at, characters spend most of early sampling as generic shapes. And if the output looks like pasted stickers, that's usually release too low or isolation too high - give the boundary somewhere to resolve.

Install

Part of Nynxz's Custom Nodes: ComfyUI Manager → search "NynxzNodes" (registry build preferred; hand clones need pnpm install && pnpm build, since web/ is gitignored), or git clone https://github.com/Nynxz/ComfyUI-NynxzNodes. No pip dependencies. Restart after install; update ComfyUI if nodes don't register.

CategoryNynxz/Regions

Inputs (13)

NameTypeDefaultDescription
modelMODELA Krea 2 model. Returned patched.
regionsNYNXZ_REGIONSRegions with LoRAs bound. Regions without one still hold territory.
trackFLOAT0.400–1How far a region may follow its subject off the mask. 0 pins it to the mask exactly — the static-mask baseline. 1 lets the image's own clustering decide the shape, with the mask only choosing which cluster is whose.
commit_atFLOAT0.300–1Fraction of the sampler's steps after which the map freezes and the LoRAs ramp to full. Before it, layout is the base model's to decide.
preheatFLOAT0.350–1LoRA strength multiplier before the commit. 1 disables the schedule entirely (full strength from step 0, map never freezes). Not 0 by default: with nothing applied early the base model commits a generic identity that the LoRA then has to overwrite late, which is its own fight.
releaseFLOAT0.150–1How far the gate lets go of the mask after the commit — the LoRA's minimum strength OUTSIDE its own region. A hard edge is right while identity is being placed and wrong once texture is being written across it, which is what makes a gated subject look cut out of the image. 0 keeps the hard mask. This is bleed by definition, so keep it small.
smoothINT10–8Box-blur the map, in canvas tokens. Tracking is speckled, and an ungated token inside a subject reads as a HOLE punched in it. This closes those and feathers the boundary in the same pass. 0 disables it.
isolationFLOAT0.00–8Attention-logit penalty keeping each region's canvas tokens off the other regions'. The one leak per-token gating cannot close: A's tokens attend B's, whose K/V were computed with B's branch live. Costs shared lighting and contact shadows, so keep it low — past ~2 you get a collage.
rampFLOAT0.200–1How many steps' worth the ramp from preheat to full takes, starting at commit_at. 0 is a hard switch.
refineINT20–8Clustering rounds per read. 0 turns tracking off entirely regardless of `track`.
route_atFLOAT0.500–1Where in the block stack the canvas features are read, as a fraction of depth. Middle is the useful part.
route_blocksINT31–8How many blocks around route_at to average. One block is a noisy sample of where the subjects are.
sharpnessFLOAT2.00.1–10How decisively the clustering commits each token to one region. In standard deviations, so it is scale-free.

Outputs (1)

NameTypeDescription
modelMODEL