Nodes/ComfyUI_Fill-Nodes/FL KSampler SEG Encoder
ComfyUI Node

FL KSampler SEG Encoder

Turn per-region captions into per-region conditioning

By filliptm·Created 3 years ago·Updated a day ago· 630
FL KSampler SEG Encoder
  • regions
  • clip
  • regions
default_positivehigh quality, detailed
default_negativeblurry, low quality, artifacts

Third node in the Fill-Nodes SEG chain (Regions → Captioner → Encoder → FL_KsamplerSEG), and the one that quietly does the expensive part. You've got a bundle of regions, each carrying a short caption from FL_KsamplerSEG_Captioner. This node runs every one of those captions through CLIP and attaches the resulting conditioning back onto its region - so by the time FL_KsamplerSEG samples, each Voronoi cell has its own positive prompt driving it, not one global prompt for the whole image.

How it works

For each region with a caption, it calls your CLIP encoder on that text and stores the conditioning alongside the region's mask. Regions that never got a usable caption - maybe the vision call failed upstream, maybe you skipped the captioner step entirely - fall back to default_positive / default_negative, so the chain degrades gracefully instead of erroring on a gap. The one efficiency touch worth knowing about: encodes are cached by exact text match. If two regions end up with the identical caption (common with repetitive backgrounds - sky, grass, whatever), CLIP only runs once and both regions share the result. Free performance, no configuration needed.

The inputs and outputs that matter

  • regions (SEG_REGIONS) in - the captioned bundle from the previous node.
  • clip - your standard CLIP model, exactly the same one you'd plug into any CLIPTextEncode.
  • default_positive (default "high quality, detailed") and default_negative (default "blurry, low quality, artifacts") - the safety net for uncaptioned regions. Worth overriding to match whatever style language your checkpoint actually responds to, rather than leaving the generic defaults.
  • Output: regions, same type, now carrying per-region CONDITIONING - feeds directly into FL_KsamplerSEG.

There's nothing else to tune here. This node is deliberately thin: it's the plumbing between "captions exist" and "sampling can use them," and the only real decision you make is what the fallback prompt should say.

How to install it

Via ComfyUI Manager, search "ComfyUI_Fill-Nodes" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes

then restart ComfyUI. This particular node has no exotic dependency - it's just CLIP encoding, which ComfyUI already does natively. The pack overall is a large, general-purpose grab-bag (image FX, PDF tools, GPT/Gemini/Fal API nodes, this KSampler family) from one prolific solo author, filliptm - the heavier requirements belong to other node groups, not this one.

Common issues & troubleshooting

A region samples like nothing was said about it. Check whether it actually got a caption - if the captioner call failed or you ran regions straight into the encoder without captioning first, that region is running on your default_positive/default_negative only. Not broken, just uncaptioned.

Two visually different regions produce the same conditioning. That's the text-based cache doing its job - if their captions happen to be word-for-word identical, they share one CLIP pass. If you need them distinct, the fix is upstream: tweak the captioner's prompt_template so it produces more specific text, or edit captions by hand between steps.

Slow on a large region count. Encoding itself is cheap per call, but if FL_KsamplerSEG_Regions handed you 40+ regions with mostly-unique captions, that's 40+ CLIP passes before sampling even starts. The text cache helps only when captions genuinely repeat.

Category🏵️Fill Nodes/Ksamplers

Inputs (4)

NameTypeDefaultDescription
regionsSEG_REGIONS
clipCLIP
default_positiveSTRINGhigh quality, detailed
default_negativeSTRINGblurry, low quality, artifacts

Outputs (1)

NameTypeDescription
regionsSEG_REGIONS