News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. October 25, 2014, 06:00:30 PM


Login with username, password and session length



Pages: 1 ... 29 30 [31] 32 33 ... 37   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: True 3D mandelbrot type fractal  (Read 278588 times)
0 Members and 2 Guests are viewing this topic.
fpsunflower
Forums Newbie
*
Posts: 4


« Reply #450 on: November 13, 2009, 10:14:26 AM »

Quote
Sorry, I don't understand what you mean..Could you explain?

Dual numbers are explained here: http://en.wikipedia.org/wiki/Automatic_differentiation#Automatic_differentiation_using_dual_numbers

If your code is written in C++, you can get derivatives for "free" by just using operator overloading and a templated distance estimation formula.

Quote
The formula relies on the so called Hubbard Douady potential. See for instance  http://iquilezles.org/www/articles/distancefractals/distancefractals.htm .

I've looked at this and a few other pages - but none gave a clear explanation of how the formulas are derived. Perhaps I'm missing something. I found the same as you - 0.5 works in most cases (presumably because it is a lower bound). I was hoping that there was a more precise lower bound available that could let me take larger steps.
Logged
fpsunflower
Forums Newbie
*
Posts: 4


« Reply #451 on: November 13, 2009, 10:35:12 AM »

Quote
You can easily write a trig-free iteration formula for arbitrary powers...
Great! Could you give an example?

The exact sequence will depend on which parametrization of the sphere you are using. In my case:
Code:
        // given a triplex: (x,y,z)
        R = sqrt(x * x + y * y + z * z);
        sinph = z / R;
        cosph = sqrt(1 - sinph * sinph);
        costh = x / sqrt(x*x+y*y);
        sinth = y / sqrt(x*x+y*y);

Using this representation you can easily multiply two numbers using the formulas for cos(a+b) and sin(a+b):
Code:
        // new = a * b
        new_R = a_R * b_R;
        new_sinph = a_sinph * b_cosph + a_cosph * b_sinph;
        new_cosph = a_cosph * b_cosph - a_sinph * b_sinph;
        new_costh = a_costh * b_costh - a_sinth * b_sinth;
        new_sinth = a_sinth * b_costh + a_costh * b_sinth;

From this, you can define pow by repeated multiplication (in log(n) steps, by repeated squaring). Since in the ADE you use:
Code:
        dZ = p*Z^(p-1)*dZ + 1
        Z  = Z^p + c
You can just compute Z^(p-1), then get Z^p = Z * Z^(p-1).

To rebuild the value in cartesian form (so that you can do additions), just recombine the values:
Code:
        x = nr * ncosph * ncosth;
        y = nr * ncosph * nsinth;
        z = nr * nsinph;

Note: I picked this form because it makes the triplex "one" = (1,0,0) instead of (0,0,1) which you get when you have z=r*cos. It also means the complex (2d) mandelbrot lies on the xy plane (z=0). But you can do the same math for whatever flavor you like best.


I will leave negative powers as an exercise to the reader wink
Logged
iq
Guest
« Reply #452 on: November 13, 2009, 10:46:27 AM »

hi fpsunflower,

Quote
Code:
return 0.5f * R * (float) Math.log(R) / dR;

Is the leading term 0.5 for all powers? Is the log supposed to be the natural log or the log in some other base? Does anyone have the reference to the explanation of how this formula actually works?

The log is the natural logarithm (base e¡2.71...), yes.

The formula comes, more or less, from this sequence of steps: (assume we have the regular quadratic case)

1. We first construct a uniformization function ph(c) (also known as Bottcher coordinates) with will map the exterior od the M set to the unit circle. It's like a deformation function, a smooth deformation in fact (with no wholes or spikes, or as mathematicians call it, a holomorphica map). Since z->z^2 + c and as z grows c has less importance, in the limit (far from the origin) z->z^2. So the uniformization map is:

phi(c) = Zn ^ (1/2^n)

where n is the number of iterations (ideally infinite). Far from the origin the map is almost identity. You can see a picture of phi(c) in the first image here: http://iquilezles.org/trastero/fieldlines/

2. The Hubbard-Douady potential is the next idea. It's defined as G(c) = log(phi(c)) with natural logarithm. This function is useful for demonstrating the connecteness of the M set (and is related to the theory of external rays).

G(c) = log |phi(c)| = log( Zn ^ (1/2^n) ).

