vydd/sketch

Correlated randomness

Opened this issue · 3 comments

Perlin noise, and other forms of correlated randomness, are commonly used in generative art. See this video by The Coding Train: https://www.youtube.com/watch?v=BjoM9oKOAKY

p5.js provides a simple interface, noise(x[, y[, z]]), to get correlated noise values. See: https://www.geeksforgeeks.org/p5-js-noise-function/

I've implemented my own version of Perlin noise, which I would be happy to contribute to the sketch repository.

Usefully, my version can be initialised from a seed, which allows sketches to be reproduced by keeping the seed constant. It also works for any number of input dimensions. Other CL noise implementations that I've found have not had these properties.

However, I will have to clean up the code/interface and write documentation to accompany it. Any suggestions for the interface are welcome.

(Apologies for spamming the repo with issues; I just want to keep track of the things that I'm planning to work on over the coming months).

(Also, it might be an idea to develop this as a separate quicklisp package, add it as a sketch dependency, and re-export the symbols. That way, it could be reused by others independently of sketch).

vydd commented

That'd be awesome! Would it be possible to make the noise API the same as the one in processing, and then make noiseSeed and noiseDetail lispier; for example, by using special variables, by using keyword arguments, or by integrating them with sketch slots?

Sure, sounds good. I wasn't aware of the noiseDetail() part of the interface, I'll have to extend my implementation to handle that. Will require some thought to make the interface as lispy as possible.

I've extracted my implementation to a package: https://github.com/Kevinpgalligan/noisy

Pending its addition to quicklisp: quicklisp/quicklisp-projects#2384

Then all that remains is adding a simple noise interface to sketch and writing the docs.