ComfyUI Node

Hijack

Wrap any sampler in variation powers, then don't forget to undo it

By chrisgoringe·Created 3 years ago·Updated 2 years ago· 26
Hijack
  • latent
  • latent
variation_seed42
variation_weight0.200

Hijack is the front half of cg-noise's cleverest trick. It swaps out Comfy's noise-generation function for one that blends noise from two seeds, giving any KSampler variation powers - not just the pack's custom-built ones. The name isn't a metaphor; that's literally what it does.

Drop it right before your KSampler, drop UnHijack right after, and the sampler in between quietly starts producing variations. It's a latent pass-through with two extra inputs:

  • variation_seed (default 42) - the seed whose noise you blend toward
  • variation_weight (default 0.2, range 0–1, step 0.001) - how much of that alternate noise sneaks in. Try 0.1 to start; 0.2 reads stronger than it looks.

Under the hood it replaces comfy.sample.prepare_noise so the initial noise becomes noise(seed) * (1 - w) + noise(variation_seed) * w. Set w to 0 and you get the exact same image as a normal sampler - that's your sanity check that the hijack is actually active.

Two things the README is emphatic about:

  • Set the seed's control_after_generate to fixed, or the variation axis randomizes under you while you're tuning.
  • Never leave a Hijack unpaired. If a second Hijack runs while one is still active, the pack prints a warning to the console - "maybe you forgot to unhijack?" - and carries on. The real fix is discipline: Hijack in front of the sampler, UnHijack behind it, every time.

Why use this instead of the dedicated "KSampler with Variations" node? Because those only exist for Comfy's stock samplers. Hijack wraps anything - your custom sampler packs, workflows you don't want to rewire. That's the tradeoff's upside. The downside is that the hijack is process-global: it replaces Comfy's noise function until UnHijack restores it, so a forgetful graph can leak the mixed noise into unrelated nodes downstream. That leak is the price of the "wrap any sampler" trick, and it's why the pair exists instead of a one-shot node.

Install is the same as the rest of the pack. ComfyUI Manager → search "cg-noise" or "chrisgoringe" → install → restart → hard refresh, or:

cd ComfyUI/custom_nodes
git clone https://github.com/chrisgoringe/cg-noise.git

Then restart ComfyUI. No models, no requirements.txt, no dependencies beyond Comfy itself.

Fair warning from the README itself: this pack is retired. The author moved the whole concept to cg-noisetools (Noise Mix, Noise Shape) after Comfy made noise a first-class datatype, and that's where new development lives. Hijack still works for existing workflows; it's just not the tool the author would reach for anymore.

Categorynoise/hijack

Inputs (3)

NameTypeDefaultDescription
latentLATENT
variation_seedINT420–18446744073709550000
variation_weightFLOAT0.2000–1

Outputs (1)

NameTypeDescription
latentLATENT