Fractals

Introduction

My interest with fractals started in 2017 when I was staying with my grandparents, and found an old book of fractals. Finding Daniel Shiffman’s Nature of Code website and The Coding Train YouTube channel soon after prompted me to start writing my own fractal renderers. This post will be a lightning fast review of these renderers and other related experiments.

Buddhabrot
Buddhabrot

Early Fractal Renderers

C# Mandelbrot Java Mandelbrot
Mandelbrot renderers, 2017 (C#, Java, Processing)

My very first attempt used C# and .NET libraries, and was as clunky as it could possibly have been. I then moved onto the more suitable Processing library for Java that I continued to use for many other projects. The Processing version of the renderer could be navigated naturally using the mouse, and had optimizations like increasing the number of iterations (i.e. accuracy of the fractal’s shape) with the level of zoom.

Other Fractals

Dragon Curve L-System Sierpinski Arrowhead L-system Koch Snowflake L-system binary tree Menger Sponge Inverted Menger Sponge
L-Systems, 2017 (Java, Processing)

I came across Lindenmayer Systems and generated a number of different fractals using a basic stack based approach. I also tried rendering the basic Menger Sponge and Inverted Menger Sponge 3D fractals.

I was interested upon revisiting L-Systems to read about their place in the family of formal grammars and variations upon the original formulation. I might explore these further soon.

Better Renderers

Mandelbrot Set Detail Mandelbrot set with too few iterations Mandelbrot set detail red Mandelbrot set high contrast Julia Set Rainbow Julia Set Julia Set for point outside of mandelbrot
Colourful Mandelbrot Sets and Julia Sets, 2018 (Java, Processing)

My next fractal project evolved into my project for A-Level Computing coursework. This is the most fully featured renderer I’ve made so far. It could render the Mandelbrot set and the Burning Ship Fractal, as well as the Julia sets that correspond to each point of those sets. It also had:

  • GUI
  • Two Rendering Windows
  • 3 Levels of Detail
  • Multithreaded Rendering
  • Multiple Colour Palettes
  • Looping Colour Palettes
FracTool Example FracTool Example 2
The FracTool renderer, showing simultaneous views of the Mandelbrot set and a Julia set of a selected point from it, 2018 (Java, Processing)
Burning Ship Fractal Burning Ship Detail Burning Ship Detail 2 Burning Ship Detail Barcode Burning Ship Detail Pillar Burning Ship Detail 3 Burning Ship Julia 1 Burning Ship Julia 2 Burning Ship Julia 3
Burning Ship Fractal, Burning Ship Julia Sets, 2018 (Java, Processing)

Other Escape Time Fractals

There are fractals generated in the same fashion as the Mandelbrot set but with different equations.

Fractal NameEquation
Mandelbrot Setz = z^2 + c
Burning Ship Fractalz = abs(z)^2+c
Multibrot Setz = z^d + c
“Burning” Multibrotz = abs(z)^d+c
Mandelbrot Set Burning Ship Fractal Multibrot d=2 Burning Multibrot d=2 Multibrot d=2.5 Multibrot d=3.5
Mandelbrot, Burning Ship, Multibrot (d=2), Burning Multibrot (d=2), Multibrot (d=2.5), Multibrot (d=3.5) 2018 (Java, Processing)

Buddhabrot

A different method of rendering the Mandelbrot set that I want to explore further in the future. In this method, pixels are coloured based on the frequency of that pixel’s location being “visited” by the iteration of a random sample of points in the complex plane. Only points that escape to infinity (hence are not in the Mandelbrot set) contribute to the frequency counts.

Buddhabrot
Buddhabrot with RGB escape times of 20, 2000, 20000

Next Projects

I’m keen to explore using shaders to exploit parrallel computation and improve the render speed, and signed distance fields (SDFs) for 3D or higher dimensional fractals in my next project. Inigo Quilez has some fantastic resources about SDFs and their uses.