Nodes/ComfyUI Impact Pack/NoiseInjectionHookProvider
ComfyUI Node Runs on cloud

NoiseInjectionHookProvider

Inject noise back into an iterative upscale

By ltdrdata·Created 3 years ago·Updated 4 months ago· 3,242
NoiseInjectionHookProvider
    • PK_HOOK
    schedule_for_iteration
    source
    seed0
    start_strength1.00
    end_strength1.00

    Run enough resample passes on an iterative upscale and the image can start to look flat. Every step sharpens a bit and adds detail, but a low-denoise resample is inherently a smoothing operation repeated over and over, and by the third or fourth pass you can lose some of the organic grain an image should have. NoiseInjectionHookProvider builds a PK_HOOK that injects noise back into the latent at each step of an Iterative Upscale, scaled according to a schedule, to counteract exactly that.

    It's the upscale-side twin of NoiseInjectionDetailerHookProvider - same underlying idea, injected noise scaled by a strength ramp, just wired into an upscaler-provider's hook slot instead of a detailer's detailer_hook.

    How it works

    Each time Iterative Upscale calls into a step, the hook adds noise to the latent, scaled somewhere between start_strength and end_strength depending on how far through the iteration you are. seed is the base value the noise comes from, and per the README it "increments by 1 with each iteration" - so you're not injecting identical noise at every step. source picks whether that noise is generated on CPU or GPU, which changes the exact pattern you get even at the same seed, the way it always does in ComfyUI's noise machinery.

    One hard dependency: this needs BlenderNeko's ComfyUI_Noise installed alongside Impact Pack. It's a separate pack, and Impact Pack's own installer doesn't pull it in for you.

    The inputs and outputs that matter

    • schedule_for_iteration - currently just simple, the only interpolation style on offer right now.
    • source (CPU / GPU) - where the injected noise comes from.
    • seed (default 0) - base seed; auto-increments per iteration so you don't manage it by hand.
    • start_strength / end_strength (both default 1, range 0–200) - the strength ramp across iterations. Both default to the same value, so out of the box you get a flat strength rather than a taper - set one lower than the other if you want it to ease up or down as the upscale progresses.

    Output is a single PK_HOOK - wire it into the pk_hook_opt slot on an upscaler provider (PixelKSampleUpscalerProvider, PixelTiledKSampleUpscalerProvider, or either's pipe variant). Need it alongside a CFG or step-count schedule too? Combine hooks first with PixelKSampleHookCombine - most providers expose only one hook input.

    How to install it

    Via ComfyUI Manager: search ComfyUI Impact Pack, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ltdrdata/ComfyUI-Impact-Pack comfyui-impact-pack
    cd comfyui-impact-pack
    python -m pip install -r requirements.txt   # ComfyUI's python; python_embeded on portable
    

    then restart. Also install BlenderNeko/ComfyUI_Noise - search "ComfyUI Noise" in Manager, or clone it the same way into custom_nodes. Without it this node either errors or won't do anything useful.

    Common issues & troubleshooting

    Node errors or does nothing. Missing ComfyUI_Noise install - the single most likely cause. Install it, restart, retry.

    Upscale looks noisier or grainier than expected. start_strength/end_strength are too high for your use case. This stacks on top of whatever denoise the provider is already running, so treat it as a small correction, not a second sampling pass - bring both values down toward 0 and reassess.

    Not sure you need this. Most iterative upscales look fine without it. Reach for it specifically when several resample steps have left the image looking artificially smooth or waxy, and you want a touch of grain back rather than re-running the whole upscale with different denoise settings.

    CategoryImpactPack/Upscale

    Inputs (5)

    NameTypeDefaultDescription
    schedule_for_iterationCOMBO1 options: simple
    sourceCOMBO2 options: CPU, GPU
    seedINT00–18446744073709550000
    start_strengthFLOAT1.000–200
    end_strengthFLOAT1.000–200

    Outputs (1)

    NameTypeDescription
    PK_HOOKPK_HOOK