You can think of G as a magneitc filed emanating from the M set, but increasing as you move away from it. It is zero inside M. As we said pchi(c) = c when far from M, so G = log|c| as you move away from M. You can see how it looks here: http://iquilezles.org/trastero/potential.

G = log|Zn^(1/2^n))| = log |Zn| / 2^n

As with any scalar field, you can compute the gradient of it, or in other words, the maximun slope of the field, if it was interpreted as a terrain. The gradient is related to the derivatives, so you must know how to take derivatives of logarithms. Basically,

grad(G) = |dZn| / (|Zn| * 2^n)

Now, you can approximate a smooth function with a linear version of it (a first order Taylor series) with the gradient (first ortder derivative), like you can say that G(C+eps) = G(C) + eps·|grad(G)|. If we take C inside the M set and we want to compute the distance to it in a close point (C+eps), we can isolate eps int he previous formula and get

eps = distance to M = (G(C+eps)-G(C) )/grad(G(C)). But G(C) is zero because it is inside M, so  distance = G/drad(G).  Replacing now G and grad G with what we got before, and canceling out the 2^n terms, we get:

dist = |Z|·log |Z| / |dZ|

Now, I'm missing the 2 factor, and I'm not sure why. In fact, apparently the real formula is dist = 2·|Z|·log |Z| / |dZ| and then by something called the "Koebe 1/4 theorem" we know the distance must be not more than a quarted of the previous quantity, so:

dist >= 0.5 · |Z|·log |Z| / |dZ|

Apparently the 1/4 factor holds for 3D too. The 2 that I'm missing in the numerator factor Im not sure where it comes from, probably from one of those 2^n thingies, so I would say it is related to the power of the M set indeed. In that case, the distance estimator would be

DE = (power/4) · |Z|·log |Z| / |dZ|

but Im not sure. Perhapse somebody here can confirm?
Logged
JosLeys
Iterator
*
Posts: 199


WWW
« Reply #453 on: November 13, 2009, 01:15:37 PM »

Quote
Dual numbers are explained here: http://en.wikipedia.org/wiki/Automatic_differentiation#Automatic_differentiation_using_dual_numbers

If your code is written in C++, you can get derivatives for "free" by just using operator overloading and a templated distance estimation formula.

Thanks, I read the Wikipedia article, but I still do not see how this gives us the normal vector in a point, "for free".
Logged
twinbee
Fractal Fertilizer
*****
Posts: 383



WWW
« Reply #454 on: November 13, 2009, 01:53:38 PM »

Wow, I'm away for a couple of days, and then I miss all this!

Welcome, Daniel, Iñigo, Aexion and fpsunflower. Some cracking images from you guys, I particularly enjoyed the metallic brot render by fpsunflower, and the two images by Aexion. Iñigo, 15 minutes is fast for that, gotta make an animation!

Aexion, you've got to one of my fave fractal artists ever - I love your recent "The Hexahedral Puzzle" - it has a lovely Aztec feel about it. Still think your Sunset Castle (and Return thereof) is awesome.

Paul, wow you did powers 4-8 - that must've taken a while. Look forward to doing some speed comparisons with that along with the other techniques here...

Quote
I saw also your the newest Elevated 4kIntro

Hey, I saw that too a while back - very cool!

Bib, I'm not sure what to make of that latest blue image - maybe render a different angle and zoom in. It could be very cool...
Logged
Daniel_P
Guest
« Reply #455 on: November 13, 2009, 02:30:28 PM »

So, have New Scientist, Scientific American, etc been in touch yet?

I'm guessing we might see some of these images on more than a few magazine covers in the near future.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 5663


formerly known as 'Trifox'


WWW
« Reply #456 on: November 13, 2009, 03:04:56 PM »

@daniel_p i think there should be at least one scientific description of what we they are doing here, it would be a pleasure
for me to collect all the informations we have here, but it would take at least 2 or 3 monthes ( hello bachelor thesis, actually i am trying to find someone who would find that interesting )

cheers  afro angel police sad
Logged

---

divide and conquer - iterate and rule - chaos is No random!
fpsunflower
Forums Newbie
*
Posts: 4


« Reply #457 on: November 13, 2009, 05:05:25 PM »

Thanks, I read the Wikipedia article, but I still do not see how this gives us the normal vector in a point, "for free".

