Welcome to Fractal Forums

Fractal Software => Mandelbulb 3d => Topic started by: M Benesi on June 24, 2010, 08:44:43 PM




Title: Question about Formula
Post by: M Benesi on June 24, 2010, 08:44:43 PM
  Jesse,  

 I'm pretty sure I saw you mention using someone's streamlined formula for calculating Mandelbulbs, and I wanted to compare it to something I just threw together.

  Do you have a link to the thread with the formula, or know what I should search for?   You could also glance at the following code and tell me if it is the same... but that may be more complicated.  :D

Code:
	r1=sqrt (sqr(sy) + sqr(sz));  // sx, sy, and sz are the starting x, y, and z components of the iteration
r3=r1^(-n);

victor=complex(sx,r1);     // complex (variable_1, variable_2) converts 2 reals into a complex number
bravo=complex(sy,sz);     //  z= variable_1 + [i]i[/i] * variable_2
victor=victor^n;  // you could write a script, so if n is 4, do sqr(sqr(victor)), if n=6 do sqr(victor)*sqr(sqr(victor)) ... etc.  
bravo=bravo^n;

nx=real (victor);                            // real grabs the real component of a complex number
ny=imag (victor)*real (bravo) * r3;   //  imag grabs the imaginary component of a complex number
nz=imag (victor)*real (bravo) * r3;   //  nx, ny, and nz are the intermediate x, y, and z components of the iteration

if (juliaMode) {
sx=nx+cr;
sy=ny+ci;
sz=nz+cj;

} else {
sx=nx+(pixelr);
sy=ny+abs(pixeli);    //  because this is the "Christmas tree fractal" (Name from Bugman's website)
sz=nz+(pixelj);         //  and it's really distorted for -y values, I take the absolute value of y... reflects it over the axis as well
}
z=quaternion(sx,sy,sz,0);   // for color assignment, nothing to do with the calculation of the fractal
bail=abs(sx)+abs(sy)+abs(sz);    // bailout is absolute value, avoid squaring numbers...


Title: Re: Question about Formula
Post by: Jesse on June 24, 2010, 09:26:32 PM
Hmm, the only thing what comes into my mind is a conversation with David Makin about his implementation of formulas for Ultrafractal.

So you could search for "MMFwip3D.ufm" for the code, should the code be for the common mandelbulbs?


Title: Re: Question about Formula
Post by: M Benesi on June 24, 2010, 10:08:42 PM
  Lol. 

  Jesse- it gives me your message about searching for "MMFwip3D.ufm" when I search for it.  :D 

  Hilarious. 


  Maybe it was somewhere else.  I recall someone mentioning using someone's algebraic "faster" formula in some software... and I know the complex-triplex method I used above speeds things up nicely (especially for lower powers, or for higher powers if you sqr(sqr(sqr(X))) for z^8, etc...).


Title: Re: Question about Formula
Post by: Jesse on June 24, 2010, 10:29:34 PM
You could also try it on google or use "MMFwip3D.zip" instead.  :)

David uses a fast method for the integer powers in that file.

Then there are the pure non-trig versions like these:
http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8680/#msg8680 (http://www.fractalforums.com/3d-fractal-generation/true-3d-mandlebrot-type-fractal/msg8680/#msg8680)


Title: Re: Question about Formula
Post by: M Benesi on June 25, 2010, 07:45:09 AM
Thanks Jesse, downloaded it (google pointed me back to here...). 

  Ok.. that is fricken long.  Never find the formula in there.  NM... I might ask around later.

  The algebraic formulas are similar to the complex triplex I am using, except the complex triplex lets you go a bit faster, perhaps  (unless my initial implementation of algebraic versions was incorrect or inefficient) .

  I noticed drop offs in performance above z^4 or 5 for algebraic write outs (compared to trig versions) but the performance of the complex triplex still (barely) exceeds that of trig formulas at z^13... and can be improved even further by the old sqr(sqr(sqr(z))) trick (thats z^8 in 3 squares (3 multiplications) instead of 8 multiplications...).