TBG Split-Aware Inpaint Sampler
Split-pass sampling that finally respects your inpaint mask
- model
- positive
- negative
- latent_image
- sampler_state
- Sampler
- LATENT
- sampler_state
The bug it exists to fix
Split-pass sampling is the trick of breaking one generation into a high-sigma stage and a low-sigma stage, often with a different model or a different denoise. It's how people get the creative freedom of a high denoise with the structure of a low one. But there's a long-standing ComfyUI flaw: when you split the sigma schedule, the latent mask stops being honored, so masked regions come back full of residual noise and that tell-tale latent grid pattern. It's ComfyUI issue #5452, and for a long time the practical answer was "don't split while inpainting."
This sampler is the fix. TBG's split-aware sampler forks KSamplerAdvanced so the differential-diffusion blend keeps the original image as a reference across the split, and it interpolates the denoise mask with a small fade to kill the grid artifacts. The author built it while making the ETUR tiled refiner and spun it out as a standalone CE node - free, no Patreon key.
What's different from a stock KSamplerAdvanced
Look at the inputs and you'll spot the extras, plus one very important window:
- inpaint_start / inpaint_end - the step range where the masked latent actually blends. Defaults (0 and 10000) mean the mask is active through the whole schedule. Raise
inpaint_startto let the image cook freely before the mask locks in; lowerinpaint_endto let late steps polish without mask constraints. This is your "how much creative freedom before it must match" dial. - smoother_sharper - dual-stage adaptive sharpening. Positive values inject structured noise for detail invention at high sigma and high-pass edge sharpening at low sigma; negative values soften and blur. Zero is off.
- detail_enhancer - substep evaluation. Positive is lookahead (coherent refinement, but 2× slower on affected steps), negative is lookback (more creative variation). Zero is disabled and fastest - which is where you should start.
- return_with_leftover_noise - on for intermediate passes, off on the last one.
- add_noise - on for the first sampler, off for every chained one.
- sampler_state (optional) and Sampler (optional) - chain state between passes; connect a SAMPLER object to override the dropdown.
And because it ships beside the Krea2 conditioning node, it also reads the vl_start_percent / vl_end_percent metadata from that node's conditioning and only applies the visual-token conditioning during that window. That's the "split-aware" bit - it knows there's a schedule to respect, not just a mask.
Wiring it up
The natural chain, all in one pack:
- TBG Krea2 Inpainting Conditioning → gives you
positive,negative, and the maskedlatent. - TBG Split-Aware Inpaint Sampler -
add_noiseon,return_with_leftover_noiseon if you're chaining. - A second pass if you want one -
add_noiseoff,sampler_stateconnected. - Final pass with
return_with_leftover_noiseoff → VAE Decode.
It also works with any standard inpainting setup; InpaintModelConditioning or Set Latent Noise Mask feed it fine. Outputs are LATENT plus a sampler_state to hand down the chain.
Installing it
Same pack as the whole TBG ETUR set:
cd ComfyUI/custom_nodes
git clone https://github.com/Ltamann/ComfyUI-TBG-ETUR
cd ComfyUI-TBG-ETUR
pip install -r requirements.txt
or ComfyUI Manager → search "TBG" → install TBG Enhanced Upscaler and Refiner, then restart. Give the requirements install time - opencv, timm, kornia, bitsandbytes, optimum and friends is a big tree for what looks like one node. The pack is migrated to ComfyUI's v3 node API, so if the node won't load, update ComfyUI first.
Troubleshooting
- CFG 1 is correct for Krea 2, and for most current flow-matching models - they're guidance-distilled, so cranking CFG just burns the image at double the time. This sampler's default of 1.0 is right; don't "fix" it out of SDXL habit.
- detail_enhancer is expensive. The tooltip says it plainly: 2× slower on affected steps. Start at 0 and only turn it on when you're chasing a specific look.
- Noisy masked area on a chained pass → you almost certainly left
add_noiseon, or disconnectedsampler_state. - It's new and under-documented (basically zero search impressions yet). The pack is updated near-daily and the author is responsive in the GitHub issues - if something's off, that's the fastest source of truth.
Inputs (20)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| add_noise | BOOLEAN | true | Enable: add random noise (first sampler). Disable: no noise added (sampler chaining/img2img). Use 'enable' for first sampler, 'disable' for subsequent ones. |
| noise_seed | INT | 00–18446744073709550000 | — |
| steps | INT | 201–10000 | — |
| cfg | FLOAT | 1.000–100 | — |
| sampler_name | COMBO | 47 options: euler, TBG Flux2 Sampler, pid_sde, pid_creative_sde, euler_cfg_pp, euler_ancestral, +41 | |
| scheduler | COMBO | 9 options: simple, sgm_uniform, karras, exponential, ddim_uniform, beta, +3 | |
| denoise | FLOAT | 1.000–1 | — |
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| latent_image | LATENT | — | |
| start_at_step | INT | 00–10000 | — |
| end_at_step | INT | 100000–10000 | — |
| inpaint_start | INT | 00–10000 | Step number where inpainting injection begins. Inpainting blends the original latent with the denoised latent within the masked area. Set to 0 to start inpainting from the first step. Higher values delay inpainting, allowing more creative freedom before preserving masked regions. |
| inpaint_end | INT | 100000–10000 | Step number where inpainting injection ends. Set to a high value (e.g., 1000) to inpaint through all steps. Lower values allow later steps to refine without mask constraints. Works with inpaint_start to define the inpainting window. |
| smoother_sharper | FLOAT | 0.00-1–1 | Dual-stage adaptive sharpening. At high sigma (early steps), adds structured noise for detail invention. At low sigma (late steps), applies high-pass edge sharpening. Positive values sharpen and add details. Negative values soften and blur. Zero disables sharpening. Higher absolute values create stronger effects. |
| detail_enhancer | FLOAT | 0.00-1–1 | Substep evaluation for detail control. Positive values (0.1-1.0): lookahead to next sigma, adds coherent details and refinement, reduces variation. Negative values (-0.1 to -1.0): lookback to previous sigma, adds creative variation and texture complexity. Zero = disabled (single pass, fastest). Performance cost: 2x slower on affected steps. |
| return_with_leftover_noise | BOOLEAN | false | Enable: keeps noise for sampler chaining. Disable: fully denoise output. Use 'enable' for split workflows, 'disable' for final step. |
| sampler_stateopt | sampler_state | Chain state from previous sampler. Leave empty for first sampler, connect for subsequent samplers in multi-pass workflows. | |
| Sampleropt | SAMPLER | Optional sampler object. When connected, it overrides the Sampler Name selection. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |
| sampler_state | sampler_state | — |