ChaosGameFractals: Creating Beautiful Fractal Patterns with Java and Processing

ChaosGameFractals is a software project I developed to create beautiful and intricate fractal patterns through a simulation that follows the rules of the chaos game algorithm. Inspired by a YouTube video by Numberphile, I became curious about what the resulting images would look like when colored using a gradient map.

Initially, I considered writing shader code to achieve the effect, but ultimately decided to use Java and Processing 3 as my rendering framework since I was already familiar with them and wanted to finish the program quickly.

The chaos game algorithm is a mathematical process used to generate fractal patterns. To create a fractal image, the algorithm repeatedly chooses a random point within a defined region and moves halfway towards a fixed point, creating a sequence of points that trace out a fractal pattern. In my program, the output image is constantly rendered, allowing users to preview the fractal.

The program simulates multiple chaos games in parallel on different threads and keeps track of the number of times each pixel in the output image has been hit during the chaos game simulation. This information is then used to select the color for each pixel from a gradient file that is included in the program. The gradient file contains multiple gradients and the user can choose between them during simulation. This allows users to experiment with different color schemes and gradients to create a variety of striking and unique fractal images.

In the future, I plan to rewrite the program in Rust using the wgpu library to take advantage of the GPU for faster and more efficient simulations. I also plan to create a proper GUI for the program, which will include more customization options such as editing the gradient or changing the resolution on the fly. Additionally, I plan to add the ability to simulate the chaos game algorithm in different shapes beyond regular polygons.

Overall, I am proud of what I have accomplished with ChaosGameFractals, and I believe it demonstrates my programming skills and creativity. If you’re interested in trying out the program for yourself, the code is available on GitHub.

Leave a Reply

Your email address will not be published. Required fields are marked *