Unhook Recenter
The manual off switch for a sampling hook
- latent
- LATENT
The recenter nodes in this pack install a hook - they patch ComfyUI's sampling functions so every sampler that runs after them recenters the latent channels. That's great until you want a later pass to not be recentered. Unhook Recenter is the counterpart: a tiny latent-in/latent-out node that undoes the patch. Put it in the graph where the effect should stop, and the sampling after it runs clean.
What it does
Where Hook Recenter stores a copy of ComfyUI's original sampling functions and swaps in its own wrapped versions, Unhook Recenter does the reverse: it restores comfy.sample.sample and comfy.sample.sample_custom to the originals. The latent it receives passes through untouched. There are no inputs besides latent and no outputs besides LATENT - it's a pure side-effect node, the closest thing this pack has to a "stop hooking my samplers" button.
Why you'd use it
Two situations, both about the pack's global-hook design:
- Multi-pass workflows. A first pass gets the recentered, balanced color; a hires-fix second pass should upscale the image without re-applying the color shift. Drop Unhook Recenter on the latent path between the two passes and the second sampler runs with the originals intact.
- Containment while debugging. The hooks are module-level, so a recenter node anywhere in the workflow affects every sampler downstream - and because they only re-install when their node re-executes, partial reruns can leave a stale hook in place, which is the classic "my colors changed for no reason" bug (a known complaint on the pack's issue tracker). Unhook Recenter gives you a deterministic "hooks are off from here" point in the graph.
It's also the honest companion to the era it came from: in the "complete rewrite" release of the pack, Hook Recenter / Hook Recenter XL installed hooks and Unhook Recenter removed them - a matched pair. The current v2 rewrite replaced the whole mechanism: Diffusion CG sets the effect and Disable CG resets it to zero. If you're on a current install you'll find those two nodes instead.
One caveat
Because it restores the originals captured at import time, Unhook Recenter doesn't just disable the recenter effect - if any other node in your graph had also patched those sampling functions, this node will clobber its patch too. In practice that's a non-issue with this pack, but it's worth knowing before you drop it into a busy custom-sampler workflow.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Haoming02/comfyui-diffusion-cg
Restart ComfyUI. Zero dependencies, no model downloads. It's a three-second mental model: Hook Recenter on, Unhook Recenter off, and the latent flows through either way.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |