This browser has no WebGPU, so the sketch cannot run here. The program is below, and it runs in a current Chrome, Edge or Safari.
Perlin Noise
//////////////////////////////////////////////////////////
// perlin-noise
// Concept: lattice-based gradient noise
// Use LATT to evaluate 2D Perlin noise across a field.
//
// https://en.wikipedia.org/wiki/Perlin_noise
//////////////////////////////////////////////////////////
// scale the input coordinate
&coord = mlt(C, 8);
// sample a rectangular lattice with quintic interpolation
// R provides random values and D provides local corner offsets
&perlin = LATT.RECT.QUINTIC[&coord]{
dot(nrm(R), D)
};
#perlin {
dim = (256,256,1);
run = &perlin;
}
~perlin {
// remap noise values from [-1, 1] to [0, 1]
col = add(mlt(#perlin, 0.5), 0.5);
}