This project is an SDL2 based implementation of the Worley noise algorithm. The algorithm is simple, but creates some really interesting patterns, and offers plenty of opportunities for customization to create your own designs. This code can generate rapid flashing lights if you tell it to. If that is something that should be avoided, I have some lovely 5 fps examples below that may offer a safer alternative.
https://en.wikipedia.org/wiki/Worley_noise
The project uses SDL2 to handle the rendering.
Command line arguments
Argument | Description |
---|---|
-points X | Generate X central points for Worley noise algorithm |
-w X | Set window width to X |
-h X | Set window height to X |
-d X | Set image depth (Z-axis) to X |
-seed X | Use X as the seed for random point placement |
-threads X | Number of threads to use for Worley noise algorithm |
-s X | Set speed of central points in pixels/frame |
-invert | Invert colors displayed |
-colorcycle | Rotate intensity of RGB values |
I was first introduced to Worley noise by The Coding Train's video on the topic where he does a great job on explaining it. I've placed a link below for both his video, and his code examples hosted on Github.
Coding in the Cabana 4: Worley Noise
https://github.com/CodingTrain/WorleyNoise
Most of my knowledge for working with SDL comes Lazy Foo's tutorial series where they have dedicated a lot of time and effort to creating some great lessons.
To parse command line arguments, I am using a snippet iain provided on stackoverflow that does a nice job. https://stackoverflow.com/questions/865668/how-to-parse-command-line-arguments-in-c
These recordings aren't really the best for displaying the output, but I've put together a couple examples from different configurations I've tried. You should get a much cleaner result if you run the code natively.
d1 Worley noise generation with and without a specified depth.
Multi-threaded runs: two threads vs four
Output with inverted colors and mixture of distance settings