Like many people, I've been fascinated by the images of ferns generated by computer using the mathematics of fractals. When I mentioned to a friend that I was developing a series of Web pages on ferns, he suggested I also include a piece on fractal ferns (thanks HR). This page is the result. Put simply (probably a gross oversimplification), fractals generate points to plot on a graph that are the result of iterated calculations. The answer from one calculation is used as the input value to the next calculation. The beautiful Madelbrot images are generated by programs that assign a colour to any point on the graph, depending on how that point behaves when it is used as a starting point for the calculations. One sort of fractal is known as the Iterated Function System, or IFS. This fractal system was first explored by Michael Barnsley at the Georgia Institute of Technology in the 1980s. You start with shapes plotted on a graph, and iterate the shapes through a calculation process that transforms them into other shapes on the graph. Starting with four shapes, one of which is squashed into a line segment (this becomes the fern's rachis or stalk), you apply the shapes to the calculation to generate more shapes, feed them back into the calculation process, etc. Eventually a pattern emerges that bears a startling resemblance to a fern, if you choose the right starting shapes and positions. The longer you continue the iteration process, the more intricate the tiny detail in the pattern becomes. A characteristic of this and other fractals is that the pattern repeats itself in the finer and finer detail. I think it was Swift in 1733 who anticipated it:
Big fleas have little fleas Barnsley generated the fractal
pattern that's now known as The starting shapes for Barnsley's Fern can be specified as a series of 28 numbers to feed into the calculation process. These are as follows: 0 0 0 .16 0 0 .01 .85 .04 -.04 .85 0 1.6 .85 .2 -.26 .23 .22 0 1.6 .07 -.15 .28 .26 .24 0 .44 .07 The four lines correspond in general terms to the rachis of the fern (first row), the overall form of the frond (second row), the left hand first pinna (third row) and the right hand first pinna (final row). The first four columns correspond (roughly) to things like the length of the pinna, the sparseness and width of the pinnae, the curve of the frond and pinnae etc. The exact relationships are very complex. The fifth column is a list of probabilities that tell the calculation process how often to use the particular rows. It gives the balance to the final picture. Transforming these iteratively is simple but exceedingly labor intensive. Just the job for a computer. There's a very handy program for the PC that allows you to calculate and plot IFS fractals, including fern-like fractals. It's called Fractint, and you can download it for free here. Unfortunately it doesn't run on the Mac. It's available in a DOS version and one for Windows (3.1 or 95). I used the Windows version to explore the sorts of fern images that you can generate. The program creates screen images of the results of the iterations. With a bit of care, you can tell the program to choose colour schemes and contrast settings to create much prettier images that the one above, which is what usually shows up as the output. You can save the images to disk and process them through any of several graphics programs to create even prettier images. My first attempt at manipulating the crude output looks like this: Barnsley's Fern - enhanced imageI used Paint Shop Pro 4 and iXla Artist to tinker with the output from Fractint. Adobe Photoshop would be even better, but it's a more complex program to use. By changing the starting parameters, you can change many of the characteristics of the "frond" shape. My first experiment with this process was to modify the parameters for Barnsley's Fern to adjust the pinnae arrangements. It came out like this (after rotation of the image in the graphics program): Barnsley's Fern - modified pinnaeThere are strong similarities between the two, but notice a different pinna arrangement next to the rachis. This difference is the result of the changes I made to the parameter list. The parameters I settled on for this image are: 0 0 0 .2 0 -0.12 .01 .845 .035 -.035 .82 0 1.6 .85 .2 -.31 .255 .245 0 .29 .07 -.15 .24 .25 .20 0 .68 .07 The numbers are roughly the same as the first set, in most places. The main difference is in the fourth and fifth rows, sixth column, where the numbers are substantially different, both relative to each other and in absolute terms. The other changes are more in the nature of "tweaks". Again, I used PSP4 and iXla to enhance the image. Note that I've only changed the contrast levels, colours, sharpness and rotation of the image. I didn't hand-draw anything. It's all computer generated points, using the parameter lists. Encouraged by this success, I worked out by trial and error what each element in the array of numbers would do if you changed it. Fractint allows you to input different sets of numbers from a file called fractint.ifs, which you can edit with a text editor. So I edited each element in the "fern" section of the file, ran it through Fractint and found what the result was. I generated some extremely un-fernlike images in the process! One or two looked like palm fronds, but others were strange mutants. One problem I found was that the parameters are not entirely independent of each other, so when you change one, you may need to compensate a little using changes to other parameters (for example, to re-attach pinnae to the rachis!) This makes for slow progress. After I got the feel for the parameters and how sensitive they were to changes, I was able to create totally new fern-like images. The first was one that looks
vaguely like Another fractal fern - Culcita sp? The parameters for this image are: 0 0 0 .25 0 -.14 .02 .85 .02 -.02 .83 0 1 .84 .09 -.28 .3 .11 0 .6 .07 -.09 .28 .3 .09 0 .7 .07 Then I wondered if you could generate fronds of the "fishbone fern" kind. I knew this would have to be an approximation, as the fractal ferns have (in theory) pinnules on pinnules on pinnules etc, while real ferns stop at some point. Fishbone ferns stop at the first set of pinnae, which makes things a bit tricky. However, the infinite detail
possible in fractals is only available if you keep calculating indefinitely.
Stopping at a certain point limits the level of detail you reach. You
can set an arbitrary level of detail by deciding on how many calculation
iterations you use. (I used between 150 and 2000 iterations for all
of these images). Further, the screen pixel size and the graphics plot
resolution also cut out detail below a certain point. I made use of
this by creating detail so fine it didn't show up on the image (well,
nearly). Again I processed the image through the graphics programs,
and the result looks a bit like a cross between a The parameters for this "fern" are: 0 0 0 .25 0 -.4 .02 .95 .002 -.002 .93 -.002 .5 .84 .035 -.11 .27 .01 -.05 .005 .07 -.04 .11 .27 .01 .047 .06 .07 On the way to the last image, I
came across a set of parameters that created an image reminding me of
the The parameters for this image are: 0 0 0 .25 0 -.4 .02 .95 .005 -.005 .93 -.002 .5 .84 .035 -.2 .16 .04 -.09 .02 .07 -.04 .2 .16 .04 .083 .12 .07 ## ShortcomingsThe IFS fractal system as I've used it here (and maybe under all circumstances) is not able to generate "real" ferns. You may have noticed the pinna length always decreases toward the tip: it never grows and contracts again. The structure of the pinnae is always fully detailed. It doesn't simplify as you approach the tip. The pinna angle doesn't vary along the frond. And so on. These are limitations of the very simple process we're using. But when you consider that all these images are specified by only 28 numbers, it's quite remarkable what you can generate. In this exercise, I've not attempted the "3D" fern images that are possible using Fractint. The process is similar to the 2D images, but more complex. Maybe later. ## Other types of fractal fernsThere are other ways of plotting fern-like images from simple formulae. Another one you can try with Fractint is known as the L-System. This is a set of instructions that tells the computer to plot a short line, turn a corner (of a prescribed angle), plot another line, turn again, and so on, until a given point is reached, then go back and draw another set of connected lines, starting back near the beginning of the first line series, and so on. Depending on what angles, line lengths and re-start conditions you set, you can create images that look quite fern-like. One of the L-system routines available in the file plants.l, available from the Fractint home page, is called "Leaf1". If you set the "order" to 34 (which tells it how far to go down the line segment series) you get something that looks like this: L-System leaf, Order=34The formula for Leaf1 is: Leaf1 { angle 8 axiom x a=n n=o o=p p=x b=e e=h h=j j=y x=F[+A(4)]Fy y=F[-B(4)]Fx F=@1.18F@i1.18 } There's a tutorial on L-Systems on the Fractint homepage (below). ## Further ReadingThere is a lot of information on the Web about fractals, though not much dedicated to fractal ferns. If you want more background, a good place to start is the Fractint homepage. According to the Fractint page, there's someone out there called Bruce Goren, who does beautiful 3-D fern images, but I've not seen any of his work on the Web to date. And now another place to look: Laurens Lapré's Lparser page. Some fascinating 3-D stuff and free PC software. I've not tried it but the images are beautiful. Some fern images, too: see the Gallery page. This is a site to explore if you really want to get into 3-D L-systems computing, with many links. |