Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For all the creative people out there: coloring mandelbrot set... need ideas

Given max amount of iterations = 1000 give me some ideas on how to color (red, green, blue) it. All I can come up right now are lame 2 color gradients :(

Is it actually possible to come up with something as beautiful as this?

enter image description here

like image 506
Carpe Diem Avatar asked Apr 17 '11 12:04

Carpe Diem


2 Answers

Darn they won't let me a newbie post images, but to see the effect of my colouring try this link

click to see my mandelbrot, when there right click to view larger sizes

My technique is to use all the available colours of the colour cube for the 228 palette indexes of Fractal extreme. Using a spreadsheet (OpenOffice) I take a linear sample of the 24bit values. I slice 1 bit from each RGB component (ie top bit) to form a 3bit RGB value. Translate the 8 3bit colours using vlookup into a sequence like white, magenta, red, yellow, black, blue, cyan and green. I then copy and paste as values so I can then sort the top bit sequence by the 7th bit ...

Want to know the details?

Synthesizing the 24 bit RGB values is simple.
Colum A has numbers from 0 to 227, =ROW()-2
This is converted to 24bit in column B =ROUND(A2*16777215/227).
Column C converts to Hex =DEC2HEX(B2;6)
Column D extracts the red component and converts to decimal =HEX2DEC(LEFT(C2;2))
Similar for column E green =HEX2DEC(MID(C2;3;2)) and F blue =HEX2DEC(RIGHT(C2;2))
G slices the top bits and converts to a 3bit RGB
=BIN2DEC(LEFT(DEC2BIN($D2;8);1)&LEFT(DEC2BIN($E2;8);1)&LEFT(DEC2BIN($F2;8);1))
H the 7th bit slice
=BIN2DEC(MID(DEC2BIN($D2;8);2;1)&MID(DEC2BIN($E2;8);2;1)&MID(DEC2BIN($F2;8);2;1))
I the 6th bit slice
=BIN2DEC(MID(DEC2BIN($D2;8);3;1)&MID(DEC2BIN($E2;8);3;1)&MID(DEC2BIN($F2;8);3;1))
and so on till the Lowest bit column N
=BIN2DEC(RIGHT(DEC2BIN($D2;8);1)&RIGHT(DEC2BIN($E2;8);1)&RIGHT(DEC2BIN($F2;8);1))

Now to translate this 3bit RGB into a colour sequence I have another tab in the spreadsheet called "3bit sort".
In column H the formula is =VLOOKUP(G2;'3bitsort'.$B$62:$C$69;2;0).
Rows b62 to b69 have the values 0, 1, 3, 2, 7, 5, 4, 6
Rows c62 to c69 have the values 0, 1, 2, 3, 4, 5, 6, 7
So the formula translates the 3bit RGB value into its place in the sequence black, blue, cyan, green, white, magenta, red and yellow.
I do similar for the 7th thru 1st bits in columns P to V.

Now copying and pasting as values to sort on these sequenced colours would be okay but tends to have a sharp cutoff between colours. A simple sort by H by I by J... would result in top bit green 7th yellow sequenced next to top bit white 7th bit black. It would make for a smoother transition if the top bit green 7th bit white were sequenced next to top bit white 7th bit green. So I do a 2nd level of translation. This needs to translate to a different sequence based on what the higher bits colour was.
For each colour, across the columns in "3bit sort" I create additional translation sequences based on what colour the next higher bits were.
Colum W =VLOOKUP(H2;OFFSET('3bit sort'.$E$62;0;3*O2;8;2);2;0)
The offset looks to the right of the sequence in b62:c59 used before to where I have set up the sequences I want.
O2 is the translated colour of the top bit, for green thats 3 so 9 columns to the right of b62:b69 are columns n62:n69 which contain the sequence 3, 1, 2, 6, 4, 0, 5, 7
o62:o69 contain the translated sequence 0, 1, 2, 3, 4, 5, 6, 7.
So if the 7th bits are white the whitest green gets sorted last.
For q62:q69 contain 2, 1, 3, 7, 0, 6, 4, 5 so the greenest white can be sorted next to the whitest green.
Copying and pasting as values then sorting by 8bit translate then by the 7th bit table indicated by the 8th bit and the 6th idicated by the 7th and so one gives a nice smoothed transition.

But I don't stop there.

Fractal Extreme can interpolate colours when the colours are spread across many iterations. The above picture has minimum iterations of 12939 and maximum of 27609 so each colour from the 228 index palette table is smeared across dozens of iterations. Fractal Extreme also has a feature where every odd colour index can come from a 2nd palette table. This gives a stripe effect. I offset the stripe palette by 16 positions, that gives the interpolation a bit of difference between colours to work with.

And that's how a legacy database hack colours a mandelbrot, he uses a spreadsheet.

like image 192
Jeremy Thomson Avatar answered Oct 04 '22 23:10

Jeremy Thomson


50 iterations is very, very coarse and you won't get much detail.

The easiest way to get the spectrum is to use multiple two-color gradients. So, 50-41 iterations might be shades of blue, 41-30 might be blue-red, and 29-10 might be red-green, and 9-0 might be green-white.

An RGB monitor's gamut is triangular, so such a scheme pretty much follows the outside of the "color wheel."

A search for HSV RGB library might turn up tools to help use the easier HSV color system.

like image 21
Potatoswatter Avatar answered Oct 04 '22 22:10

Potatoswatter