Another good explanation that describes duals in more concrete coding terms: http://homepage.mac.com/sigfpe/paper.pdf

Not quite "free", of course you need to implement your dual number class and define add, mult, sqrt, log, div, etc ...



iq: thanks for that explanation, but I also got a bit lost in those final steps about the exact leading term.
Logged
bib
Global Moderator
Fractal Senior
******
Posts: 2003



@bib993
WWW
« Reply #458 on: November 13, 2009, 05:14:28 PM »


Bib, I'm not sure what to make of that latest blue image - maybe render a different angle and zoom in. It could be very cool...

I try to. But navigating using the parameters variations instead of "natural" 2D zooming in UF is quite tough.

I know there is nothing revolutionnary in the images I post in this thread compared to all the ground-breaking innovations we can see here, but it's just to show that zooming into 3D fractals that look like whipped cream at first sight can reveal interesting spirals and so on...
Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)
David Makin
Global Moderator
Fractal Senior
******
Posts: 2269



Makin' Magic Fractals
WWW
« Reply #459 on: November 13, 2009, 10:43:53 PM »

The formula comes, more or less, from this sequence of steps: (assume we have the regular quadratic case)
<snip>

That's interesting, I tried my own derivation of a DE formula and got it working based on the distance to the next iteration boundary.
Unfortunately I did it on scrap paper, tried several renders based on a version where the next iteration boundary was when the final magnitude on the bailout iteration became (actual final magnitude)^(1/n) where n is the divergence then realised a better method would be to actually use the smooth iteration value instead and base it on when the smooth iteration value increases by 1 smiley
Anyway it worked and when I derived the smooth iteration version I basically arrived at the normal DE formula.
All I have left of my derivations is this note on a scrap of paper I had left:

"Iteratively solve the Newton for lambda where lambda is the distance aliong the ray for intersection with the bailout sphere."

i.e. iterate both the main formula and the Newton at the same time.

Here's what I got when I used the final magnitude derivation on a Quaternion:

http://makinmagic.deviantart.com/art/Improved-Quat-Minibrot-127157826

(see the comments)


« Last Edit: November 13, 2009, 11:18:26 PM 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
David Makin
Global Moderator
Fractal Senior
******
Posts: 2269



Makin' Magic Fractals
WWW
« Reply #460 on: November 13, 2009, 11:37:41 PM »

Just a note to anyone reading the thread who may be unfamilier with |z| as used in standard maths notation and/or as used in Fractint and Ultra Fractal.

If z is complex as (x+iy) then in standard maths notation |z| = sqrt(x^2 + y^2)

BUT in Ultra Fractal and Fractint then |z| = x^2 + y^2 and cabs(z) is used as sqrt(x^2 + y^2) (cabs for complex absolute).

I was prompted to mention this after IQ's query regarding the correct scaling of the DE value, I also couldn't work out how "0.5" was arrived at. In UF and Fractint:

0.5*log(|z|) is equivalent to log(|z|) in standard math notation smiley

And at one point I considered that maybe the 0.5 came from mistranslations between fractal program and standard math notations.

But I don't think the 0.5 comes from that, I think it really comes from the fact that the value calculated is only an *estimate* and the 0.5 is simply used to avoid cases where the estimate is larger than the true distance - but that's just my opinion smiley
In fact the DE value I use for the Normals is assumed to be correct without the "0.5", I do however multiply the DE value by 0.5 before using the value as a step distance during ray stepping.
Also I should mention that (based on how I had to scale the DE values used to compute the normals to get correct lighting) I found (experimentally) that the visibly correct (Ultra Fractal) final DE calculation was:

            dist = 0.5*sqrt(@mpwr-1.0)*log(magn)*sqrt(magn/|dzri|)

for a Julibrot where @mpwr is the power in z^power+c, magn is |final z| (i.e. x^2+y^2) and dzri is the final derivative value.
However looking at IQ's derivation I suspect that:

            dist = 0.25*@mpwr*log(magn)*sqrt(magn/|dzri|)

May be more accurate smiley Edit: Just tried it and it doesn't seem to be better, in fact it definitely overestimates at higher powers - I not only got gradually darker and darker shading but started getting gross overstepping as well when the method using sqrt(@mpwr-1) still worked fine.
Just to add I actually checked it on quaternions and the White/Nylander.

