Logo by Fiery - Contribute your own Logo!

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: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. March 19, 2024, 03:39:23 AM


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 ... 28 29 [30] 31 32 ... 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 601543 times)
0 Members and 2 Guests are viewing this topic.
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #435 on: November 12, 2009, 09:21:56 PM »

Since a couple of years ago I did a demo with a quaternion 4d julia set in realtime with ambient occlusion in the GPU (Kindernoiser: http://iquilezles.org/prods/#kindernoiser), I decided to port this little raymarcher of this morning to the GPU this afternoon. Results are promising, I get almost realtime rendering (5 frames per second) without the distance estimation optimization and some non-raytrace-based ambient occlusion.

Hi IQ
It is nice surprise to see you in Fractal Forums. I know your 4k and 64k intros and 4kGfxExe from Demoscene (scene.org). I have never made any intro or demo but I have watched every demo from famous copy-parties since I had my first Amiga 600. I can said that your 4kGfxExe are the best I know. I saw also your the newest Elevated 4kIntro. It is relay impressive (http://ftp://ftp.scene.org/pub/parties/2009/breakpoint09/in4k/rgba_tbc_elevated.zip)
I think we can learn a lot from you how to optimise fractal rendering and how use some capabilities like SSE, MMX, GPU. Of course if you would like to share some knowledge. Maybe we can also help you to improve your fractal intros  cheesy
Logged

bib
Global Moderator
Fractal Senior
******
Posts: 2070


At the borders...


100008697663777 @bib993
WWW
« Reply #436 on: November 12, 2009, 09:56:13 PM »

Hi
This is a zoom in the picture I posted above, using David Makin's M-true3D formula
Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)
iq
Guest
« Reply #437 on: November 12, 2009, 10:07:25 PM »

For reference, if anybody want to try the GPU version, here goes the GLSL version of the iteration formula:


//--------------------------------------
// interate z -> z^8 + c (trigonometric)
//--------------------------------------
float zr = sqrt( dot(z,z) );
float zo = acos( z.y/zr );
float zi = atan( z.x,z.z );

zr = pow( zr, 8.0 );
zo = zo * 8.0;
zi = zi * 8.0;
       
z = zr*vec3( sin(zo)*sin(zi), cos(zo), sin(zo)*cos(zi) );

z = z + c;
//--------------------------------------


The coordinate axes and spherical coords are arranged like they teach you at school (and as OpenGL does): x=right, y=up, z=towards you. "zo" is the angle between the point/vector and the y axis, and zi is the angle between it's shadow in the xz horizontal plane and the z axis. After some maths in paper I got that:

cos(8x) = c^8 + s^8 - 28c^6s^2 - 28c^2s^6 + 68c^4s^4
sin(8x) = 8sc^7 - 8s^7c - 56c^5s^3 + 56s^5c^3

where c=cos(x) and s=sin(x)

I think I didn't make any mistake, as images look identical to the ones rendered with the trigonometric version. After optimization it got quite ugly thou....:

//--------------------------------------
// interate z -> z^8 + c (polynomic)
//--------------------------------------
float zr2 = dot(z,z);
float zq2 = dot(z.xz,z.xz);
float izr2 = 1.0/zr2;
float izq2 = 1.0/zq2;

vec4 k2 = vec4( izr2*z.y*z.y, izr2*zq2, izq2*z.z*z.z, izq2*z.x*z.x );
vec4 k4 = k2*k2;
vec4 k6 = k4*k2;
vec4 k8 = k4*k4;

float ko = izr2*z.y*sqrt(zq2);
float ki = izq2*z.z*z.x;

float cozo8 = k8.x + k8.y - 28.0*k6.x*k2.y - 28.0*k2.x*k6.y + 68.0*k4.y*k4.x;
float cozi8 = k8.z + k8.w - 28.0*k6.z*k2.w - 28.0*k2.z*k6.w + 68.0*k4.w*k4.z;
float sizo8 = 8.0*ko*(k6.x - k6.y - 7.0*k2.y*k4.x + 7.0*k2.x*k4.y);
float sizi8 = 8.0*ki*(k6.z - k6.w - 7.0*k2.w*k4.z + 7.0*k2.z*k4.w);

float zr8 = zr2*zr2; zr8 = zr8*zr8;
z = zr8*vec3( sizo8*sizi8, cozo8, sizo8*cozi8 );

z = z + c;
//--------------------------------------


It's GLSL, should be easy to translate to  HLSL, CG or simple plain C.
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #438 on: November 12, 2009, 10:26:20 PM »

Since a couple of years ago I did a demo with a quaternion 4d julia set in realtime with ambient occlusion in the GPU (Kindernoiser: http://iquilezles.org/prods/#kindernoiser), I decided to port this little raymarcher of this morning to the GPU this afternoon. Results are promising, I get almost realtime rendering (5 frames per second) without the distance estimation optimization and some non-raytrace-based ambient occlusion.

Hi IQ
It is nice surprise to see you in Fractal Forums. I know your 4k and 64k intros and 4kGfxExe from Demoscene (scene.org). I have never made any intro or demo but I have watched every demo from famous copy-parties since I had my first Amiga 600. I can said that your 4kGfxExe are the best I know. I saw also your the newest Elevated 4kIntro. It is relay impressive (http://ftp://ftp.scene.org/pub/parties/2009/breakpoint09/in4k/rgba_tbc_elevated.zip)
I think we can learn a lot from you how to optimise fractal rendering and how use some capabilities like SSE, MMX, GPU. Of course if you would like to share some knowledge. Maybe we can also help you to improve your fractal intros  cheesy

hi there iq, i do look forward for an amazing realtime 3d fractal demo, although i might be also in creating an own one for next years breakpoint cheesy
perhaps we meet at the competition, and fractals will become a renaissance in the demo scene   afro
Logged

---

divide and conquer - iterate and rule - chaos is No random!
Aexion
Conqueror
*******
Posts: 116


The Fractal Hermit


WWW
« Reply #439 on: November 13, 2009, 01:00:37 AM »

here are two renders of this system:
http://www.rfractals.net/gallery/main.php/v/JuliaSets/3DJulia1.html
http://www.rfractals.net/gallery/main.php/v/JuliaSets/3DJulia2.html
The Mandelbrot of this series doesn't looks good but I have tested it on many other julia equations (such as the phoenix and the newton fractal) and it looks interesting.

Hello Aexion
It is very nice to see new person in FractalForums. I saw your renderings and they looks very interesting. You have very strange iteration formula. It looks like z^2+c formula but with additional rotation by 90 degrees after each iteration. The results are awesome because there are visible lots of beautiful spirals.


Thanks Buddhi, its nice to be here.
About this iteration formula, you're right, its just a mix between the mandelbrot iteration and a normalized rotation matrix (that I have simplified for speed):

nx = x*x-z*z-0.27;
nz = 2*x*z-0.1;
ny=y;

x=a*nx +b*ny+ c*nz;
y=d*nx +e*ny+ f*nz;
z=g*nx +h*ny+ i*nz;

For some rotations, I get interesting 3d julias, but not for all.. many of them produces some sort of fractal potatoes..  undecided
Anyways, I'm still playing with them adding things like scaling and shearing, to see what happens.
 
Logged

Fractals all the way..
Incendia for 3D Fractals
Aural for Musical Fractals
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #440 on: November 13, 2009, 01:10:40 AM »

here are two renders of this system:
http://www.rfractals.net/gallery/main.php/v/JuliaSets/3DJulia1.html
http://www.rfractals.net/gallery/main.php/v/JuliaSets/3DJulia2.html
The Mandelbrot of this series doesn't looks good but I have tested it on many other julia equations (such as the phoenix and the newton fractal) and it looks interesting.

Hello Aexion
It is very nice to see new person in FractalForums. I saw your renderings and they looks very interesting. You have very strange iteration formula. It looks like z^2+c formula but with additional rotation by 90 degrees after each iteration. The results are awesome because there are visible lots of beautiful spirals.


On a similar theme it may be interesting to try "self-rotation" as well - performed like this in 2D complex (either pre- or post- the main iteration calculation):

    t = cabs(z)
    if t > 0
      z = z*z/t
    endif

Obviously one can use higher degrees of self-rotation i.e. rotate by multiples of "own angle".

As an aside this method increases the overall amount of chaos in a system generally leading to more strangely attractive orbits.
Logged

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

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #441 on: November 13, 2009, 04:13:53 AM »

and welcome to aexion, i almost forgot to greet you to personally

aexion is the develop of incendia fractal renderer
Logged

---

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


« Reply #442 on: November 13, 2009, 07:47:10 AM »

Hi everyone! Just wanted to share my experience rendering this fractal.

I'm using the analytical DE method. You can easily write a trig-free iteration formula for arbitrary powers that updates both derivative and value at the same time once you implement multiplication with these "triplex" numbers. You just need to remember the formulas for adding angles:

Code:
cos(a+b) = cos(a)*cos(b) - sin(a)*sin(b)
sin(a+b) = sin(a)*cos(b) + sin(b)*cos(a)

Its a bit more expensive than iq's version because the square roots don't cancel out anymore, but its more flexible and still way faster than the trig version (10x for my java implementation).

Another observation I haven't heard mentioned here yet: you can get semi-analytic normals without central differencing by implementing a dual arithmetic version of the distance estimation routine. Its maybe a tiny bit faster, although the normal estimation is a tiny fraction of rendering time if you are shooting many rays. Its only semi-analytic because its no more accurate than the "analytic" distance estimation is, but at least it gives you the true derivative to whatever precision you are calculating the distance with, without adding extra epsilons into your code.

Here's an image I rendered (n=7, microfacet reflection model, image based lighting and depth of field):




Finally a question: I'm using this formula for the distance estimate:

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?
Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #443 on: November 13, 2009, 08:37:34 AM »

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

Quote
you can get semi-analytic normals without central differencing by implementing a dual arithmetic version of the distance estimation routine
Sorry, I don't understand what you mean..Could you explain?

I use the same distance formula for all powers: DE=R.ln(R)/dR, (so it is the base e log), but I advance the point on the ray by a fraction of DE. Normally 0.5 works, but sometimes I have to take something lower.

The formula relies on the so called Hubbard Douady potential. See for instance  http://iquilezles.org/www/articles/distancefractals/distancefractals.htm .
Logged
fpsunflower
Forums Newbie
*
Posts: 4


« Reply #444 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 #445 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 #446 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
Strange Attractor
***
Posts: 258


WWW
« Reply #447 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 #448 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 #449 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
Pages: 1 ... 28 29 [30] 31 32 ... 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 27 64387 Last post August 21, 2016, 12:13:13 AM
by ironfractal
Re: True 3D mandelbrot type fractal Other / General Discussion shanest 2 26235 Last post November 20, 2009, 03:24:26 AM
by fractalrebel
True 3D mandelbrot fractal (search for the holy grail continues) The 3D Mandelbulb « 1 2 ... 17 18 » illi 260 57168 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 7429 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 8243 Last post January 07, 2012, 04:30:36 PM
by Pauldelbrot

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.193 seconds with 24 queries. (Pretty URLs adds 0.01s, 2q)