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

 Pages: [1]   Go Down
 Author Topic: please explain smooth coloring ..  (Read 5882 times) Description: 0 Members and 1 Guest are viewing this topic.
Guest
 « on: June 30, 2010, 09:58:28 PM »

the title says it all ..

any help in plain english very much appreciated .. this is my playtime not my proffession so please keep it simple ..:p

currently I am using an escape count method to provide colors and would love to try smooth coloring if I can wrap my head around it ..

 Logged
David Makin
Global Moderator
Fractal Senior

Posts: 2286

 « Reply #1 on: July 01, 2010, 12:39:52 AM »

With hindsight, I'd explain it as follows:

To smooth standard iteration colouring we need a fractional value to sum with the normal iteration value to give us smooth values between iteration steps.

Now on the final iteration where the magnitude equals or exceeds the bailout value the final magnitude can be from a base of bailiout to a maximum of bailout^p where p is the divergence of the formula.

The variation of the final magnitude across an iteration band is not very linear but is consistent from one iteration band to another.

If we take log(log(final magnitude)) this gives us a potential that is much more linear and ranges from log(log(bailout)) to log(log(bailout^p)) where p is the divergence.

If we subtract the base value from this i.e. log(log(final magnitude))-log(log(bailout)) then the result ranges from zero (if final magnitude==bailout) to log(p) (if final magnitude==bailout^p) so if we divide this by log(p) we get a fraction from zero to 1.

In practice for well-behaved fractals like z^p+c then p can be a fixed constant - simply the power in the fractal formula - provided the bailout is reasonably high - but for low bailouts and for formulas where the divergence varies significantly across the fractal then the value to use for p is better calculated as log(final magntude)/log(penultimate magnitude) i.e. it's better to use the actual divergence of the orbit step concerned.

Of course this fraction is backwards with respect to the iteration count so the smooth iteration is:

smooth iteration = iteration - (log(log(final magnitude)) - log(log(bailout)))/log(p)

Of course here the lowest value of "iteration" should be 1.
 Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
David Makin
Global Moderator
Fractal Senior

Posts: 2286

 « Reply #2 on: July 01, 2010, 02:23:29 AM »

You should note that I assumed you meant smooth iteration colouring - there are obviously other colouuring methods that will produce smooth results such as distance estimator, exponential smoothing and many orbit trap methods.

The smooth iteration fraction though is particularly useful because it can be used to smooth other colouring methods that normally have hard breaks at iteration boundaries - such as the triangle inequality method or colourings based on 'vergence or curvature etc.

Here you use the iteration fraction to mix the colouring value for such a non-smooth colouring from the penultimate iteration with the value for the final iteration - mixing using the iteration fraction smooths the values from the two iterations such that the breaks are removed (though this method does not cure breaks in the derivative of the colouring i.e. even for colourings smoothed in this manner the hard breaks will re-appear if the colouring method is used as a "slope" colouring).
 « Last Edit: July 01, 2010, 02:52:43 AM by David Makin » Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Guest
 « Reply #3 on: July 01, 2010, 11:46:11 PM »

thanks for taking the time to reply .. some more questions if you dont mind though ..

assuming I wanted to have a smooth iteration count up to 256 how would I find the bailout figure to use ..

my math is very rusty the closest I have come up with is *bailout^2 + bailout + ( 1 / 2 ) bailout^2 = 2 * 10 ^ 10^ (iteration - smooth iteration) + ( 1 / 2 ) bailout^2

I have tried completing the square on a quadratic but there are bailout figures on both sides of the equation .. Im still not sure on what value iteration should have ie 1 or the maximum which is another question altogether ..

so two questions how do I figure out the bailout figure so the largest smooth iteration number I will get is 256 and what maximum iteration value should I have?

I dont want you to do my work for me but some pointers from here really appreciated.

thanks from al.

* as pointed out above my math is not so good but here is what I have done so far correct or not .. if Im on the wrong track take great pleasure in pointing it out ..:p

smooth iteration = iteration - (log(log(bailout^2)) - log(log(bailout))) / log(p)
smooth iteration - iteration = - (log(log(bailout^2)) - log(log(bailout))) / log(p)
iteration - smooth iteration = (log(log(bailout^2)) +log(log(bailout))) / log(p)
10^(iteration - smooth iteration) = (log(bailout^2) + log(bailout)) / 2
2 * 10^(iteration - smooth iteration) = log(bailout^2) + log(bailout)
10 ^ 2 * 10 ^(iteration - smooth iteration ) = bailout^2 + bailout
10 ^ 2 * 10 ^ (iteration - 256) = bailout^2 + bailout

 Logged
David Makin
Global Moderator
Fractal Senior

Posts: 2286

 « Reply #4 on: July 02, 2010, 12:07:12 AM »

Hi,

Your overcomplicating things, there's not a specific bailout value to calculate.

You should note that:

log(log(final magnitude)) - log(log(bailout))

