Some Bits: Nelson's log

Distribution of 2d noise functions

So I’ve been using noise functions in my plotter art. One thing to be aware of with noise functions is the output distributions aren’t uniform. I don’t just mean the smooth variation of nearby points that you’re using a fancy noise function for, but even if you sample uniformly from a large space the values are still closer to a normal distribution than a uniform distribution. To put it more concretely; these noise functions all return values in the range [-1, 1]. (2d Perlin noise is [-0.7, 0.7] ish.) But results near 0 are more common than results near 1 and -1. See below for some histograms.

This isn’t necessarily bad. You can always scale the output up to a uniform distribution or whatever you want. Although that requires knowing what the original distribution actually is. Perlin noise looks like a real normal distribution but both Simplex and OpenSimplex noise have a weird boxy distribution where results are uniformish in the range of -0.5 to 0.5.

More than the usual caveats apply; this is sloppy code and I might have gotten it wrong. Histograms are for 1 million samples drawn from OpenSimplex and caseman’s Perlin and Simplex noise. 2d noise in each case; the coordinates were uniformly sampled in the range of [-100_000, 100_000]. (A small range because caseman’s code seems to be using 32 bit floats). I did not alter the scaling or octave parameters at all, library defaults. My code is in this gist.

Perlin noise
-0.95
-0.85
-0.75
-0.65
-0.55 ***
-0.45 ***********
-0.35 *****************
-0.25 *********************************
-0.15 *******************************************
-0.05 *************************************************
 0.05 **************************************************
 0.15 ********************************************
 0.25 **********************************
 0.35 ****************
 0.45 ***********
 0.55 ***
 0.65 *
 0.75
 0.85
 0.95
 
Simplex noise
-0.95
-0.85 *********
-0.75 **************
-0.65 *************************
-0.55 ************************************************
-0.45 *************************************************
-0.35 **********************************************
-0.25 **********************************************
-0.15 ***********************************************
-0.05 **********************************************
 0.05 ************************************************
 0.15 **************************************************
 0.25 ************************************************
 0.35 ************************************************
 0.45 **************************************************
 0.55 *************************************************
 0.65 ************************
 0.75 **************
 0.85 *********
 0.95
 
OpenSimplex noise2d
-0.95
-0.85
-0.75 *****
-0.65 ***************
-0.55 **************************
-0.45 *****************************************
-0.35 **************************************************
-0.25 **************************************************
-0.15 *************************************************
-0.05 *************************************************
 0.05 **************************************************
 0.15 *************************************************
 0.25 *************************************************
 0.35 *************************************************
 0.45 ****************************************
 0.55 **************************
 0.65 ***************
 0.75 *****
 0.85
 0.95

Update: I asked about this on the Plotter Art Discord and someone suggested empirically measuring the distribution then doing a correction. They offered this matlab snippet:

p = randn(1000,1);
p2 = (p-min(p))/(max(p)-min(p));
x = sort(p2);
CDFp = linspace(0,1,numel(p2));
pUnif = interp1(x,CDFp,p2);