Searching for pleasing looking Flame Fractals

Flame Fractal

Flame Fractals were originally developed by Scott Draves as an extended version of Iterated Function Systems.

Flame Fractal

See this PDF for a more thorough explanation.

Flame Fractal

Visions of Chaos has supported flames for years now, but something I recently revisited was detecting interesting looking flame fractals.

Flame Fractal Settings Dialog

The flame fractals appearance are controlled by the coefficients, probabilities, transformations and multiplier values (the lower table floating point values in the above dialog), but 99% of the time if you just set random values it will lead to boring images. Boring here means an image that is just a few straight lines, a circle, or only a few pixels.

Searching for an interesting flame fractal means repeatedly randomizing the controlling parameters and testing the resulting plotted points. Here is a snippet of code I use to test each random set of parameters.


     xp:=0.05;
     yp:=0.05;
     //skip first 1000 iterations to allow it to settle down
     for loop:=1 to 1000 do iterate_point; 
    
     repeat
           thisxp:=xp;
           thisyp:=yp;

           //iterate the next point
           iterate_point;

           //test if tending to a point
           if (abs(thisxp-xp)<1e-10) and (abs(thisyp-yp)<1e-10) then
           begin
                TestFlameParameters:=false;
                exit;
           end;

           //check if unbounded, ie values are getting too large
           if (abs(xp)>10000) or (abs(yp)>10000) then
           begin
                TestFlameParameters:=false;
                exit;
           end;

           //check for NAN
           if (isnan(xp)) or (isnan(yp)) then
           begin
                TestFlameParameters:=false;
                exit;
           end;

           //check for INF
           if (isinfinite(xp)) or (isinfinite(yp)) then
           begin
                TestFlameParameters:=false;
                exit;
           end;

           //count pixels that fall within the image area
           if (xp<xmax) then
           if (xp>xmin) then
           if (yp<ymax) then
           if (yp>ymin) then
           begin
                xplot:=trunc((xp-xmin)/abs(xmin-xmax)*width);
                yplot:=trunc((yp-ymin)/abs(ymin-ymax)*height);
                hitpixelscount[xplot,yplot]:=hitpixelscount[xplot,yplot]+1;
           end;

           inc(pointcount);

     until (pointcount=250000);

     //count pixels hit
     hits:=0;
     for y:=0 to height-1 do
         for x:=0 to width-1 do
             if hitpixelscount[x,y]>5 then inc(hits);
     if hits<trunc(width*1.5+height*1.5) then
     begin
          TestFlameParameters:=false;
          exit;
     end;
     //if it got to here then the tests all passed

The tests included in the code and the ones I found most useful are;

1. Detect tending to a single point. A lot of flames result in the iterations being attracted to a single point/pixel.
2. Unbounded. Points continue to grow outwards to infinity.
3. NAN and INF. If the floating point math returns a NAN or INF.
4. Count pixels hit. If the resulting image has too few pixels the flame picture will be boring. Counting the pixels helps detect and avoid these flames.

Using those 4 checks will skip hundreds (at least in my case) of parameters that fail one or more of the above tests. The result is when looking for new random flame fractals you skip the boring point-like and line-like displays.

The following screen shot of the flame mutator in Visions of Chaos shows a series of flames that all passed the tests. They may not all be interesting aesthetically, but there are no minimal results with just a small number of pixels.

Flame Fractal Mutator Dialog

I did also experiment with lyapunov values, ie
http://technocosm.org/chaos/attr-part2.html
http://sprott.physics.wisc.edu/software.htm
but in my tests they are too unreliable to detect good vs boring flames.

Flame Fractal

If you know of any other reliable ways to detect good vs bad/boring flame fractals, let me know by email or reply to this post.

Flame Fractal

Jason.