is the same as:

log(log(final magnitude)/log(bailout))

but one can pre-calculate log(log(bailout)) and no division is involved.

Also consider "log" in my description to be natural log, not log base 10.

You can use any bailout figure you like, if using a fixed value for "p" then it's best to use higher bailouts, say at least 40 (or 1000 for the squared value).

Using:

smooth iteration = iteration - (log(log(final magnitude)) - log(log(bailout))) / log(p)

Of course normally you test x^2+y^2 against your bailout value rather than sqrt(x^2+y^2) so to account for this use:

smooth iteration = iteration - (log(0.5*log(final magnitude^2)) - log(0.5*log(bailout))) / log(p)  (the 0.5's adjust for the sqrt)

so for a bailout test against 1000 for z^2+c we have:

smooth iteration = iteration - (log(0.5*(final magnitude^2)) - log(0.5*log(1000)))/log(2)

If you wanted to use the minimum bailout (i.e. testing the squared magnitude against 4) then to get smooth results you need to estimate "p" instead of using the fixed constant:

p = log(final magnitude^2)/log(penultimate magnitude^2)
smooth iteration = iteration - (log(0.5*(final magnitude^2)) - log(0.5*log(4)))/log(p)
 « Last Edit: July 02, 2010, 12:11:17 AM by David Makin » Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Guest
 « Reply #5 on: July 03, 2010, 05:36:06 PM »

its much appreciated .. it took a bit of effort on the programming front but I eventually got things looking alright .. I was drawing some pretty wierded out picutures at some stages ..

I have got lots more things to work on and hopefully can contribute something back here ..

heres some pictures .. Im sure you guys have seen a million times already .. two with smooth coloring and two without .. take a guess which is which??

thanks again for taking the time to explain al.

 « Last Edit: July 03, 2010, 05:55:27 PM by madmuppet » Logged
fractalrebel
Fractal Lover

Posts: 211

 « Reply #6 on: July 03, 2010, 08:34:06 PM »

Dave's explanation is fine for those smooth coloring iteration methods that derive from the original method of Linas Vepstas. It is not a universal smoothing method, and works well only for fractal functions that are are in the family of z^n + c. This method was generalized by Jussi Härkönen to work for most divergent fractals. I wrote a further generalization that also works for convergent fractals.

There is another smooth iteration coloring method that is called exponential smoothing. It was developed around 1993 by myself and takes the form

expiter = expiter + exp(-cabs(z)) for  ALL divergent fractals

and has the form

expiter = expiter + exp(-1/(cabs(zold - z))) for ALL convergent fractals.

This method is now one of the standard methods in Ultrafractal and can be found in Standard.ucl.

This has been generalized to work for ALL convergent and divergent fractals and is called general smoothing. It has the form

expiter = expiter + exp(-cabs(z)-0.5/(cabs(zold - z)))
 « Last Edit: July 03, 2010, 08:38:40 PM by fractalrebel » Logged

Guest
 « Reply #7 on: July 06, 2010, 06:23:55 AM »

Ill have a look at it ..

I have got lots of things to do .. next step is julia sets .. then zoom outs .. still debating whether to learn some opengl.

I appreciate any help at all ..

 Logged
quaz0r
Fractal Molossus

Posts: 652

 « Reply #8 on: September 22, 2014, 04:28:43 AM »

Of course normally you test x^2+y^2 against your bailout value rather than sqrt(x^2+y^2) so to account for this use:
smooth iteration = iteration - (log(0.5*log(final magnitude^2)) - log(0.5*log(bailout))) / log(p)  (the 0.5's adjust for the sqrt)

so for a bailout test against 1000 for z^2+c we have:
smooth iteration = iteration - (log(0.5*log(final magnitude^2)) - log(0.5*log(1000)))/log(2)

If you wanted to use the minimum bailout (i.e. testing the squared magnitude against 4) then to get smooth results you need to estimate "p" instead of using the fixed constant:
p = log(final magnitude^2)/log(penultimate magnitude^2)
smooth iteration = iteration - (log(0.5*log(final magnitude^2)) - log(0.5*log(4)))/log(p)

Just in case anyone else ever stumbles across this post... ive been tinkering around writing some basic mandelbrot code and tried implementing this and spent some time trying to figure out why it wasnt working right.  finally i reread this post word for word and noticed a log() got left out of the last couple examples there.  before i was following off the last example and so my output was wrong and was getting frustrated
 « Last Edit: December 09, 2017, 08:14:32 PM by quaz0r » Logged
valera_rozuvan
Safarist

Posts: 80

a test in time

 « Reply #9 on: July 26, 2016, 07:51:02 PM »

There exists a very detailed work "On Smooth Fractal Coloring Techniques" by the author Jussi Härkönen. You can find it at http://jussiharkonen.com/gallery/coloring-techniques/. Although a bit mathematical, it does provide lot's of sample pictures
 Logged

 Pages: [1]   Go Down