END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 16, 2024, 04:00:27 PM


Login with username, password and session length


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


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Generating RGB values from mu  (Read 6891 times)
0 Members and 1 Guest are viewing this topic.
blastoff
Guest
« on: August 14, 2012, 08:44:14 AM »

Hi, first post  smiley

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
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« 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
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« 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



Makin' Magic Fractals
WWW
« Reply #4 on: August 14, 2012, 06:48:09 PM »

Hi, first post  smiley

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
Adam Majewski
Fractal Lover
**
Posts: 221


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

You can use gradient function :
http://en.wikibooks.org/wiki/Colors/Color_gradient#Gradient_functions

HTH
Logged
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
New program for generating Flames Fractal Flames paxinum 1 6413 Last post November 11, 2010, 02:58:57 PM
by hermann
Mandelbox with very low scale values 3D Fractal Generation Teraflop 0 1918 Last post November 06, 2010, 06:15:36 PM
by Teraflop
Contrasting Values Images Showcase (Rate My Fractal) Ross Hilbert 3 1289 Last post October 03, 2011, 05:20:35 PM
by Ross Hilbert
Generating a Fractal Fern Introduction to Fractals and Related Links pswanson 1 6459 Last post August 13, 2014, 09:55:10 PM
by Chillheimer
Generating visuals using ABLETON Fractal Programs refraktal 2 9975 Last post October 02, 2015, 05:16:32 PM
by refraktal

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.156 seconds with 23 queries. (Pretty URLs adds 0.005s, 2q)