[comp.graphics] Colormaps for Fractals

schwarze@isa.de (Jochen Schwarze) (09/20/90)

For some while now I've been experimenting with various methods to
generate and animate colormaps for fractal images (Mandelbrot Sets,
Julia Sets and the like). I'm wondering what methods others are using
to make good images. Reply to me or to the net, whichever you like. I
will post a summary.

Here are some algorithms that I've found to produce good results.

* Random Colormap Generation

(1) Separate your colormap into a number of blocks of random sizes
    (mininum and maximum sizes configurable).

(2) For each block, chose two colors with random RGB values for the
    beginning and the end of the block.

(3) Linearly interpolate the colors in between.

This algorithm produces colormaps with smooth color transitions within
the blocks and sharp edges between the blocks. The edges enhance the
fractal outline and with each new colormap new shapes are emphasized.

* Surf

(1) Chose a function that produces something like a single wave, e.g.

    	f(x) = sin(x) / (x^2 + 1), -pi <= x < pi.

(2) Map the range [ -pi; pi [ to a fixed number n of steps (16 for a
    colormap of 256 entries is a good value).

(3) Modify the first n entries of your colormap like this: for each
    entry i add c*f(i) to the RGB values of the cell (constant c to
    scale the function values -1..1 to the intensity range of your color
    cells). That means modifying each color towards white for positive
    f(i) and towards black for negative f(i).

(4) Repeat step (3) for colormap entries 1..n, 2..n+1, 3..n+2 and so on.

The visual effect produced is a wave coming from outside the fractal
set and surfing towards the set boundaries.

* Colormap Blending

In addition to the surf algorithm I use B-Spline interpolation to
slowly change the entire colormap from one random colormap to another
(somewhat CPU intensive, so quick effects can't be done this way :-).

Enjoy.
-Jochen
--

Jochen Schwarze                     Domain: schwarze@isa.de
ISA GmbH, Stuttgart, West Germany   UUCP:   schwarze@isaak.uucp
                                    Bang:   ...!uunet!unido!isaak!schwarze