city96 / SD-Advanced-Noise

Experimenting with generating noise directly in the latent space.
Apache License 2.0
24 stars 3 forks source link
comfyui stable-diffusion

Colored Noise / Advanced Noise / Latent Noise Experiments

It is only fair that I shout out that all the other noise related repos such ash ComfyUI_Noise, noise_latent_perlinpinpin and comfy-plasma. I think the WAS node suite also has quite a few noise-related nodes.

While messing around with the stable diffusion VAE, I noticed the latent space behaves mostly linearly. I figured it should be possible to generate latent noise directly if I map out the per channel limits and give the whole thing an offset.

This repo also has some decoders, but those are a proof of concept tier at best. TAESD is better in every way.

LatentGaussianNoise

I'm not sure if the way I coded this even makes sense, or if it's even gaussian noise. It's just torch.random with a bunch of stuff like scaling/per channel random/etc.

LATENT_SPACE_NOISE

Linearity / linear_encoder

This is the simplest encoder. It uses the fact that a change in the RGB channels creates a (mostly?) linear change in the 4 latents channels (which I just called A/B/C/D since I couldn't find any info about them).

The next step would be to plot at a higher precision and fit them onto a polynomial.

LINEAR_ENCODER

NL