« Last Edit: November 14, 2009, 02:25:22 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
bugman
Conqueror
*******
Posts: 122



WWW
« Reply #461 on: November 14, 2009, 05:11:39 AM »

I thoroughly double checked my non-trigonometric formulas again, and I found that the formula for {x,y,z}^4 had a minus sign error. But all the other formulas came out correct. I went back and made the correction to the original post here:
http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8426/#msg8426
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2269



Makin' Magic Fractals
WWW
« Reply #462 on: November 14, 2009, 05:30:21 AM »

I thoroughly double checked my non-trigonometric formulas again, and I found that the formula for {x,y,z}^4 had a minus sign error. But all the other formulas came out correct. I went back and made the correction to the original post here:
http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8426/#msg8426

I'm not sure what went wrong with the z^3+c when I tried it (or the other higher powers where you use abs and sign) maybe I'm missing something obvious.
Anyway the formula I quoted here http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8475/#msg8475 can be expanded to use reals for a given power and then optimised - that formula definitely exactly matches the trig version (at least for integer powers from 2 to 60, I haven't checked fractional or negative powers).
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: 2269



Makin' Magic Fractals
WWW
« Reply #463 on: November 14, 2009, 06:29:29 AM »

Hi all,

I just updated the WIP3D formula, new link:

http://www.fractalgallery.co.uk/MMFWip3D.zip

Again unzip, copy all the text and paste into an open UF fractal window (also requires UF5).
This time the UPR is an example render of Pickover stalks (orbit trap) - note that "auto distances" is disabled and the solid threshold is much larger than used for solid on iteration/distance estimate.
Several more options in the formula plus some bugfixes in the analytical distance estimate methods.
This is actually named as a different formula so as not to cause compatibility issues with any renders you've already done smiley
« Last Edit: November 14, 2009, 06:32:14 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
JosLeys
Iterator
*
Posts: 199


WWW
« Reply #464 on: November 14, 2009, 11:58:58 AM »

Here is a very simple general procedure to obtain sin(p.a) and cos(p.a) if you know the value for sin(a) and cos(a) :

Let S=sin(a) and C=cos(a) and make a complex number z=S+iC, and put z1=z

Do z1=z1.z,   now real(z1)=cos(2a) and imag(z1)=sin(2a)  (z1=C^2-S^2 +i.2.S.C)

Do again z1=z1.z now real(z1)=cos(3a) and imag(z1)=sin(3a)

(because (sin(2a)+i.cos(2a))(sin(a)+i.cos(a) gives as real part sin(2a)cos(a)+cos(2a)sin(a)=sin(3a) and as imaginary part cos(2a)cos(a)-sin(2a)sin(a)=cos(3a) )

...
..(the (p-1)-th time)  real(z1)=cos(pa) and imag(z1)=sin(pa)

So no need for very long complicated formulas if you want do to a non-trig p-th power...
The drawback is that you need sin(a) and cos(a) which involves a square root.

For even powers this can be adapted so that you only need (sin(a))^2 and (cos(a))^2, which does away with the square root. However, when using a distance estimate based on the derivative, one always needs also the value for sin((p-1)a) and cos((p-1)a), so getting a value for sin(a) and cos(a) cannot be avoided then.

Also, if you want to do powers<1, it is no good of course.
Logged
Pages: 1 ... 29 30 [31] 32 33 ... 37   Go Down
  Print  
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Implementation: 3D mandelbrot type fractal 3D Fractal Generation « 1 2 » steamraven 26 17231 Last post December 08, 2011, 04:27:52 PM
by Alef
Re: True 3D mandelbrot type fractal Mandelbulb Software shanest 2 8171 Last post November 20, 2009, 03:24:26 AM
by fractalrebel
True 3D mandelbrot fractal (search for the holy grail continues) 3D Fractal Generation « 1 2 ... 17 18 » illi 260 47675 Last post November 25, 2010, 12:57:55 AM
by cKleinhuis
New fractal type... latest 3d type.. a z^2 for Benoit Images Showcase (Rate My Fractal) M Benesi 0 1762 Last post October 21, 2010, 07:14:00 AM
by M Benesi
My First Mandelbrot...Okay not true. Images Showcase (Rate My Fractal) Zephitmaal 3 1161 Last post January 07, 2012, 04:30:36 PM
by Pauldelbrot

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines

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