Rausch-Explorer — gaussian / uniform / poisson, nebeneinander, live

Interaktiver Vergleich der drei Verteilungen der nativen addNoise-Op. Ein 1×5-Streifen zeigt das Original neben gaussian (Rauschen mit konstantem σ), uniform (flach ±σ), poisson (signalabhängiges Schrotrauschen — Lichter verrauschter, Schatten sauber) und COMBINED — der realistische „Endoutput": ein Luminanz-Gauss-Pass mit schwächerem Per-Kanal-Poisson-Chroma-Pass darüber, so wie man addNoise tatsächlich für überzeugendes Sensorrauschen stapelt. //!LIVE ist an, der SIGMA-Regler aktualisiert alle fünf Panels gleichzeitig; der COLOR-Schalter wechselt die drei Primitive zwischen gemeinsamem Luminanz-Korn und Per-Kanal-Chroma-Rauschen. addNoise ist das Degradations-Primitiv hinter samples/binaries/degrade.js.

INPUT
INPUT — Rausch-Explorer — gaussian / uniform / poisson, nebeneinander, live
original | gaussian | uniform | poisson | combined
original | gaussian | uniform | poisson | combined — Rausch-Explorer — gaussian / uniform / poisson, nebeneinander, live
JavaScript
// Interactive noise explorer — the three addNoise distributions plus
// a realistic COMBINED stack. With //!LIVE on, dragging SIGMA updates
// all five panels at once, so the character of each is easy to compare.
// demo_noise.js
//!INPUT: INPUT
//!OUTPUT: OUTPUT
//!PARAM: SIGMA:number=0.08,min=0,max=0.3,step=0.005
//!PARAM: COLOR:boolean=false
//!LIVE: true,debounce=120

// `addNoise` is the native degradation primitive (see also
// samples/binaries/degrade.js). Three distributions:
//
//   gaussian — additive normal noise, constant σ. The classic
//              sensor read-noise.
//   uniform  — flat noise in ±σ. Harsher, no tail.
//   poisson  — shot noise: σ scales with √pixel, so highlights get
//              noisier and shadows stay clean. The most photographic.
//
// COLOR off → one sample shared across RGB (luminance grain);
// COLOR on  → each channel independent (chroma noise).
//
// COMBINED is the "end output" — how you'd actually use addNoise for
// realistic degradation: a luminance pass (gaussian, mono) with a
// weaker chroma pass on top (poisson, color). Real sensor noise has
// both components, so stacking them looks far more convincing than
// any single distribution alone. The COLOR toggle does not affect
// this panel — it always demonstrates the mono+color stack.

const orig = Engine.loadImage(INPUT);
const W = orig.width, H = orig.height;

const noised = (type) =>
    orig.clone().addNoise({ type, sigma: SIGMA, color: COLOR });

const gaussian = noised("gaussian");
const uniform  = noised("uniform");
const poisson  = noised("poisson");

// COMBINED — realistic sensor-noise stack: luminance grain first,
// then a weaker independent-channel chroma pass on top.
const combined = orig.clone()
    .addNoise({ type: "gaussian", sigma: SIGMA, color: false })
    .addNoise({ type: "poisson", sigma: SIGMA * 0.6, color: true });

// 1×5 strip: original + the three primitives + the combined result.
const panels = [
    ["ORIGINAL", orig],
    ["GAUSSIAN", gaussian],
    ["UNIFORM",  uniform],
    ["POISSON",  poisson],
    ["COMBINED", combined],
];
const sheet = Engine.createImage(W * panels.length, H);
const ink = new Pixel(1, 1, 1, 0.85);
panels.forEach(([label, img], i) => {
    sheet.blendAt(img, px(i * W, 0), 1.0);
    sheet.drawText(label, i * W + 16, 34, { font: "JetBrains Mono", size: 24, color: ink });
});
sheet.save(OUTPUT);

sheet.free();
gaussian.free();
uniform.free();
poisson.free();
combined.free();
orig.free();

`addNoise σ=${SIGMA} ${COLOR ? "color" : "mono"} — gaussian | uniform | poisson | combined`;

// © 2026 Michael Lechner · mlc OpticScript · https://mlcgo.eu · Elastic License 2.0