Nodes/More Math/Noise math
ComfyUI Node

Noise math

Craft the noise itself, instead of just picking a seed

By mcDandy·Created about a year ago·Updated 3 days ago· 5
Noise math
  • V
  • F
  • Noise
  • stack
  • NOISE
  • STACK
remember_stackfalse

Most people treat noise as a black box: pick a seed, get whatever the sampler hands you. Noise math from More Math opens the box. It's the node you use when you want to manipulate the initial latent noise itself - generate it from a formula, blend two noise tensors, add procedural structure - instead of accepting the default Gaussian draw.

How it works

The node evaluates your expression over the noise tensor, and it exposes the noise-specific variables: I (the input latent used to generate the noise), plus the image-style X, Y, W, H, C, B, T. The default expression is the familiar lerp a*(1-w)+b*w (in autogrow terms I0*(1-F0)+I1*F0) - a blend between two noise inputs. Where it gets interesting is the random-generation functions in the shared library: noise(seed), randn, randu, randc, randb, all seeded and deterministic for a given seed, so your handcrafted noise is reproducible. There's also perlin, voronoi, plasma, and ridged for procedural noise that isn't Gaussian at all.

Why would you want that? Structured noise - like a perlin base mixed into the initial latent - is a real technique for guiding composition before the sampler even starts, and blending noise tensors is how you get reproducible variation between otherwise-identical generations.

Inputs and outputs

V is the autogrow list of noise inputs (V0, V1, ...), F the floats, and Noise is the expression field (that's the one you type into, default a*(1-w)+b*w). remember_stack and the optional stack input are the pack's cross-node state, only relevant if you're threading values.

Outputs are NOISE and STACK. The noise feeds a sampler's noise input - in ComfyUI terms, the NOISE type plugs into sampler nodes that accept an explicit initial noise.

Installing it

Standard for the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/mcDandy/more_math
cd more_math
pip install -r requirements.txt

Restart ComfyUI, or install "More math" from ComfyUI Manager. Dependency: antlr4-python3-runtime on top of torch. No models.

Gotchas

Noise tensors are unbounded - Gaussian draws live around mean 0, variance 1, so clamp(noise, 0, 1) destroys the distribution and the sampler will happily amplify the damage. If you blend noise, keep weights in a range that preserves roughly unit variance. And remember the seeded generators need an explicit seed: use the same seed with the same expression and you get the same noise, change either and everything shifts. It's a brand-new, solo-maintained pack, so structured-noise workflows are mostly unexplored territory - which is exactly the fun of this node, but bring your own experiments.

CategoryMore math

Inputs (5)

NameTypeDefaultDescription
VCOMFY_AUTOGROW_V3
FCOMFY_AUTOGROW_V3
NoiseSTRING,SYNTAX_TREEV0Expression for noise
remember_stackBOOLEANfalseIf enabled, stack is copied at output leading to changes being remembered during batch operations (node runs multiple times in sucession). If disabled each batch gets it's own copy of the stack.
stackoptSTACKAccess stack between nodes

Outputs (2)

NameTypeDescription
NOISENOISE
STACKSTACK