SAX Latent Noise
Add noise to just part of a latent — the SAX Latent Noise i2i trick
- samples
- mask
- SAMPLES
SAX Latent Noise is the trick for when your img2img output looks too clean - or when you only want to re-noise one region and leave the rest of the latent alone. It's a standalone utility that adds noise directly into latent space, either across the whole tensor or just under a mask. The "standalone" part matters: this node doesn't call any API and needs no models, and the pack author points you to a different knob (SAX Enhanced Detailer's latent_noise_intensity) if you're already inside the detailer pipeline. This one is for plain KSampler workflows.
How it works
The math is refreshingly short: latent + noise * intensity * mask. Gaussian (torch.randn) or uniform (rand*2−1) noise is generated from your seed, scaled by intensity, multiplied by the mask, and added straight onto the latent tensor. No clamping happens - the docs are explicit that latent values can exceed ±1.0 at high intensity, and that's intentional. Latent noise isn't pixel noise; the sampler downstream interprets it, so don't panic at big numbers.
A few mechanical details worth knowing. If you pass a mask, it's shrunk (mask_shrink) and blurred (mask_blur) first - a 1px shrink with a small blur cleans up hard mask edges so you don't get a visible noise rectangle. If you don't pass a mask, the whole latent gets noise. And it handles video latents (B, C, T, H, W) by broadcasting the mask over the time axis, so it's not just for stills.
The inputs that matter
intensity- 0.05 default, range 0–2. For i2i texture restoration you'll usually live around 0.05–0.15. This is the one you'll actually fiddle with.noise_type-gaussianoruniform. Gaussian is the sane default; uniform is harsher, grainier, and rarely what you want for detail work.seed- sets the noise pattern. Fix it if you want the exact same grain across runs.mask_shrink/mask_blur- edge cleanup for the masked region, defaults 1/1. Leave them alone until you see a seam.mask(optional) - if you want to restrict noise to, say, just the hair region a segmenter found.
The only output is SAMPLES (a LATENT), which feeds straight into a KSampler. Since the noise is already in the latent, keep the sampler's denoise moderate - you're deliberately adding the chaos, so you don't need a second full pass to create it.
Installing it
This node ships in the SAX_Bridge pack, so you install the whole pack once. In ComfyUI Manager, use "Install via Git URL" and paste https://github.com/so16tm/SAX_Bridge, or:
cd ComfyUI/custom_nodes
git clone https://github.com/so16tm/SAX_Bridge
Then restart ComfyUI. SAX_Bridge has no required Python dependencies beyond ComfyUI itself - nothing heavy to download for this node. The sam3 install (with its Windows triton requirement) is only needed if you use the SAX SAM3 nodes.
Gotchas
The biggest surprise is the no-mask default: leave mask unconnected and you've re-noised the entire latent, which can blow past what your denoise setting expects and come out noisy. If that happens, either connect a mask or drop the intensity. And remember the division of labor - masked noise injection inside the detailer should use SAX Enhanced Detailer's own latent_noise_intensity, not this node, or you'll fight two overlapping noise systems.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| samples | LATENT | — | |
| intensity | FLOAT | 0.050–2 | — |
| noise_type | COMBO | 2 options: gaussian, uniform | |
| seed | INT | 00–18446744073709550000 | — |
| mask_shrink | INT | 10–16 | — |
| mask_blur | FLOAT | 1.00–16 | — |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SAMPLES | LATENT | — |