FL KSampler SEG Regions
Carve an image into overlapping regions for the SEG sampler chain
- image
- latent
- safe_zone_mask
- regions
- preview_image
- effective_count
This is the node that kicks off a four-node chain unique to Fill-Nodes: Regions → Captioner → Encoder → FL_KsamplerSEG. On its own it doesn't sample or caption anything - it just cuts your canvas into a bunch of soft, overlapping regions and hands them downstream as a single SEG_REGIONS bundle. If you've used Impact Pack's SEGS before, don't confuse the two: Impact's SEGS come out of a detection model finding faces or objects. This one is pure geometry - no detector involved, just a tessellation of the frame.
What it actually does
Under the hood it tiles the image into a Voronoi diagram - think of dropping N random-ish seed points on the canvas and each point "claiming" the pixels closest to it, like a stained-glass pattern. relaxation_iterations runs Lloyd relaxation on those seed points afterward, which nudges them toward more even spacing so you don't get one tiny sliver region next to one huge one. Each resulting cell becomes a soft mask, feathered at the edges (edge_softness) and expanded to overlap its neighbors (region_overlap_factor) so there's no hard seam once regions get sampled independently later. The clever bit: the same soft mask does double duty as both the noise mask and the compositing blend mask, so the alpha math is guaranteed to add up to roughly 1.0 everywhere - no gaps, no double-coverage.
If you feed it a safe_zone_mask, it subtracts that area from the tessellation (with its own safe_zone_feather_px falloff) - handy for keeping regions off, say, a face you don't want carved up.
The inputs and outputs that matter
num_regions(4–64, default 12) - how many Voronoi cells you get. More regions means finer per-area control downstream but more sampling passes later inFL_KsamplerSEG.region_overlap_factorandedge_softness- the two knobs that determine how much regions bleed into each other. Higher values mean smoother blending, lower values mean crisper boundaries.imageorlatent(optional, pick one) - the canvas to tessellate.downscale_ratio(default 8, matching standard VAE downscale) keeps the mask resolution aligned to latent space.- Output
regions(SEG_REGIONS) is the thing that matters - it's a Fill-Nodes-specific type that only talks to the other three SEG nodes.preview_imageshows you the tessellation overlaid on the source (or a coverage heatmap viapreview_mode), andeffective_countreports how many regions actually survived after safe-zone subtraction, since that can be fewer thannum_regions.
How to install it
Through ComfyUI Manager: search "ComfyUI_Fill-Nodes" (or "Fill-Nodes") and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/filliptm/ComfyUI_Fill-Nodes
then restart ComfyUI. This pack is a genuine swiss-army knife - well over 200 nodes spanning image FX, PDF handling, GPT/Gemini/Fal API wrappers, audio-reactive tools, and this KSampler family - from one prolific solo author (filliptm, Machinedelusions on Patreon). The Voronoi/region nodes themselves need nothing exotic beyond what ComfyUI already ships with; the heavier dependencies in this pack (OpenCV, PyPDF2, Google Cloud SDKs, etc.) live in other node groups and only bite if you use those.
Common issues & troubleshooting
Turn show_preview on before you tune anything. With num_regions, relaxation_iterations, and overlap all interacting, the only sane way to dial in a tessellation is to look at it. coverage_heatmap mode is the fast way to spot a region that's barely covered.
effective_count lower than num_regions? That's expected if you're using safe_zone_mask - regions that would've landed entirely inside the safe zone just don't get created. Don't treat it as a bug.
Downstream nodes choke on the output. SEG_REGIONS is not a standard ComfyUI type - it only connects to FL_KsamplerSEG_Captioner, FL_KsamplerSEG_Encoder, and FL_KsamplerSEG itself. If you're trying to wire it anywhere else, that's the mismatch.
Too many small regions tank your speed. Every region gets sampled as its own pass later in the chain (FL_KsamplerSEG), so cranking num_regions up isn't free - it's a direct multiplier on total sampling time.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| num_regions | INT | 124–64 | — |
| relaxation_iterations | INT | 50–8 | — |
| region_overlap_factor | FLOAT | 0.150–0.5 | — |
| edge_softness | FLOAT | 0.100–0.5 | — |
| context_padding_factor | FLOAT | 0.200–1 | — |
| safe_zone_feather_px | FLOAT | 8.00–32 | — |
| downscale_ratio | INT | 81–16 | — |
| seed | INT | 00–2147483647 | — |
| show_preview | BOOLEAN | true | — |
| preview_mode | COMBO | overlay | 2 options: overlay, coverage_heatmap |
| imageopt | IMAGE | — | |
| latentopt | LATENT | — | |
| safe_zone_maskopt | MASK | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| regions | SEG_REGIONS | — |
| preview_image | IMAGE | — |
| effective_count | INT | — |