News: Support us via Flattr FLATTR Link

## The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!

 Pages: [1]   Go Down
 Author Topic: Generating RGB values from mu  (Read 1144 times) Description: 0 Members and 1 Guest are viewing this topic.
blastoff
Guest
 « on: August 14, 2012, 08:44:14 AM »

Hi, first post

I'm new to this, so please direct me to the right place if this isn't a question for this part of the forum.
(By new to this I mean the last fractal program I wrote was in 1988 on a 286 which had a 4 colour monitor -- 3 of the colours were shades of orange. So, I'm a little rusty)

I'm keen to use smooth coloring (which I haven't done before) for the Mandelbrot set, and many sites mention:
mu = N + 1 - log (log  |Z(N)|) / log 2

My question is though...
What do I do with mu to generate RGB colours (that is, each channel) for each pixel?
(I have to use RGB - can't use HSV for this project)

I'd prefer not to use a table of values. I've tried that and it's limited by the number of iterations.
In my program the maximum number of iterations is increased automatially depending on the zoom level - so a fixed table of values isnt practical, for long any way.

One thing I've tried (with mixed results) is to use a formula for each RGB value. For example:
r = (sin(0.1*mu) +1)*127
with different values (or cos) for the other channels.

I'm hoping someone has other suggestions.
Thanks.
 « Last Edit: August 14, 2012, 08:50:53 AM by blastoff » Logged
cKleinhuis
Fractal Senior

Posts: 7044

formerly known as 'Trifox'

 « Reply #1 on: August 14, 2012, 09:28:35 AM »

Interpolate your table values, mu isbetween zero and one i think
So if you have two rgb colors you can simply linear interpolate both corresponding to your value

higher bailout values work bestwith such coloring

Linear interpolation is easy

a+t*(b-a)

Where t is a value between 0 and 1 a,b are the values for each color channel

and youcan easily include more than just two colors in yourtable

p.s. Be sure to comment my chaostv issues in youtube or here
 Logged

---

divide and conquer - iterate and rule - chaos is No random!
blastoff
Guest
 « Reply #2 on: August 14, 2012, 10:30:52 AM »

Thanks... unfortunately, I don't understand
 Logged
cKleinhuis
Fractal Senior

Posts: 7044

formerly known as 'Trifox'

 « Reply #3 on: August 14, 2012, 11:21:38 AM »

you have to color values c1, c2, each is in array of a byte 0..255, i use red,green and blue as array indizes
you have an distance estimation value between 0 and 1 lets call it t

to get your final color calculate:

newRed=c1.red+t*(c2.red-c1.red)
newGreen=c1.green+t*(c2.green-c1.green)
newBlue=c1.blue+t*(c2.blue-c1.blue)

and et voilá you get a new color, and have decent method for changing the color of your rendering ...
 Logged

---

divide and conquer - iterate and rule - chaos is No random!
David Makin
Global Moderator
Fractal Senior

Posts: 2286

 « Reply #4 on: August 14, 2012, 06:48:09 PM »

Hi, first post

I'm new to this, so please direct me to the right place if this isn't a question for this part of the forum.
(By new to this I mean the last fractal program I wrote was in 1988 on a 286 which had a 4 colour monitor -- 3 of the colours were shades of orange. So, I'm a little rusty)

I'm keen to use smooth coloring (which I haven't done before) for the Mandelbrot set, and many sites mention:
mu = N + 1 - log (log  |Z(N)|) / log 2

My question is though...
What do I do with mu to generate RGB colours (that is, each channel) for each pixel?
(I have to use RGB - can't use HSV for this project)

I'd prefer not to use a table of values. I've tried that and it's limited by the number of iterations.
In my program the maximum number of iterations is increased automatially depending on the zoom level - so a fixed table of values isnt practical, for long any way.

One thing I've tried (with mixed results) is to use a formula for each RGB value. For example:
r = (sin(0.1*mu) +1)*127
with different values (or cos) for the other channels.

I'm hoping someone has other suggestions.
Thanks.

Christian is correct - but remove "N" from mu (I'm assuming that *is* meant to be the iteration count).
Now calculate almost any 3 values based on the fractal calculations for each pixel *on both the penultimate iteration and the final iteratrion* then you can use mu to mix the two such that there are no breaks at the iteration boundaries.

For instance in the default Triangle inequality average colouring in Ultra Fractal the colouring is smoothed as follows (after bailout):

sum = sum / (#numiter)
sum2 = sum2 / (#numiter-1)
f = il*lp - il*log(log(cabs(#z)))
#index = sum2 + (sum-sum2) * (f+1)

Where sum is the sum after the final iteration and sum2 is the sum after the penultimate one.
The important bit is the last line using the smoothing fraction f - sum and sum2 could be the results for *any* colouring calculation where sum is the final and sum2 is the penultimate.
Simply use 3 different calculations for R, G and B to get the sum values if you wish direct colouring rather than look-up.
 Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Fractal Lover

Posts: 221

 « Reply #5 on: August 17, 2012, 03:42:42 PM »

You can use gradient function :