Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correlated randomness #115

Open
Kevinpgalligan opened this issue Nov 9, 2023 · 5 comments
Open

Correlated randomness #115

Kevinpgalligan opened this issue Nov 9, 2023 · 5 comments

Comments

@Kevinpgalligan
Copy link
Contributor

Kevinpgalligan commented Nov 9, 2023

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
Copy link
Owner

vydd commented Nov 9, 2023

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?

@Kevinpgalligan
Copy link
Contributor Author

Kevinpgalligan commented Nov 9, 2023

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.

@Kevinpgalligan
Copy link
Contributor Author

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.

@Kevinpgalligan
Copy link
Contributor Author

'noisy' is now in quicklisp, so I'll work on adding a noise API to Sketch. Should just be a light shim over noisy.

@Kevinpgalligan
Copy link
Contributor Author

Aaaand it's pretty much done: Kevinpgalligan@697b6f1

Just need to add docs, and then there will be a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants