Nodes/Diffusion CG/KSampler XL (Recenter)
ComfyUI Node

KSampler XL (Recenter)

KSampler XL with built-in color recentering for SDXL

By Haoming02·Created 3 years ago·Updated 9 months ago· 103
KSampler XL (Recenter)
  • model
  • positive
  • negative
  • latent_image
  • LATENT
seed0
steps20
cfg8.0
sampler_name
scheduler
denoise1.00
strength0.0
L0.00
a0.00
b0.00

If you've used the SD 1.5 version, you know the move: recenter the latent channels during sampling and the color cast melts away while detail stays put. Center Sampler XL (UI name KSampler XL (Recenter)) is the same trick tuned for SDXL - a drop-in KSampler replacement that recenters the latent on every step, but with a different color model because SDXL's latent is built differently.

Why SDXL gets its own node

SD 1.5's latent has 4 channels, and the SD 1.5 sampler recenters all of them (the C/M/Y/K CMYK-ish controls). SDXL's VAE also produces a 4-channel latent, but the author's color model for recentering treats the meaningful color axes as three channels and exposes them as L, a, b - a Lab-style split, roughly lightness plus two opponent color axes. That's why the sliders look different from the SD 1.5 node even though the mechanism underneath is the same.

How it works

Same as the SD 1.5 version: it runs ComfyUI's sampling loop with your chosen sampler and scheduler, but wraps the callback so that at each step it nudges the channel means toward targets:

x[channel] += (target[channel] - x[channel].mean()) * strength

The controls:

  • strength - 0 to 1, default 0. How hard the recenter effect applies. Zero = plain KSampler behavior.
  • L (default 0), a (default 0), b (default 0) - target means per channel. All default to 0, meaning "pull toward neutral." Unlike the SD 1.5 node, which ships with pre-tuned defaults (C=0.0126, M=0.5152, Y=-0.1278), the XL version starts you at pure neutrality and expects you to dial color in by hand. That's actually reasonable - SDXL checkpoints differ a lot in their native color balance, so a one-size-fits-all preset is less useful here.

Everything else is standard KSampler fare: model, seed, steps, cfg, sampler_name, scheduler, positive, negative, latent_image, denoise. Output is a single LATENT straight into VAE Decode.

A note on versions

Like its SD 1.5 sibling, Center Sampler XL is from the early era of the Diffusion CG pack. The current v2 release ships only the unified Diffusion CG node, which applies recenter to whatever KSampler you already have in the graph. If you install today and don't see Center Sampler XL in the node list, that's expected - use Diffusion CG (it handles both SD 1.5 and SDXL) or pin an older release of the pack.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/Haoming02/comfyui-diffusion-cg

Restart ComfyUI. No extra dependencies, no model files to hunt down.

Gotchas

  • The pack's README's known issue applies here too: recentering doesn't work with every sampler, and low-step / distilled-sampler workflows (LCM, Turbo) are the usual cases where the effect just doesn't show.
  • Start with strength low (0.3–0.5) and the L/a/b targets at 0. Push strength to 1 with all targets at 0 and you get the full "neutralize the cast" effect; if you actually like a checkpoint's warm bias, keep strength low or the node will flatten it out of existence.
Categorysampling

Inputs (14)

NameTypeDefaultDescription
modelMODEL
seedINT00–18446744073709550000
stepsINT201–10000
cfgFLOAT8.00–100
sampler_nameCOMBO22 options: euler, euler_ancestral, heun, heunpp2, dpm_2, dpm_2_ancestral, +16
schedulerCOMBO6 options: normal, karras, exponential, sgm_uniform, simple, ddim_uniform
positiveCONDITIONING
negativeCONDITIONING
latent_imageLATENT
denoiseFLOAT1.000–1
strengthFLOAT0.00–1
LFLOAT0.00-1–1
aFLOAT0.00-1–1
bFLOAT0.00-1–1

Outputs (1)

NameTypeDescription
LATENTLATENT