Return to site

2D fractal inspired patterns in Blender

With Animation Nodes

December 17, 2020

In this tutorial we are going to be using the Animation Nodes add-on to create 2D fractal inspired patterns in Blender. This tutorial is not require any programming or scripting. I have used Blender 2.81 and Animation Nodes with Extra Nodes. The add-on can be found here. Note that any images on this page can be clicked to view in full size.

The basic algorithm goes something like this:

  1. Take a shape of n sides
  2. Iterate over each corner
  3. Place a copy of the shape at reduced scale

These steps are repeated for each new shape over how ever many iterations you would like. Please note, these are inspired by n-flakes but are not true n-flakes. Why? N-flakes have a stipulation that successive shapes must touch but not overlap, and the patterns we are creating here certainly do.

The network that we're going to create in animation nodes uses splines. First we make the base shape with n number of sides. We then iterate over the points that make up that shape and create copies of the basic shape scaled down by our scaling factor formula found here. We use the object instance node to create copies and some vector math to scale the shapes down. One thing you might want to know is that loops do not work if you're using an object instance node, so to get multiple iterations you take copies of the base network and connect them together to get the number of iterations you want.

The number of iterations that you can create depend on your machine. The more iterations you try the more work your computer must do to calculate and create the pattern. I've only done about three iterations in this example. The way I have set out the network is such that you will very easily change the size and shape you have. I have even stuck in a little animation the end that use these options to very easily phase through different n-gon patterns.

I have broken the overall network up into different blocks. The first yellow block is simply for our input data such as the number of sides, radius, location and angle of our base object. The red block creates the initial object out of splines. The green block calculates the scale of the new objects according to the scaling formula. The purple block is a loop that assigns the new objects at the desired points. The orange box mainly applies the scale factor of the new objects calculated from the subprogram in the green box. The blue box shows how to connect up impromptu 'loops' so that you can recursively apply the n-flake algorithm.

 

The only things that should be changed are in the yellow box. There are some small things in the others that you can change without breaking the network but if you're not sure of what you're doing I suggest that you leave these things alone. I have added some small animations to the end of this page. I am working on making true n-flake fractals in 2D and 3D in Animation Nodes and will endeavour to create a write-up for them on this site when they are complete. Feel free to email me if you have any questions or would like to comment on this tutorial or site.

 

As always, stay safe and happy holidays. :)

 

- Kit