Worley Noise in C++
The principles of noise that resembles natural behavior and that are better acceptable by human senses I discussed in one of my previous articles. I display the beauty of the Perilin noise which is commonly used in computer graphics.
The following article can be considered as a continuity of this discussion, however, I am going to depict the Worley Noise that was pioneered by Steven Worley in 1996. Here is a paper where you will find other consistent information.
The Worley noise is mostly targeted for object rendering however as was discussed in this paper, it has the potential for creating electronic art.
In that paper, Carl-Johan Rosén classifies the Workley noise as the cell noise.
The implementation of the algorithm I made in C++ with the visualization in ImGui. The introduction to the C++ ImGui and information on how to compile and build programs you will find in one of my previous articles.
The source for this article you will find on my GitHub.
The creation of Worley noise is straightforward, and it does not require tedious calculations or implementations.
The fundamental principle of Worley noise is to disperse a variable number of feature points in space (randomly initialized) and determine the distances to each one of those points from every other location. Then, this may be successfully applied to replicate a variety of things, including cell-like structures. Worley in his paper goes on to explain how to connect each feature point with a unique ID number as an addition to this fundamental principle. Depending on the coloring function, this number can be used to create a surface with solid colored sections that resemble military canvas or glass mosaic.
For the simulation purpose I applied one color and connect the distance between randomly generated points (use the slider and change the number) in the canvas( 500x500 pixels) to the transparency of the pixel. A shorter distance to the particular pixel affects the bigger factor of transparency applied (the background is more visible).
Please note there is a heavy computation since for each random point the algorithm has to compute the distance to each point (pixel of the canvas/matrix).
The distances for each random point (red dot) are stored in a vector container and later ascending sorted. The first value of the sorted vector decides the “transparency factor” for the particular pixel.
Below I depicted simulations of different numbers of randomly generated dots (the position of the dot is random).
Thank you for reading.