Fractal flame
Encyclopedia
Fractal flames are a member of the iterated function system
Iterated function system
In mathematics, iterated function systems or IFSs are a method of constructing fractals; the resulting constructions are always self-similar....

 class of fractal
Fractal
A fractal has been defined as "a rough or fragmented geometric shape that can be split into parts, each of which is a reduced-size copy of the whole," a property called self-similarity...

s created by Scott Draves
Scott Draves
Scott Draves is the inventor of Fractal Flames and the leader of the distributed computing project Electric Sheep. He also invented patch-based texture synthesis and published the first implementation of this class of algorithms...

 in 1992. Draves' open-source code was later ported into Adobe After Effects
Adobe After Effects
Adobe After Effects is a digital motion graphics and compositing software published by Adobe Systems, used in the post-production process of filmmaking and television production. Its main uses are the origination of 2D and 2.5D animation, visual effects compositing and finishing...

 graphics software and translated into the Apophysis fractal flame editor.

Fractal flames differ from ordinary iterated function systems in three ways:
  • Nonlinear functions are iterated
    Iteration
    Iteration means the act of repeating a process usually with the aim of approaching a desired goal or target or result. Each repetition of the process is also called an "iteration," and the results of one iteration are used as the starting point for the next iteration.-Mathematics:Iteration in...

     instead of affine transforms
    Affine transformation
    In geometry, an affine transformation or affine map or an affinity is a transformation which preserves straight lines. It is the most general class of transformations with this property...

    .
  • Log-density display instead of linear or binary (a form of tone mapping
    Tone mapping
    Tone mapping is a technique used in image processing and computer graphics to map one set of colors to another in order to approximate the appearance of high dynamic range images in a medium that has a more limited dynamic range...

    )
  • Color by structure (i.e. by the recursive path taken) instead of monochrome or by density.


The tone mapping and coloring are designed to display as much of the detail of the fractal as possible, which generally results in a more aesthetically pleasing image.

Algorithm

The algorithm consists of two steps: creating a histogram and then rendering the histogram.

Creating the histogram

First one iterates a set of functions, starting from a randomly chosen point P = (P.x,P.y,P.c), where the third coordinate indicated the current color of the point.
Set of flame functions:

In each iteration, choose one of the functions above where the probability that Fj is chosen is pj. Then one computes the next iteration of P by applying Fj on (P.x,P.y).

Each individual function has the following form:


where the parameter wk is called the weight of the variation Vk. Draves suggests
that all :s are non-negative and sum to one, but implementations such as Apophysis do not impose that restriction.

The functions Vk are a set of predefined non-linear functions.
A few examples are
  • V0(x,y) = (x,y) (Linear)
  • V1(x,y) = (sin x,sin y) (Sinusoidal)
  • V2(x,y) = (x,y)/(x2+y2) (Spherical)


The colour P.c of the point is blended with the color associated with the latest applied function Fj:
P.c := (P.c + (F_j)color) / 2


After each iteration, one updates the histogram at the point corresponding to (P.x,P.y). This is done as follows:


histogram[x][y][FREQUENCY] := histogram[x][y][FREQUENCY]+1
histogram[x][y][COLOR] := (histogram[x][y][COLOR] + P.c )/2


The colours in the image will therefore reflect what functions that was used to get to that part of the image.

Rendering an image

To increase the quality of the image, one can use supersampling
Supersampling
Supersampling is an antialiasing technique, the process of eliminating jagged and pixelated edges . It is a method of smoothing images rendered in computer games or other programs that generate imagery.-Overview:...

 to decrease the noise. This involves creating a histogram larger than the image so each pixel has multiple data points to pull from.

For example, creating a histogram with 300×300 cells in order to draw an 100×100 px image. Each pixel would use a 3×3 group of histogram buckets to calculate its value.

For each pixel (x,y) in the final image, do the following computations:


frequency_avg[x][y] := average_of_histogram_cells_frequency(x,y);
color_avg[x][y] := average_of_histogram_cells_color(x,y);

alpha[x][y] := log(frequency_avg[x][y]) / log(frequency_max);
//frequency_max is the maximal number of iterations that hit a cell in the histogram.

final_pixel_color[x][y] := color_avg[x][y] * alpha[x][y]^(1/gamma); //gamma is a value greater than 1.


The algorithm above uses gamma correction
Gamma correction
Gamma correction, gamma nonlinearity, gamma encoding, or often simply gamma, is the name of a nonlinear operation used to code and decode luminance or tristimulus values in video or still image systems...

 to make the colors appear brighter. This is implemented in for example the Apophysis software.

To increase the quality even more, one can use gamma correction on each individual color channel, but this is a very heavy computation, since the log function is slow.

A simplified algorithm would be to let the brightness be linearly dependent on the frequency:


final_pixel_color[x][y] := color_avg[x][y] * frequency_avg[x][y]/frequency_max;

but this would make some parts of the fractal lose detail, which is undesirable.

Density Estimation

The flame algorithm is like a Monte Carlo simulation, with the flame quality directly proportional to the number of iterations of the simulation. The noise that results from this stochastic sampling can be reduced by blurring the image, to get a smoother result in less time. One does not however want to lose resolution in the parts of the image that receive many samples and so have little noise.

This problem can be solved with adaptive density estimation to increase image quality while keeping render times to a minimum. FLAM3 uses a simplification of the methods presented in *Adaptive Filtering for Progressive Monte Carlo Image Rendering*, a paper presented at WSCG 2000 by Frank Suykens and Yves D. Willems. The idea is to vary with width of the filter inversely proportional to the number of samples available.

As a result, areas with few samples and lots of noise get blurred and smoothed, but areas with lots of samples and low noise are left unaffected. See http://code.google.com/p/flam3/wiki/DensityEstimation.

Not all Flame implementations use Density Estimation.

See also

  • Apophysis, an open source fractal flame editor for Microsoft Windows.
  • Electric Sheep
    Electric Sheep
    Electric Sheep is a distributed computing project for animating and evolving fractal flames, which are in turn distributed to the networked computers, which display them as a screensaver.-Process:...

    , a screen saver created by the inventor of fractal flames which renders and displays them with Distributed computing
    Distributed computing
    Distributed computing is a field of computer science that studies distributed systems. A distributed system consists of multiple autonomous computers that communicate through a computer network. The computers interact with each other in order to achieve a common goal...

    .
  • GIMP
    GIMP
    GIMP is a free software raster graphics editor. It is primarily employed as an image retouching and editing tool and is freely available in versions tailored for most popular operating systems including Microsoft Windows, Apple Mac OS X, and Linux.In addition to detailed image retouching and...

    , a free software
    Free software
    Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

    , multi OS image manipulation program that can generate fractal flames.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK