Logo by mauxuam - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 26, 2024, 08:22:25 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 [2] 3   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: Low-hanging dessert: An escape-time donut fractal  (Read 1929 times)
0 Members and 1 Guest are viewing this topic.
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #15 on: January 24, 2016, 05:21:49 AM »

@ M.Benesi. I think it is just Buddhi's standard deltaDE linear which I have yet to study and figure  out (as it is hidden away in part of the code where I never venture). Whereas the analytic methods are upfront and easier to understand. I generally just sit back and let Buddhi sort out anything that is not a mbox or mbulb.  What I mean by fragile is that I tried a quick few hybrids, and generally the DE calc goes bad if I stray too much away from the original formula (not as robust as T1 PT.)

Your image looks cool!!

@ msltoe.  Yes, I have finally finished with your juliabulbs ( but I cannot get effie's versions to work well, it has strange cuts in it.)   Those juliabulbs are really good with analytic log DE, I seldom have to adjust the raymarching step from the default 1.0.  On the UI's i have added  rotation and  symmetrical addCpixel options (code attached) . Now it is time for me to go back and finish  Reimann spheres

Cheers guys smiley

Code:
  if (fractal->transformCommon.rotationEnabled)
  {
    z = fractal->transformCommon.rotationMatrix.RotateVector(z);
  }

  if (fractal->transformCommon.addCpixelEnabledFalse)
  {
    CVector3 tempFAB = c;
    if (fractal->transformCommon.functionEnabledx)
    {
            tempFAB.x = fabs(tempFAB.x);
    }
    if (fractal->transformCommon.functionEnabledy)
    {
            tempFAB.y = fabs(tempFAB.y);
    }
    if (fractal->transformCommon.functionEnabledz)
    {
            tempFAB.z = fabs(tempFAB.z);
    }
    tempFAB *= fractal->transformCommon.constantMultiplier000;
    if (z.x > 0) z.x += tempFAB.x;
    else z.x -= tempFAB.x;
    if (z.y > 0) z.y += tempFAB.y;
    else z.y -= tempFAB.y;
    if (z.z > 0) z.z += tempFAB.z;
    else z.z -= tempFAB.z;
  }
}
Logged
mclarekin
Fractal Senior
******
Posts: 1739



« Reply #16 on: January 24, 2016, 05:32:35 AM »

Have you tried doing an exact copy of Buddhi's code?

I see some differences although for all I know mathematically they could be the same

atan(z.y, z.x)/nSect;  would crash in C++, must be either atan2(z.y, z.x) or atan(z.y/z.x)

have you changed your code from what you previously posted?
Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #17 on: January 24, 2016, 06:13:30 AM »

Yeah (as exact of a copy as I could- I actually had to alter it a bit to get the donuts for nSect=2pi/4... so something is wrong).  I'll take a gander at your code above after I get this one idea tested (thanks!).  It's starting to resemble something I recall... probably something msltoe did in the past.  cheesy



  I can't remember who introduced that type of pseudo-fractal here?   embarrass   Must be what msltoe meant by a low hanging dessert- a formula you can make an easy mistake on and do something quite cool.
« Last Edit: January 24, 2016, 06:46:16 AM by M Benesi » Logged

mclarekin
Fractal Senior
******
Posts: 1739



« Reply #18 on: January 24, 2016, 09:21:57 AM »

cool weird place, yes it can be productive making mistakes grin



 float theta = atan(z.y, z.x)/nSect; ---------------------------atan2?

                if (theta>-.5) {theta= floor (theta+.5);
                } else { theta= ceil(theta-.5);} -----------------------------------is this if() really giving you the same answer as "round" ?
                theta = nSect * theta;
Logged
Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #19 on: January 24, 2016, 09:54:46 AM »

Awesome work Buddhi!  Nice reflections.  

  I'll try and figure it out, but my implementation of your code is skipping donuts (it's all due to the smaller radius check):
<Quoted Image Removed>
Code:
uniform float BigRadius; slider[-10,1.,10]
float rad1=BigRadius;

uniform float SmallRadius; slider[-10,.1,10]
float rad2=SmallRadius*SmallRadius;    //only use rad2*rad2 soo.....

uniform float DonutFactor; slider[-10,3.,10]

uniform int Donuts;slider[1,9,20]
float nSect=6.283/float(Donuts);


void donut(inout vec3 z, inout float dr) {


float R = sqrt(z.x * z.x + z.y * z.y);
float R2 = rad1 - R;
float t = R2 * R2 + z.z * z.z - rad2;  //rad2= SmallRadius^2

if (t > 0.)   //.03 isn't as nice looking???  and it will usually be greater than zero, right?? 
{
float theta = atan(z.y, z.x)/nSect;
if (theta>-.5) {theta= floor (theta+.5);
} else { theta= ceil(theta-.5);}
theta = nSect * theta;

float c1 = cos(theta);
float s1 = sin(theta);

float x1 = c1 * z.x + s1 * z.y;
float y1 = -s1 * z.x + c1 * z.y;
float z1 = z.z;

x1 = x1 - rad1;

z.x = DonutFactor * x1;
z.y = DonutFactor * z1;
z.z = DonutFactor * y1;
dr=dr*(DonutFactor);
}
else if (t!=0.)
{
z /= t;   
}

}

  DE return is .5*r/dr (without the .5, I get nothing). 
 

In your code you have reduced wall thickness of torus to 0 by changing
Code:
if (t > 0.03) 
to
Code:
if (t > 0.00) 

This torus formula which I created  just from torus equation, works a little weird. It gives repeated torus as shown on picture torus1.jpg. We need only this one particular torus which comes directly from torus equation. We can cut it using condition:
Code:
if (t > 0.03) 

If we just play with torus formula with following code:
Code:
		
double rad2 = fractal->donut.ringThickness;
double R = sqrt(z.x * z.x + z.y * z.y);
double R2 = fractal->donut.ringRadius - R;
double t = R2 * R2 + z.z * z.z - rad2 * rad2;
if(t > 0.03)
{
z *= 2.0;
}
else
{
z /= t;
}

we can get toruses like on image torus2.jpg. We see series of toruses generated by z *= 2.0. (normally we used here msltoe code for donut iterations)

But if we change code to have
Code:
if (t > 0.0)
Then wall thickness of torus is exactly zero, so can be invisible or distorted like on image torus3.jpg

Probably we need some better formula to generate escape time toruses.


* torus1.jpg (42.87 KB, 400x300 - viewed 111 times.)

* torus2.jpg (20.11 KB, 400x300 - viewed 102 times.)

* torus3.jpg (25.32 KB, 400x300 - viewed 103 times.)
Logged

Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #20 on: January 24, 2016, 10:04:47 AM »

Yeah (as exact of a copy as I could- I actually had to alter it a bit to get the donuts for nSect=2pi/4... so something is wrong).  I'll take a gander at your code above after I get this one idea tested (thanks!).  It's starting to resemble something I recall... probably something msltoe did in the past.  cheesy

  I can't remember who introduced that type of pseudo-fractal here?   embarrass   Must be what msltoe meant by a low hanging dessert- a formula you can make an easy mistake on and do something quite cool.

Do you remember this mistake and can you show us your code? These shapes are very interesting.
Logged

Buddhi
Fractal Iambus
***
Posts: 895



WWW
« Reply #21 on: January 24, 2016, 10:09:55 AM »

  I'm curious as to why what I am doing works fine for nSect= 2pi/4 but not for any others??

<Quoted Image Removed>


I' curious how you get it working with DE calculated from formula. I see that you only use: dr=dr*(DonutFactor)
The reason why I use deltaDE algorithm is unknown way to calculate proper dr especially for torus. DeltaDE uses deltas to calculate dr, so it's much slower, but works well in most of cases.
Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #22 on: January 24, 2016, 08:42:38 PM »

Do you remember this mistake and can you show us your code? These shapes are very interesting.
  Is mistake the word we should be using?  cheesy
Code:
void donut(inout vec3 z, inout float dr, inout bool donutcheck) {

float c1; float s1;float t;
float R = sqrt(z.x * z.x + z.y * z.y);

if (test1) {  // radius check variable t=  msltoe's original radius check formula

c1 = z.x- rad1 * z.x / R; //rad1= Large Radius (of alleged tori)
s1 = z.y- rad1 * z.y / R;
c1*=c1;
s1*=s1;
t=sqrt(c1+s1+z.z*z.z);

} else {  // t = Buddhi's radius check

float R2 = rad1 - R;
t = abs(R2 * R2 + z.z * z.z - rad2);  //rad2= SmallRadius^2
}

// I used the smaller radius to check t
// instead of using SmallerRadius^2 * DonutFactor (.03 for original formula)

if (t > SmallRadius)  {
float theta = atan(z.y, z.x)/nSect;     //check if we are in specific section of donut

if (theta>-.5) { theta= floor (theta+.5);}     //same as rounding theta
  else   { theta=  ceil  (theta-.5);}    // same as rounding theta

theta = nSect * theta;

float c1 = cos(theta);
float s1 = sin(theta);

float x1 = c1 * z.x + s1 * z.y;
float y1 = -s1 * z.x + c1 * z.y;
float z1 = z.z;

x1 = x1 - rad1;

z.x = DonutFactor * x1;
z.y = DonutFactor * z1;
z.z = DonutFactor * y1;
dr=dr*(DonutFactor);
}
else if (t!=0.)
{

z *= t;      // yes... *=  not /=     I don't get a lot of hits for /=???

  }

}

// different DEs!:

if (returnmode==1) {
return 0.5*log(r)*r/dr;    // used Mandelbulb frag as a template... lazy :D


} else if (returnmode==4) {
return .5*sqrt(z.x*z.x+z.y*z.y)/dr/DonutFactor;   // works nice with smaller radius = 0
} else if (returnmode==3) {
return sqrt(z.x*z.x+z.z*z.z)/dr/DonutFactor*.5;   // works nice with smaller radius = 0
} else if (returnmode==2) {
return sqrt(z.y*z.y+z.z*z.z)/dr/DonutFactor*.5;   // works nice with smaller radius = 0
} else if (returnmode==5) {
return abs(z.x)/dr/DonutFactor*.5;   
} else if (returnmode==6) {
return abs(z.y)/dr/DonutFactor*.5;
} else if (returnmode==7) {
return abs(z.z)/dr/DonutFactor*.5;
} else if (returnmode==8) {
return .5*r/dr/DonutFactor;
}


  Primary differences?  

1) The torus's smaller radius is used for the radius check
2) if radius check is not passed,  z*=t instead of z/=t (I don't get nice images for z/=t???)
3) different DE (yeah.... that's important!  You get something that resembles Cantor Dust instead of polygonals if you use standard DE)!
4) test1 boolean switch makes it so the SmallerRadius has less of an effect:  (test1 + ~20*SmallerRadius) ~~ (!test1 + SmallerRadius). 

  Use:

1)  start out with smaller radius set to 0
2)  returnMode (should be called DE_Mode) = 2, 3, or 4  to check out the polygonals- you'll get dust if you set smaller radius to 0 for regular DE
3)  Donuts = 4 is a nice one (it does the square shapes)
4)  DonutFactor 1.1~1.3

« Last Edit: January 24, 2016, 09:55:05 PM by M Benesi » Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #23 on: January 24, 2016, 09:11:53 PM »

I' curious how you get it working with DE calculated from formula. I see that you only use: dr=dr*(DonutFactor) The reason why I use deltaDE algorithm is unknown way to calculate proper dr especially for torus. DeltaDE uses deltas to calculate dr, so it's much slower, but works well in most of cases.

  dr is the scaling factor in this case, and the rest of it is in my post above:  I changed DE because of the way the variables are manipulated in the fractal, and it created nice results.


  side note:  I'm not positive as to what deltaDE is, is it an average DE from points around the center of where we want our DE, or the lowest DE from points within delta of the point we want DE from?



  I've got a vague recollection of where I saw those spider web things- a recent Bond movie?? 
« Last Edit: January 24, 2016, 10:04:12 PM by M Benesi » Logged

M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #24 on: January 24, 2016, 11:45:22 PM »

  I wrote a frag for you to play with (or look at and translate code to Mandelbulber 2 in mclarekin and/or Buddhi's case).  It's attached, along with the ray-tracer I use for colors.  You need to download your own coloring textures (check the coloring thread in the Fragmentarium section for a few links) to use with it, if you're using Fragmentarium.  

  You also might want to update to the latest version of Fragmentarium, because this frag includes feedback.  

  Rotating around the x-axis by pi/2 (90 degrees) during different iterations gives interesting results (with proper return-mode set).  These aren't the coolest... just a couple to show potential:


  
  If you don't have the latest version of fragmentarium with feedback, use Donut_no_Feedback.frag.

  If you are using the latest version, it might crash if you use the Donut_no_Feedback.frag, so use the Donut.frag!!!!

  Updated Donut frag later in thread...  Donut no feedback is not updated!!!!!

* Fast-Raytracer-with-Textures.frag (18.23 KB - downloaded 20 times.)
* Donut_no_Feedback.frag (11.1 KB - downloaded 17 times.)
« Last Edit: January 25, 2016, 08:56:27 AM by M Benesi » Logged

mclarekin
Fractal Senior
******
Posts: 1739



« Reply #25 on: January 25, 2016, 12:31:28 AM »

singing

"M.Benesi,
he's our man
If anyone can do it
BenesiMan can!"

zappa powah to the people cheesy cheesy cheesy

They look like the magma snow crystal from planet nine

Well done Matt
« Last Edit: January 25, 2016, 12:52:23 AM by mclarekin » Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #26 on: January 25, 2016, 12:37:44 AM »

Graeme!!  

  That was a broken version!!  Just updated and replaced Donut.frag, if you got it before I updated, that version is REAAALLLLYY slow (because I removed a cutoff statement).

  So.. I made 2 versions, no_Feedback (for old Fragmentarium versions), and regular (with the cutoff) for newer versions.  


  Man.. I hope you see this before you try it out.  It is SOOOOO slow.   embarrass


  ohh, and thanks.  cheesy
Logged

mclarekin
Fractal Senior
******
Posts: 1739



« Reply #27 on: January 25, 2016, 12:44:51 AM »

no sweat

i am hoping Buddhi will code this one.  I need to time travel back to 2010/11 and finish the riemann spheres

cheers
Logged
M Benesi
Fractal Schemer
****
Posts: 1075



WWW
« Reply #28 on: January 25, 2016, 12:47:31 AM »

i am hoping Buddhi will code this one.
 cheesy  Me too.  I was wondering where and how to code the DE and dr calculations in Mandelbulber 2...  I'm thinking these alternative DE's might be good for a Menger.

« Last Edit: January 25, 2016, 12:55:23 AM by M Benesi » Logged

msltoe
Iterator
*
Posts: 187


« Reply #29 on: January 25, 2016, 04:27:21 AM »

Great job Matt on turning donuts into superstring ornaments suitable for 3-D printing.
Logged
Pages: 1 [2] 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Escape-time LRIFS Programming David Makin 11 9222 Last post March 22, 2010, 04:05:57 PM
by kram1032
Kaleidoscopic (escape time) IFS Sierpinski Gasket « 1 2 ... 9 10 » knighty 138 118436 Last post October 28, 2013, 10:23:48 PM
by Clemensson
Is there anything novel left to do in M-like escape-time fractals in 2d? Mandelbrot & Julia Set « 1 2 ... 22 23 » fracmonk 337 80164 Last post May 11, 2017, 10:12:20 PM
by greentexas
Escape time versions of IFS IFS - Iterated Function Systems msltoe 2 13088 Last post April 18, 2011, 02:54:48 PM
by msltoe
Improving over the escape time map (new) Theories & Research megafiddle 1 1253 Last post November 22, 2013, 03:38:37 AM
by megafiddle

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