3-Dimensional Fractal

Conor Carroll

"A formula can be very simple, and create a universe of bottomless complexity" - Benoit Mandelbrot

 

I have always loved geometry and shapes, and so for my final project I wanted to explore 3-dimensional fractals (though it's hard to give fractals integer dimension...), as well as produce them. Fractals are objects that are "self-similar", meaning as you zoom in or out, you will continue to see the same underlying system. Additionally, they are repeatedly found in nature because of their stochastic and chaotic structure (check out the Romanesco Broccoli, the Barnsley Fern, and the logarithmic spiral). While the construction I used was not extraordinarly complex, I built a framework in which anyone can easily experiment with a variety of shapes (tetrahedron, cubes, spheres) and positions.

 

The Construction

I created the fractal seen by starting with a cube, and recursively generating cubes of a quarter the size of the original that layed on the center of each face. Surprisingly, Sierpinski's Triangle was immediately seen. More layers of recursion really smoothed out the edges and gave the cubes tetrahedra-like shape. I then animated the situation to have one fractal gradually transition into another. Additionally, I created a layout in which users can easily generate their own fractals with a variety of shapes and tweaking positioning.

 

The Graphics

I implemented what we would consider standard geometry, with movement given from WASD keys, moving up with the space bar, and down with the shift key. Additionally, I implemented a pitch and roll camera that allows the user to move around in the scene, as well as Blinn-Phong shading. A non-trivial addition was the introduction of a geometry shader. My orgignal plan was to perturb and generate more geometry with tessellation shaders, but my version of OpenGL did not support them. Instead, I implemented a geometry shader that sits in between the vertex and fragment shaders. This allowed me to perturb the coordinates of each triange before it was touched by our fragment shader. This allowed me to allow the effect of the fractal exploding on the users click, as well as giving the fractal al less structured, fuzzier feel. One challenge I faced was my computers ability to generate the geometry without slowing down to a crawl. I had to optimize my fractal algorithm and was able to generate only 4,000 triangles while giving the impression that I was drawing 560,000. This was done by only drawing portions of the fractal, which were then copied and re-drawn elsewhere, rather than compounding by recursion calls at each layer.