Barnsley Fern 
Barnsley fern is a 2D fractal which looks like a fern, and more precisely like Asplenium adiantum-nigrum; in fact, the fractal has been tweaked to appear like this fern species. It was first described by Michael Barnsley, therefore the name “Barnsley fern”.
The process to build the fractal is rather simple:
- Step 1 Start with a single point at position (0,0) in a blank 2d space.
- Step 2 Randomly pick one of the 4 affine transformations defined below, taking account of the given probability of selection.
- Step 3 Apply the transformation on the last point considered. Draw the resulting point.
- Step 4 Repeat several times from step 2, the number of times depending on the desired level of precision.
Here are the affine transformations we are talking about:
Transformation 1 with probability of selection 0.01:
Transformation 2 with probability of selection 0.85:
Transformation 3 with probability of selection 0.07:
Transformation 4 with probability of selection 0.07:
JWildfire is a free software that allows you to create what’s called fractal flames. Fractal flames are a subset of fractals, and you can find more information on wikipedia.
JWildfire is a java based application, and you’ll need to have the java runtime environment (jre) installed beforehand to run the free version. You can check if the jre is already installed by typing
java -version in a terminal; this should work as well on windows, linux and macos. If the command fails, the jre is not installed and you can download it from the oracle official website.
You can then download jwildfire on the jwilfire official website. If you want the free version, click on the download link which require a separate java installation. You’ll then download a zip archive file. Extract it somewhere in the filesystem.
In the extracted folder, you’ll find two executables :
j-wildfire-launcher.jar. You can use the first one if you use the windows operating system, or the second no matter your operating system. To use the second one, if you can’t execute it in the same way you would execute any other program, open a terminal, moves inside the folder using the
cd command or the
dir command for windows users, and then type
java -jar j-wildfire-launcher.jar; this should execute the program.
You will get a window asking you how much ram memory you want to dedicate to jwildfire. You can let it by default and simply press start. If it doesn’t find the java virtual machine, you may need to specify the location by hand.
Drawing the fern
As you can see, once it started, jwildfire will already generate some random fractals. Since we would like to create the barnsley fern, and not a random fractal, click on “New file from scratch”. This will display a blank image, which is normally black by default.
In reality the space already contain a point at (0,0), but it is not displayed; this can be discouraging sometimes, as we don’t see the effect of the transformation we are trying. To avoid this problem, an idea is to temporarily insert a small plain circle at (0,0). To do that, in the transformations panel, click on add, change the transformation to circleblur, and give it a small size like 0.01.
Now, we can add the 4 affine transformations.
Little note on Linear3D
I believe the transformation is called linear3D, because it allows to do a rotation, a scaling and also a translation, which you cannot do with a linear2D operation. If you think about it, multiplying a 2x2 matrix with a point only allows to do rotations and scaling of that point arround the origin (0,0); but their is a trick which allows you to multiply a 3x3 matrix with a 2D point (a temporary third component equal to 1 is added to the point to allow this), and this operation is able to do not only a scaling and a rotation, but a translation as well. For instance, the following 3D linear operation on the (x,y) point, will translate it by the vector (tx, ty):
Click again on the add button. This will add a linear3D transformation. Linear3D is a transformation which can perform scaling, rotation and translation on the points. In the “Affine” tab of the transformation, we can add the details of the transformation. The O1 and O2 parameters specify the translation, and X1, X2, Y1 and Y2 specify the values of the 2D matrix representing the scaling and rotation. We’ll start with the second transformation, because the order doesn’t really matter, and because the first transformation is not visible when alone. Enter the values as so (the values are in the same disposition as in the transformations formulas we presented previously):
Also set the transformation weight to 0,85 as on the image (the weight determine the probability of a transformation to be selected in an iteration of the rendering process).
Finally, in the “color” tab, set the color type to “TARGET”, and choose whatever color you would like, like green for instance.
Now, click on the editing mode icon , which allows you to zoom and move the space, in order to have a better view of what we are drawing.
You can then click again on this icon:
Some say that this transformation is responsible for drawing the stem general shape. However, this is a little simplistic, because the transformation does not only apply on the points we are seing now, but also on the other points we are going to see later.
Do similarly as we did before for the three remaining transformations. To create the other transformations, instead of using the “add” button, you could use the “duplicate” button; this makes it easier as the color setup will be duplicated. Here are some screenshots showing the parameters for each of the 4 transformations:
Now we should see the fern. You can delete the circleblur transformation, in case you used it. Here is the result:
Changing the background color
In case you want change the background color (for instance to print it), go to the “Coloring” tab at the bottom of the application. Set “Bg color” to “SINGLE_COLOR”, and then set the color to white like so:
Render the fractal
You have the possibility to save the fractal in the flame format. You can also render it as an image; you can choose the resolution as well as the quality (e.g. the number of iterations).