Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => Sierpinski Gasket => Topic started by: knighty on May 01, 2010, 10:02:40 PM




Title: Kaleidoscopic (escape time) IFS
Post by: knighty on May 01, 2010, 10:02:40 PM
Hello,
Here are some renderings of a class of fractals which I call "Kaleidoscopic IFS". There is a big variations of shapes one can get with this method.
I began with this algorithm to get DE for symmetric Sierpinski tetrahedron:
Code:
//scale=2
//bailout=1000
sierpinski3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<10 && r<bailout;i++){
      //Folding... These are some of the symmetry planes of the tetrahedron
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
      if(y+z<0){y1=-z;z=-y;y=y1;}
      
      //Stretche about the point [1,1,1]*(scale-1)/scale; The "(scale-1)/scale" is here in order to keep the size of the fractal constant wrt scale
      x=scale*x-(scale-1);//equivalent to: x=scale*(x-cx); where cx=(scale-1)/scale;
      y=scale*y-(scale-1);
      z=scale*z-(scale-1);
      r=x*x+y*y+z*z;
   }
   return (sqrt(r)-2)*scale^(-i);//the estimated distance
}
Then I added a rotation before the fold or before the stretch or both.
Code:
//scale=2
//bailout=1000
sierpinski3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<10 && r<bailout;i++){
      rotate1(x,y,z);
      
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
      if(y+z<0){y1=-z;z=-y;y=y1;}
      
      rotate2(x,y,z);

      x=scale*x-(scale-1);
      y=scale*y-(scale-1);
      z=scale*z-(scale-1);
      r=x*x+y*y+z*z;
   }
   return (sqrt(r)-2)*scale^(-i);//the estimated distance
}
Then I allowed the center of stretching to be modified.
Code:
//scale=2
//bailout=1000
sierpinski3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<10 && r<bailout;i++){
      rotate1(x,y,z);
      
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
      if(y+z<0){y1=-z;z=-y;y=y1;}
      
      rotate2(x,y,z);

      x=scale*x-CX*(scale-1);
      y=scale*y-CY*(scale-1);
      z=scale*z-CZ*(scale-1);
      r=x*x+y*y+z*z;
   }
   return (sqrt(r)-2)*scale^(-i);//the estimated distance
}
(In my implementation [CX,CY,CZ] is constrained to be on the unit sphere)
This gives 1+3+3+2=9 parameters in total (scale->1,rotation1->3,rotation2->3,center of stretch->2).

The set of folding operation may be different. Here are those that I've tried:
- half tetrahedral symmetry planes: the same than above.
Code:
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
      if(y+z<0){y1=-z;z=-y;y=y1;}
- 2nd half tetrahedral symmetry planes:
Code:
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
- full tetrahedral symmetry planes:
Code:
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
      if(y+z<0){y1=-z;z=-y;y=y1;}
- cubic symmetry planes:
Code:
      x=abs(x);y=abs(y);z=abs(z);
- half octahedral symmetry planes:
Code:
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
- full octahedral symmetry planes:
Code:
      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}

Ah! I forgot the pictures ;D:
(http://www.fractalforums.com/gallery/2/932_25_04_10_11_16_19_1.jpeg)

(http://www.fractalforums.com/gallery/2/932_27_04_10_8_54_09_3.jpeg)

(http://www.fractalforums.com/gallery/2/932_01_05_10_8_46_59_2.jpeg)

se also: http://www.fractalforums.com/index.php?action=gallery;su=user;cat=164;u=932 (http://www.fractalforums.com/index.php?action=gallery;su=user;cat=164;u=932)

(http://www.fractalforums.com/gallery/2/932_01_05_10_8_46_59_4.jpeg)

The last picture is done with this algorithm:
Code:
Menger3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
      rotate1(x,y,z);

      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}

      rotate2(x,y,z);
    
      x=scale*x-CX*(scale-1);
      y=scale*y-CY*(scale-1);
      z=scale*z;
      if(z>0.5*CZ*(scale-1)) z-=CZ*(scale-1);
      
      r=x*x+y*y+z*z;
   }
   return (sqrt(x*x+y*y+z*z)-2)*scale^(-i);
}
Which gives the menger sponge when used with CX=CY=CZ=1, scale=3 and no rotation.

___________________________________________
Here is another version of the menger Sponge (that makes it a true "Kaleidoscopic IFS"):
Code:
Menger3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
      rotate1(x,y,z);

      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
      
      z-=0.5*CZ*(scale-1)/scale;
      z=-abs(-z);
      z+=0.5*CZ*(scale-1)/scale;

      rotate2(x,y,z);
    
      x=scale*x-CX*(scale-1);
      y=scale*y-CY*(scale-1);
      z=scale*z;
      
      r=x*x+y*y+z*z;
   }
   return sqrt(x*x+y*y+z*z)*scale^(-i);
}


Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 01, 2010, 11:58:33 PM
Most excellent, I'll definitely be playing with these at some point ;)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 02, 2010, 10:01:50 AM
Very interesting. I particularly like the last one :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Rathinagiri on May 02, 2010, 10:52:35 AM
Nice one.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Nahee_Enterprises on May 02, 2010, 12:48:28 PM
Here are some renderings of a class of fractals which I call "Kaleidoscopic IFS".
   ...........
The last picture is done with this algorithm:
   ...........
Which gives the menger sponge when used with CX=CY=CZ=1, scale=3 and no rotation.

This last image is very intriguing!!!  A lot of possibilities!!!   :)
 


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 02, 2010, 01:57:12 PM
those patterns are beautiful


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 02, 2010, 05:21:22 PM
I've used your Menger sponge algorithm as a starting point and found with scale of 1.3, a single rotation r.y of 25 degs and C values of [2, 4.8, 0] I get these tree structures. The sequence is made by changing r.y. The last image has a Glynn type fractal in there :)

(http://farm5.static.flickr.com/4048/4571411784_e11ab1eb46_b.jpg) (http://www.flickr.com/photos/subblue/4571411784/sizes/o/)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: matsoljare on May 02, 2010, 10:28:01 PM
The second and fourth in the first post are especially interesting. Can you try varying one of the values with one of the axis?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 02, 2010, 11:01:12 PM
Thanks  ^-^
Amazing one subblue! At some point, it looks like savannah. You are using the GPU I gess. Is it realtime?

There are many other known fractals that may appear from nowhere. I've already met the Koch curve, cantor dust and others I don't know the name. The variation of possible shapes, from geometric figures to organic forms, still amazes me. The possibilities are infinite  :dink:, not only by changing the parameters but also by changing the algorithm.

What I've described in the O.P. is actually what I've explored so far. The main ingredients are the folding and the stretching, that is, kneading the space ;D. Then add some salt and spice. Seriously! In the case of this class of fractals, folding are done about planes and stretching is an homothety. The rotations may be the salt and spice. I realize now that one can insert as many rotations between the foldings. In principle other transformations than a rotation can be used (but I may be wrong). The nice thing with rotation (and other orthonormal transformations) is that the distance estimation remains very simple and the generated distance field is continuous. I guess because they don't add stretching.

I think the kneading process is what is done to generate escape time fractals in general... but this is a little bit off topic. I'll start another thread.

PS: Most ideas behind these fractals were found in this forum. :dink:
PS2: BTW, I think these fractals may be rendered as attractor set just like classical IFS or julia sets.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 02, 2010, 11:10:04 PM
The second and fourth in the first post are especially interesting. Can you try varying one of the values with one of the axis?
Unfortunatly, I have forgotten the parameters used for these pictures. Currently, in my program (actually an evaldraw script), it's impossible to save the parameters. I'll try to find them and do some little image sequences.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 03, 2010, 05:58:41 PM
Hi knighty, how did you derive:

    (sqrt(r)-2)*scale^(-i)

?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 03, 2010, 07:42:57 PM
I think the "-2" is not needed as R will be greater than the bailout, so substracting 2 does not make a big difference.
For the rest the DE is the same as the one for the Mandelbox..

BTW, I accidentally dropped my Menger sponge :


Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 03, 2010, 09:19:24 PM
It was the "-2" that I was wondering about :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 03, 2010, 09:32:27 PM
The -2 is in reality the radius of a bounding sphere of the fractal (this is not the smallest one. In my case it's 1 for the octo-sierpinski and sqrt(3) for the tetra-sierpinski and the octahedron). If you use say max_iterations=10, when zooming you obtain at some point only dust and the rendering becomes much slower. It is not necessary when using a big max_iterations, the dust is hidden by the solid threshold.

I do the same thing for Tglad's amazing box for the same reason. For the mandelbulb I use sometime a similar technique. Instead of DE=0.5*r*log(r)/dr, I use DE=0.5*r*log(sqrt(r^2+1.5^2)-1.5). All this is in order to get a DE based solid threshold consistant with max iterations solid threshold.

Also, on can use the distance to the bounding volume of the fractal instead of the bounding sphere. in the case of the tetra sierpinski it's simply (and obviousely) a tetrahedron... etc. In general it isn't worth the pain. I'll post the full algorithms later.




Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 03, 2010, 09:37:05 PM
BTW, I accidentally dropped my Menger sponge :
At the angle there is a Koch triangle!  ;D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 03, 2010, 09:45:19 PM
Thanks.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 03, 2010, 10:47:15 PM
Quote
The -2 is in reality the radius of a bounding sphere of the fractal..

I'm not sure I understand.
These things do not turn to dust as far as I can see.
I'm now doing something where I've zoomed to a magnification of about 1.5 million, using just DE=sqrt(R)/scale^i. I simply stop if DE<A, and my A is now about 1E-11. Must say I have max iters set at 100 and bailout at 1000.

Here it is (without anti aliasing) :


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Buddhi on May 03, 2010, 10:49:08 PM
These Kaleidoscopic fractal are amazing!!! I have to try with this.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 03, 2010, 11:26:12 PM
I'm loving this new algorithm. Lots to explore :)

Lots of windows:
(http://farm5.static.flickr.com/4070/4576339974_255fcafc79.jpg) (http://www.flickr.com/photos/subblue/4576339974/sizes/o/)

And the inside:
(http://farm4.static.flickr.com/3387/4575706799_9b32fb254b.jpg) (http://www.flickr.com/photos/subblue/4575706799/sizes/o/in/photostream/)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 04, 2010, 02:08:56 PM
Quote
The -2 is in reality the radius of a bounding sphere of the fractal..

I'm not sure I understand.
These things do not turn to dust as far as I can see.
I'm now doing something where I've zoomed to a magnification of about 1.5 million, using just DE=sqrt(R)/scale^i. I simply stop if DE<A, and my A is now about 1E-11. Must say I have max iters set at 100 and bailout at 1000.

Here it is (without anti aliasing) :
With a max iterations of 100 you don't need the -2. If scale=3, A=1E-11 corresponds roughly to 21 iteration. So with max iters set 100 you can (in principle) zoom much deeper before getting dust.

Here is a sequence for the last picture of the original post. this is done with rotate1()=rotate2(). the rotation is about the z axis.
(http://www.fractalforums.com/gallery/2/932_04_05_10_2_01_33_0.jpeg)

Here is the algorithms I use for simple tetra-sierpinski and menger sponge. A nice feature of these is that you can control the recursion depth just like the classic "geometric" method:
Code:
sierpinski(x,y,z){
   scale=2;
   r=0;
   for(i=0;i<MI && r<1;i++){
      x1=rot[0][0]*x+rot[1][0]*y;
      y1=rot[0][1]*x+rot[1][1]*y;
      z1=z;
      x=x1;y=y1;z=z1;
     
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x+y<0){x1=-y;y=-x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(x+z<0){x1=-z;z=-x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
      if(y+z<0){y1=-z;z=-y;y=y1;}
     
      r=(x+y-z-1)*1/sqrt(3);
     
      x=scale*x-(scale-1);
      y=scale*y-(scale-1);
      z=scale*z-(scale-1);
   }
   return r*scale^(1-i);
}

menger(x,y,z){
   scale=3;
   r=0;
   for(i=0;i<MI && r<1;i++){
      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
     
      x1=x-1;y1=y-1;z1=z-1;
      r=max(x1,max(y1,z1));
      /*nice alternative that gives rounded (external) edges.
      It's not necessary to calc the sqrt() at eache iteration
      if(x1<0 && y1<0 && z1<0) r=max(x1,max(y1,z1));
      else r=sqrt(max(0,x1)^2+max(0,y1)^2+max(0,z1)^2);
      */
     
      x=scale*x-(scale-1);
      y=scale*y-(scale-1);
      z=scale*z;
      if(z>0.5*(scale-1)) z-=(scale-1);
   }
   r*scale^(1-i)
}


Title: Re: Kaleidoscopic (escape time) IFS
Post by: bib on May 04, 2010, 03:08:18 PM
I like a lot the "mechanical" aspect of this cubes.

Next challenge : can anyone do a fractal that will look like the Eiffel tower ? :D

(http://media-cdn.tripadvisor.com/media/photo-s/01/00/ac/3b/paris-tour-eiffel.jpg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 04, 2010, 09:39:36 PM
That should be possible. We already have one that looks a little like "l'arche de la Défense".  ;D

I'm loving this new algorithm. Lots to explore :)

Lots of windows:
(http://farm5.static.flickr.com/4070/4576339974_255fcafc79.jpg) (http://www.flickr.com/photos/subblue/4576339974/sizes/o/)

And the inside:
(http://farm4.static.flickr.com/3387/4575706799_9b32fb254b.jpg) (http://www.flickr.com/photos/subblue/4575706799/sizes/o/in/photostream/)

The inside looks promising. It would be useful to have a cutting plane at hand for those that have more interresting features inside.

You can add colouring as in this post http://www.fractalforums.com/index.php?topic=2526.msg12794#msg12794 (http://www.fractalforums.com/index.php?topic=2526.msg12794#msg12794). I use this one for the menger sponge family:
Code:
Mengercolor(x,y,z){
   r=x*x+y*y+z*z;
   c=0;
   for(i=0;i<MI;i++){//It is better to use a fixed iterations number to avoid shift when zooming.

      rotate1();

      c1=0;
      c1+=0.5*(1-sgn(x));c1+=0.5*(1-sgn(y));c1+=0.5*(1-sgn(z));
      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;c1+=1;}
      if(x-z<0){x1=z;z=x;x=x1;c1+=1;}
      if(y-z<0){y1=z;z=y;y=y1;c1+=1;}

      rotate2(); 
 
      x=scale*x-stc[0]*(scale-1);
      y=scale*y-stc[1]*(scale-1);
      z=scale*z;
      if(z>0.5*stc[2]*(scale-1)) {z-=stc[2]*(scale-1);c1+=1;}
      c+=c1*0.5;
      r=x*x+y*y+z*z;
   }
   return c;//this will be used as an index into a palette
}


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Hamilton on May 05, 2010, 12:14:14 AM
That's great shapes you got there, Knighty.  :)
It sounds like a very interesting algorithm, indeed.
Did you use your own renderer to get thoses images?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 05, 2010, 02:17:21 PM
It is a little, badly written, full of bugs script that runs with evaldraw (a nice program by ken silverman that includes a just in time c-like language compiler).  ;D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Nahee_Enterprises on May 05, 2010, 02:43:49 PM
I'm loving this new algorithm.  Lots to explore  :)
   ..........
And the inside:

I like this cut-away view!!   :)   
Reminds me of a four barrel carburetor that gave me problems once while I was trying to give it a new kit.
 


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Jesse on May 05, 2010, 05:24:14 PM
Have only done some basics without rotation yet, but it gives also funny alternating hybrids:
(http://www.fractalforums.com/gallery/2/1127_05_05_10_5_17_36.jpeg)

Yes, it is a hybrid of vegetables and mint bonbons...


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 05, 2010, 10:09:17 PM
Nice rendering! (as usual  :tongue1:) Is it a mix of juliabulb and tetra-sierpinski?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 05, 2010, 10:22:26 PM
Knighty, do you have some background information on how you constructed the generator code?
I mean, how does does
if(x-y<0){x1=y;y=x;x=x1;}
    if(x+y<0){x1=-y;y=-x;x=x1;}
    if(x-z<0){x1=z;z=x;x=x1;}  etc etc

generate the Sierpinsky ? ..and the code for the Menger sponge is also a bit of magic in my eyes..

I was trying to generate an octahedral Sierpinsky, but so far all my efforts have failed..


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 05, 2010, 11:22:45 PM
These are the symmetry planes of the tetrahedra...etc. I have to go now. I'll try to give more info tomorrow.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: msltoe on May 06, 2010, 12:46:09 AM
Good stuff here...

If you remember some of my escape-time Sierpinskis, what you can do in general is define a set of vertices (e.g., those for an octahedron). Then for a given "z", find the nearest vertex. Reflect off the vertex, etc. using 2*(vertex)-point or something like that.

http://www.fractalforums.com/3d-fractal-generation/sierpinski-like-fractals-using-an-iterative-function/ (http://www.fractalforums.com/3d-fractal-generation/sierpinski-like-fractals-using-an-iterative-function/)

-mike


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Jesse on May 06, 2010, 01:16:09 AM
Nice rendering! (as usual  :tongue1:) Is it a mix of juliabulb and tetra-sierpinski?

Not a julia (that gives even more possibilties), that was a power 8 bulb and the tetra-sierpinski.

A combination with TGlads box is one more option that gives another endless variety...
(only a quick test, no more time yet)

(http://www.fractalforums.com/gallery/2/1127_06_05_10_1_11_18.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Hamilton on May 06, 2010, 10:48:55 AM
Great shapes indeed!
Can't wait to play with these algorithms too... ;)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 06, 2010, 09:17:27 PM
Great shapes indeed!
Can't wait to play with these algorithms too... ;)
If you like I'll make my script available. But it is not easy to use (at first).

Good stuff here...

If you remember some of my escape-time Sierpinskis, what you can do in general is define a set of vertices (e.g., those for an octahedron). Then for a given "z", find the nearest vertex. Reflect off the vertex, etc. using 2*(vertex)-point or something like that.

http://www.fractalforums.com/3d-fractal-generation/sierpinski-like-fractals-using-an-iterative-function/ (http://www.fractalforums.com/3d-fractal-generation/sierpinski-like-fractals-using-an-iterative-function/)

-mike
Yes I remember :dink:. It's actually the starting point of these algorithms. The main difference is an explicit folding instead of choosing the nearest scaling center. I did so in order to make it GPU friendly.

What you do is perhaps (i'm not sure) more general but I was worrying about the continuity of the distance field. In fact I'm using a very simple DE based raymarcher that don't work well with discontinuous distance field.

Knighty, do you have some background information on how you constructed the generator code?
I mean, how does does
if(x-y<0){x1=y;y=x;x=x1;}
    if(x+y<0){x1=-y;y=-x;x=x1;}
    if(x-z<0){x1=z;z=x;x=x1;}  etc etc

generate the Sierpinsky ? ..and the code for the Menger sponge is also a bit of magic in my eyes..

I was trying to generate an octahedral Sierpinsky, but so far all my efforts have failed..

It is maybe easyer to visalize things in 2D. Let's take a 2D variant of msltoe's algorithm but for the sierpinski triangle. the coordinates of the centers of scaling are (1,0),(-0.5,sqrt(3)/2) and (-0.5,-sqrt(3)/2) (up to a rotation and scaling). In msltoe's algorithm at each iteration you take the scaling center that is closest to the current position then do the scaling (stretch) wrt the closest scaling center. But in our case the three centers are symmetric. There are 6 axis of symmetry. The idea is that choosing the nearest center of scaling is equivalent to reflect the current position about (some of) the symmetry axis in order to make it nearer to one of the centers. in the case of sierpinski triangle, two symmetries are enough. for example : the one that goes through (0,0) and (-0.5,-sqrt(3)/2) and the one that goes through (0,0) and (-0.5,sqrt(3)/2). They will "transport" any point of the plan in the area where they will be closer to (1,0) than the opposit centers.

In the case of octahedral sierpinski, there are 9 (need confirmation ;D) planes of symmetry. if the vertices are: (1,0,0),(-1,0,0),(0,1,0),(0,-1,0),(0,0,1) and (0,0,-1) the planes of symmetry will be: x=0,y=0,z=0,x+y=0,x-y=0,x+z=0,x-z=0,y+z=0 and y-z=0. this full set is not necessary to get the octahedral sierpinski. Only 4 are needed. those that corresponds to (1,0,0) are x+y=0,x-y=0,x+z=0 and x-z=0.

With rotation, choosing the "minimal" set or the "full" set of planes of symmetry gives different results. The "full" set gives the most symmetric fractals.

That said, I realize that rotations before folding are equivalent to rotating the folding planes in the inverse direction. That means rotations are not necessary (but convenient) and can lead to some optimizations.(EDIT: this is not true.  :hurt:)

I'm just beginning to explore the math behind this fractals. They must have someting to do with Coxeter groups, among which the symmetries of the platonic solids, and paper folding maths (http://en.wikipedia.org/wiki/Coxeter_group (http://en.wikipedia.org/wiki/Coxeter_group),http://en.wikipedia.org/wiki/Mathematics_of_paper_folding (http://en.wikipedia.org/wiki/Mathematics_of_paper_folding)).

Next step: "origami fractals". guess why!  :alien:

Nice rendering! (as usual  :tongue1:) Is it a mix of juliabulb and tetra-sierpinski?

Not a julia (that gives even more possibilties), that was a power 8 bulb and the tetra-sierpinski.

A combination with TGlads box is one more option that gives another endless variety...
(only a quick test, no more time yet)

<http://www.fractalforums.com/gallery/2/1127_06_05_10_1_11_18.jpeg (http://www.fractalforums.com/gallery/2/1127_06_05_10_1_11_18.jpeg)>
Thanks. Combining fractals is the coolest idea of all. Is it Tglad box then Mandelbulb or the reverse?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Jesse on May 06, 2010, 10:01:58 PM
Quote
Thanks. Combining fractals is the coolest idea of all. Is it Tglad box then Mandelbulb or the reverse?
(edit:)
The first one was 1 iteration pow8 bulb and 4 iterations sierpinski tetrahedron, the second was imho sierpinsky terahedron and mandbox in that row. Both with negative scalings.

Btw, many thanks for the code. Just have to reprogram many things to get 9 parameters changed!
I think that will give enough combinations, for now i have to play around with combis.

Another one like the second image, but with default parameters, means scaling 2 for both:

http://www.fractalforums.com/gallery/2/1127_07_05_10_3_40_21.jpeg (http://www.fractalforums.com/gallery/2/1127_07_05_10_3_40_21.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 06, 2010, 11:09:53 PM
Just have to reprogram many things to get 9 parameters changed!
I think that will give enough combinations, for now i have to play around with combis.
The number of combinations is becoming very big. I'm thinking about using metaprogramming. I'm working on the idea of generating GPU shaders on this basis. For CPU native code, a just in time script compiler would be useful.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 07, 2010, 08:21:22 AM
Thanks for the explanation.
Code for the octahedral Sierp :
Code:
 scale=2
       if x+y<0, x1=-y,y=-x,x=x1,endif
       if x+z<0, x1=-z,z=-x,x=x1,endif
       if x-y<0, x1=y,y=x,x=x1,endif
       if x-z<0, x1=z,z=x,x=x1,endif

      x=x*scale-1*(scale-1)
      y=y*scale-0*(scale-1)
      z=z*scale-0*(scale-1)

Here it is :


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 08, 2010, 08:34:18 PM
Nice one ^-^
I'm working on dodeca and icosahedra-sierpinski. The folding set a little bit more difficult to find.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: msltoe on May 08, 2010, 08:55:55 PM
It would be interesting to see if the folding plane solution produces the same results as the Julia vertex reflection for the icosahedron:



Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 09, 2010, 01:52:01 AM
Thanks Jos for the octahedral folding. It gives some very interesting structures.
I've had a busy evening building my own mechanical tree - only managed the stump so far though :)

(http://farm5.static.flickr.com/4060/4590485682_c37e03204a_b.jpg) (http://www.flickr.com/photos/subblue/4590485682/sizes/o/)

(http://farm5.static.flickr.com/4001/4589865029_c045bdf1b2_b.jpg) (http://www.flickr.com/photos/subblue/4589865029/sizes/o/in/photostream/)




Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 09, 2010, 11:39:47 AM
Thanks Jos for the octahedral folding. It gives some very interesting structures.
I've had a busy evening building my own mechanical tree - only managed the stump so far though :)

(http://farm5.static.flickr.com/4060/4590485682_c37e03204a_b.jpg) (http://www.flickr.com/photos/subblue/4590485682/sizes/o/)

(http://farm5.static.flickr.com/4001/4589865029_c045bdf1b2_b.jpg) (http://www.flickr.com/photos/subblue/4589865029/sizes/o/in/photostream/)
This is absolutely awesome subblue.

It would be interesting to see if the folding plane solution produces the same results as the Julia vertex reflection for the icosahedron:
Well, it should. I'll post the results later in case I succeed.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 09, 2010, 12:00:13 PM
whoa, GREAT subblue!
That's not too far away from a recursive Eifel-Tower :D
I guess, as that often is the case, that construction would be surprisingly stable, due to its fractal natue :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: visual.bermarte on May 09, 2010, 01:46:08 PM
Quick test (I have no time :-() Thanx to Mikael Hvidtfeldt (Syntopia) and Knighty!
http://fc00.deviantart.net/fs71/f/2010/129/d/5/Distorted_Menger_by_bermarte.swf


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 09, 2010, 02:30:21 PM
Thanks for the animation visual. Cool! :)
Finally I've obtained a good folding planes set for the dodecahedra-siepinski. Their normal vectors are:
(phi^2,1,-phi) , (-phi,phi^2,1) , (1,-phi,phi^2) , (-phi*(1+phi),phi^2-1,1+phi) , (1+phi,-phi*(1+phi),phi^2-1)
and the x=0, y=0 and z=0 planes.

The center of scaling should be (1,0,phi) for the dodeca sirpinski.
Phi is the golden ratio (phi=(1+sqrt(5))/2).

Here is the code I used (note that the vectors are normalized):
Code:
#define _IVNORM_ (0.5/_PHI_)
#define _PHI1_ (_PHI_*_IVNORM_)
#define _1PHI_ (_IVNORM_)
#define _PHI2_ (_PHI_*_PHI_*_IVNORM_)

#define _IKVNORM_ 1/sqrt((_PHI_*(1+_PHI_))^2+(_PHI_^2-1)^2+(1+_PHI_)^2)
#define _C1_ (_PHI_*(1+_PHI_)*_IKVNORM_)
#define _C2_ ((_PHI_*_PHI_-1)*_IKVNORM_)
#define _1C_ ((1+_PHI_)*_IKVNORM_)
dodecasierpinski3(x,y,z,scale,rot[3][3]){
   r=x*x+y*y+z*z;
   i=0;
   for(i=0;i<MaxIteration && r<Bailout; i++){
#ifdef PRE_ROTATE
      x1=rot[0][0]*x+rot[1][0]*y+rot[2][0]*z;
      y1=rot[0][1]*x+rot[1][1]*y+rot[2][1]*z;
      z1=rot[0][2]*x+rot[1][2]*y+rot[2][2]*z;
      x=x1;y=y1;z=z1;
#endif      
      x=abs(x);
      y=abs(y);
      z=abs(z);
      t=_PHI2_*x+_1PHI_*y-_PHI1_*z;
      if(t<0){x=x-2*t*_PHI2_;y=y-2*t*_1PHI_;z=z+2*t*_PHI1_;}

      t=-_PHI1_*x+_PHI2_*y+_1PHI_*z;
      if(t<0){x=x+2*t*_PHI1_;y=y-2*t*_PHI2_;z=z-2*t*_1PHI_;}

      t=_1PHI_*x-_PHI1_*y+_PHI2_*z;
      if(t<0){x=x-2*t*_1PHI_;y=y+2*t*_PHI1_;z=z-2*t*_PHI2_;}

      t=-_C1_*x+_C2_*y+_1C_*z;
      if(t<0){x=x+2*t*_C1_;y=y-2*t*_C2_;z=z-2*t*_1C_;}

      t=_1C_*x-_C1_*y+_C2_*z;
      if(t<0){x=x-2*t*_1C_;y=y+2*t*_C1_;z=z-2*t*_C2_;}
      
#ifdef POST_ROTATE
      x1=rot[0][0]*x+rot[1][0]*y+rot[2][0]*z;
      y1=rot[0][1]*x+rot[1][1]*y+rot[2][1]*z;
      z1=rot[0][2]*x+rot[1][2]*y+rot[2][2]*z;
      x=x1;y=y1;z=z1;
#endif      
      x=scale*x-(scale-1)*stc[0];//stc is the center of scaling
      y=scale*y-(scale-1)*stc[1];
      z=scale*z-(scale-1)*stc[2];
      r=x*x+y*y+z*z;
   }
   return (sqrt(r)-2)*scale^(-i);
}

Now some results:
dodeca01. center of scaling (1,1,1); scale=phi^2
(http://www.fractalforums.com/gallery/2/932_09_05_10_2_04_51_2.jpeg)

dodeca02. center of scaling (1,1,1); scale=2*phi
(http://www.fractalforums.com/gallery/2/932_09_05_10_2_04_51_3.jpeg)

Icosa01. center of scaling (1,0,phi); scale=2
(http://www.fractalforums.com/gallery/2/932_09_05_10_2_04_51_0.jpeg)

Icosa02. center of scaling (1,0,phi); scale=phi^2
(http://www.fractalforums.com/gallery/2/932_09_05_10_2_04_51_1.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 09, 2010, 02:40:19 PM
Wanted to say two things:
1- In order to get interresting fractals, it's not necessary for the planes to go through (0,0,0). Any set of planes may give good fractal shapes. That's what I've called "origami fractals" ;D
2- The distance estimate is very good and doesn't need (in general) to be scaled down. In some cases (when bailout is low) you need to scale it down a little (say descale=0.9 or 0.95).


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 09, 2010, 03:33:25 PM
Do you have the code for icosa also?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 09, 2010, 03:56:28 PM
It's exacty the same algorithm. The only things that change are the center of scaling and the scale factor. this is not surprising because icosahedron and dodecahedron have the same symmetries. if you change the position of the scaling center and the scale factor you'll get the sierpinski-like fractals corresponding to dodecahedron family of semi-regular polyhedrons. (This is not totaly true because the set I've given is not the full set... I'm working on it)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: msltoe on May 09, 2010, 04:46:41 PM
It looks like the dodeca01 is like my icosahedral vertex reflection. Too bad there's few platonic solids in 3-d. But, I have a hunch that non-platonic shapes may produce interesting fractals because of the "interference" effects we see in the Mandelbox.

-mike


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 09, 2010, 06:01:39 PM
Yes they are the same. :)
Under "full" symmetry planes set, you can obtain a morph between a regular-polyhedra-sierpinski to their its duals by changing the position of the center of symmetry. Some of the in-between polyhedras are semi-regular. All of them have the same symmetries.
for example, for the tetrahedra which is self dual, under full set of plane symmetries:
x+y=0; x-y=0; x+z=0; x-z=0; y+z=0 and y-z=0;(one have to be careful about the orientation of these planes)
If we define the "center of scaling" this way:
CS=a*(1,1,1)+b*(0,1,0)+c*(-1/3,1,-1/3); a+b+c=1 (barycentric coordinates)
and vary a,b and c, we should get the family of tetrahedron-siepinski.
a=1 gives tetrahedron-sierpinski.
b=1 gives octahedron-sierpinski.
c=1 gives another tetrahedron-sierpinski.

It's exacty the same algorithm. The only things that change are the center of scaling and the scale factor. this is not surprising because icosahedron and dodecahedron have the same symmetries. if you change the position of the scaling center and the scale factor you'll get the sierpinski-like fractals corresponding to dodecahedron family of semi-regular polyhedrons. (This is not totaly true because the set I've given is not the full set... I'm working on it)
Must say that in the case of dodecahedra, the two last symmetries (in the code I've provided above) are not necessary.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 10, 2010, 03:36:16 PM
Yes they are the same. :)
Under "full" symmetry planes set, you can obtain a morph between a regular-polyhedra-sierpinski to their duals by changin the position of the center of symmetry. Some of the in-between polyhedras are semi-regular. All of them have the same symmetries.
for example, for the tetrahedra which is self dual, under full set of plane symmetries:
x+y=0; x-y=0; x+z=0; x-z=0; y+z=0 and y-z=0;(one have to be careful about the orientation of these planes)
If we define the "center of scaling" this way:
CS=a*(1,1,1)+b*(0,1,0)+c*(-1/3,1,-1/3); a+b+c=1 (barycentric coordinates)
and vary a,b and c, we should get the family of tetrahedron-siepinski.
a=1 gives tetrahedron-sierpinski.
b=1 gives octahedron-sierpinski.
c=1 gives another tetrahedron-sierpinski.
I did some research and found this wiki article about Wythoff Kaleidoscopic construction (http://en.wikipedia.org/wiki/Wythoff_construction (http://en.wikipedia.org/wiki/Wythoff_construction)). That should make the previous post clearer. I was amazed to see that the word "Kaleidoscopic" is already used. :D

Softology posted some nice videos of Kaleidoscopic menger sponge at Youtube.
http://www.youtube.com/v/bCP7yeFQvnc&hl=fr_FR&fs=1&


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 10, 2010, 04:15:02 PM
Just to illustrate the two posts above.
Algorithm: tetra-sierpinski full symmetry planes set.
Parameters for each picture:
(a=1,    b=0, c=0,    scale=2); (a=1/3, b=2/3, c=0,    scale=2);
(a=0,    b=1, c=0,    scale=2); (a=1/3, b=1/3, c=1/3, scale=2);
(a=1/4, b=0, c=3/4, scale=2); (a=1/4, b=0,    c=3/4, scale=3);
(http://www.fractalforums.com/gallery/2/932_10_05_10_4_04_43_0.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 10, 2010, 08:17:37 PM
knighty:
Are those supposed to be the duals?
They rather look like half way throughs, exactly between the two duals :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 11, 2010, 05:42:08 AM
Thanks for sharing these methods.  Very interesting.

A few questions...

(In my implementation [CX,CY,CZ] is constrained to be on the unit sphere)
This gives 1+3+3+2=9 parameters in total (scale->1,rotation1->3,rotation2->3,center of stretch->2).

By constrained to the unit sphere you mean normalize the CX,CY,CZ?  And the center of stretch should have 3 parameters, not 2 as quoted?

I've used your Menger sponge algorithm as a starting point and found with scale of 1.3, a single rotation r.y of 25 degs and C values of [2, 4.8, 0] I get these tree structures. The sequence is made by changing r.y. The last image has a Glynn type fractal in there :)

I tried these parameters and cannot see the trees.  Can you give me a zoomed out look at this one?  Using your parameters and normailizing CX,CY,CZ I get this image (view full size to see all the finer details)

(http://farm5.static.flickr.com/4068/4597301059_037de4d4ba_o.jpg)

Thanks for any clarifications.

I am getting some nice results from these http://www.flickr.com/photos/39445835@N05/sets/72157623985965428/ (http://www.flickr.com/photos/39445835@N05/sets/72157623985965428/)

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 11, 2010, 12:25:25 PM
knighty:
Are those supposed to be the duals?
They rather look like half way throughs, exactly between the two duals :)
The images do not represent the duals but the semi-regular polyhedron-sierpinski family of the tetrahedron-sierpinski generated by moving the center of stretch over the fundamental triangle (see the reference to Withoff construction). some of them have more symmetries than the tetrahedron (they have octahedron symmetries) and one of them is regular (platonic): the octahedra.
Just like the tetrahedron, tetrahedron-sierpinski is self dual.

(In my implementation [CX,CY,CZ] is constrained to be on the unit sphere)
This gives 1+3+3+2=9 parameters in total (scale->1,rotation1->3,rotation2->3,center of stretch->2).
By constrained to the unit sphere you mean normalize the CX,CY,CZ?  And the center of stretch should have 3 parameters, not 2 as quoted?
Yes, I normalize the CX,CY,CZ. I do so because multiplying [CX,CY,CZ] by a constant changes only the size of the fractal. If normalised, a vector will have 2 free parameters not 3 because it's length is constrained to be constante (=1 in this case).

Your renderings are awesome... :worm:


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 11, 2010, 01:21:48 PM
I've used your Menger sponge algorithm as a starting point and found with scale of 1.3, a single rotation r.y of 25 degs and C values of [2, 4.8, 0] I get these tree structures. The sequence is made by changing r.y. The last image has a Glynn type fractal in there :)

I tried these parameters and cannot see the trees.  Can you give me a zoomed out look at this one?  Using your parameters and normailizing CX,CY,CZ I get this image (view full size to see all the finer details)
Maybe you are using a left handed coordinates system.
It should look like this:
(http://www.fractalforums.com/gallery/2/932_11_05_10_1_12_06_0.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 11, 2010, 08:52:28 PM
knighty: Ok, that's what I thought and what I tried to say :)
Softology: I have to say, that I actually prefer that variant over the other one :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 11, 2010, 09:01:22 PM
knighty: Ok, that's what I thought and what I tried to say :)
My bad! I've corrected the mistake in this post (http://www.fractalforums.com/index.php?topic=3158.msg16989#msg16989). :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 11, 2010, 11:49:39 PM
Maybe you are using a left handed coordinates system.

Can you share the snippet of code you use to rotate the X Y Z point around the CX CY CZ point?  Then I should be able to get the same results.

These are the routines I currently use to do the rotations

Code:
procedure Rotate2(const Rx,Ry,Rz:Double; const x,y,z:Double; Var Nx,Ny,Nz:Double);
Var TempX  : Double;
    TempY  : Double;
    TempZ  : Double;
    SinX   : Double;
    SinY   : Double;
    SinZ   : Double;
    CosX   : Double;
    CosY   : Double;
    CosZ   : Double;
    XRadAng: Double;
    YRadAng: Double;
    ZRadAng: Double;
Begin

 XRadAng := Rx*PIDiv180;
 YRadAng := Ry*PIDiv180;
 ZRadAng := Rz*PIDiv180;

 SinX    := Sin(XRadAng);
 SinY    := Sin(YRadAng);
 SinZ    := Sin(ZRadAng);

 CosX    := Cos(XRadAng);
 CosY    := Cos(YRadAng);
 CosZ    := Cos(ZRadAng);

 Tempy   := y*CosY - z*SinY;
 Tempz   := y*SinY + z*CosY;
 Tempx   := x*CosX - Tempz*SinX;

 Nz      := x*SinX     + Tempz*CosX;
 Nx      := Tempx*CosZ - TempY*SinZ;
 Ny      := Tempx*SinZ + TempY*CosZ;

End;

procedure Rotate(const Rx,Ry,Rz:Double; const x,y,z,ox,oy,oz:Double; Var Nx,Ny,Nz:Double);
Begin
 Rotate2(Rx,Ry,Rz,x-ox,y-oy,z-oz,Nx,Ny,Nz);
 Nx := Nx+ox;
 Ny := Ny+oy;
 Nz := Nz+oz;
End;

Here is a Kaleidoscopic IFS Cube

(http://farm4.static.flickr.com/3357/4599814774_6e068f54f6_o.jpg)

Thanks,
Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 12, 2010, 08:20:02 AM
This might help:
Code:
// Return rotation matrix for rotating around vector v by angle
float3x3 rotationMatrix(float3 v, float angle)
{
float c = cos(radians(angle));
float s = sin(radians(angle));

return float3x3(c + (1.0 - c) * v.x * v.x, (1.0 - c) * v.x * v.y - s * v.z, (1.0 - c) * v.x * v.z + s * v.y,
    (1.0 - c) * v.x * v.y + s * v.z, c + (1.0 - c) * v.y * v.y, (1.0 - c) * v.y * v.z - s * v.x,
    (1.0 - c) * v.x * v.z - s * v.y, (1.0 - c) * v.y * v.z + s * v.x, c + (1.0 - c) * v.z * v.z);
}

--

# 3x3 rotation matrix
float3x3 objRotation = rotationMatrix(float3(1, 0, 0), objectRotation.x) * rotationMatrix(float3(0, 1, 0), objectRotation.y) * rotationMatrix(float3(0, 0, 1), objectRotation.z);



Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 12, 2010, 12:45:58 PM
@Softology: Are you doing rotation around [Cx,Cy,Cz] instead of [0,0,0]? This will give you different results.
Here is how I set up the rotation matrix (I haven't checked if it is correct. Too lazy :tongue1:)
Code:
      //salpha: rotation about Z axis angle
      //sbeta: rotation about Y axis angle
      //stheta: rotation about X axis angle
      s1=sin(sbeta);c1=cos(sbeta);
      s2=sin(stheta);c2=cos(stheta);
      s3=sin(salpha);c3=cos(salpha);
      rotmat[0][0]=c1*c3+s1*s2*s3; rotmat[0][1]=c2*s3; rotmat[0][2]=c1*s2*s3-c3*s1;
      rotmat[1][0]=c3*s1*s2-c1*s3; rotmat[1][1]=c2*c3; rotmat[1][2]=s1*s3+c1*c3*s2;
      rotmat[2][0]=c2*s1;          rotmat[2][1]=-s2;   rotmat[2][2]=c1*c2;
And how I apply it:
Code:
      x1=rot[0][0]*x+rot[1][0]*y+rot[2][0]*z;
      y1=rot[0][1]*x+rot[1][1]*y+rot[2][1]*z;
      z1=rot[0][2]*x+rot[1][2]*y+rot[2][2]*z;
      x=x1;y=y1;z=z1;

@subblue: Thanks for the snippet. I was looking for it :). I guess ||v|| should be equal to 1, right?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 12, 2010, 01:19:31 PM
@subblue: Thanks for the snippet. I was looking for it :). I guess ||v|| should be equal to 1, right?

Yes, 'v' is a normalised direction vector.
I think my rotation matrix could probably be replaced with a Quaternion implementation, which should be a little quicker - although the matrices are only calculated once at the start so will have negligible overhead compared with the rest of the script.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 12, 2010, 07:36:55 PM
I managed to also create the dodecahedron and icosahedron version.
For the dodeca, I scale from the point <1,1,1> (scale=phi^2) and reflect on the planes with normals :
<-1,phi-1,1/phi-1>
<phi-1,1/phi-1,-1>
1/phi-1,-1, phi-1 >

For the icosa, it's the point <phi,1,0> (scale=2.35) and the planes with normals :
<1-phi,-1,phi>
<-phi,phi-1,1>
<-phi,phi-1,-1>
<1-phi,-1,-phi>
<0,-1,0>


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 12, 2010, 10:11:06 PM
I think my rotation matrix could probably be replaced with a Quaternion implementation, which should be a little quicker - although the matrices are only calculated once at the start so will have negligible overhead compared with the rest of the script.
IMHO it will not be faster on GPU. A matrix-vector multiplication is equivalent to 3 dot products. I suspect modern GPU do them in parallel. in the case of quaternion you have to do two quaternion-multiplactions. Each one needs a dot product, a cross product and some additions and multiplications. Ok, I have to try both before giving my opinion. ;D

I managed to also create the dodecahedron and icosahedron version.
For the dodeca, I scale from the point <1,1,1> (scale=phi^2) and reflect on the planes with normals :
<-1,phi-1,1/phi-1>
<phi-1,1/phi-1,-1>
1/phi-1,-1, phi-1 >

For the icosa, it's the point <phi,1,0> (scale=2.35) and the planes with normals :
<1-phi,-1,phi>
<-phi,phi-1,1>
<-phi,phi-1,-1>
<1-phi,-1,-phi>
<0,-1,0>
Haven't you applied reflections about xy,xz and yz planes(using x=abs(x); y=abs(y) and z=abs(z))?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 12, 2010, 11:08:30 PM
Quote
Haven't you applied reflections about xy,xz and yz planes(using x=abs(x); y=abs(y) and z=abs(z))?

No, what I do is take a vertex of the polyhedron, and the planes through the origin perpendicular to the edges that meet at that vertex. So for the dodeca, this is three planes, and five planes for the icosa.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 12, 2010, 11:18:00 PM
Thanks! I was wondering what is the minimal set of reflexion planes necessary to get a given (regular)polyhedra-sierpinski. It seems to be 3. That should make things faster :).


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 13, 2010, 02:11:45 AM
@Softology: Are you doing rotation around [Cx,Cy,Cz] instead of [0,0,0]? This will give you different results.

Yes I was doing the rotations around CX,CY,CZ.  Thanks for the code.  Changing the rotations around the origin gets the tree structures.

(http://farm2.static.flickr.com/1219/4602775034_88a4235356_o.jpg)

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 14, 2010, 06:18:05 AM
These new Kaleidoscopic IFS Frcatals are really great.  A lot of potential to play with.
Here is a quick sample movie of the full octohedral folding going from 0 to 6.3 degrees on the Y axis (only on the first rotation before the folding, the second rotation is 0,0,0).

http://www.youtube.com/watch?v=DNoXnu8UwXM (http://www.youtube.com/watch?v=DNoXnu8UwXM)

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: KRAFTWERK on May 14, 2010, 10:54:24 AM
Oh.. That folding can be this beautiful...

This rendering beats any origami I ever have seen...  O0

4D origami  :D

Thank you for that movie Softology!

I hav not seen many animations of transitions like this of the mandelbox...


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 14, 2010, 12:17:12 PM
That's one of the best IFS animations I've seen so far!
It seems like slowly the borders between different kinds of fractals vanish...
Maybe, a formula can be found, that basically can create any fractal, done so far, without being too complex?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 14, 2010, 07:12:27 PM
Take three reflection planes in a dodecahedron, one through an edge, one through a diagonal of one of the pentagonal sides and one perpendicular to the said edge. These form a triangle. Changing the scaling point inside that triangle gives, amongst others, the following shapes.
One of them is a soccer ball..the first ever fractal one!


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 14, 2010, 07:42:54 PM
yay, a soccer ball :D

give those darn soccer players that ball. It's so pretty, they'll stop spamming TV  ;D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Tglad on May 14, 2010, 09:35:57 PM
This topic is really awesome and I personally think these fractals are the most significant 3d ones that have been discovered here on fractal forums... and I suspect they will become common place examples of 3d fractals, not least because they generalise known ones (menger sponge, sierpinski tetrahedron) without loosing their properties such as being simple, continuous mapping, connected (in most cases) and most importantly, conformal.

You could say that these are julia sets of the type of fractal described here http://www.fractalforums.com/3d-fractal-generation/continuous-conformal-mandelbrots/ (http://www.fractalforums.com/3d-fractal-generation/continuous-conformal-mandelbrots/).
However, after making that thread I discovered that it is impossible to do the +C part to these fractals and keep the result conformal. So adding +C to the above fractals may add more variety, but will add some stretch too. For this reason it seems to me better to view these Julias directly, as this thread is doing, since the Mandelbrot version (with the +C) is in some sense invalid in 3d so long as the fractal involves any rotation.

The folding operation has to be done sequentially, so I am surprised that the resulting fractals (eg the icosahedron) still keep the same symmetries, does the order of folding make a difference to the resulting shape?

The ball-fold (that the mandelbox performs) could be added into the mix as it is the final mobius transform to be added to the set used in this thread (which is reflection, rotation, translation and scale) while keeping the mapping continuous. The unique thing about adding this operation is that it gives spherical geometries, compared to planar ones from the other operations.

Wonderful fractals, am I correct in saying that what makes these different from normal IFS fractals is that they are linear time (you aren't doubling the tests each iteration) so the fractal is tractable and deep zooms are achievable.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 14, 2010, 11:24:13 PM
Take three reflection planes in a dodecahedron, one through an edge, one through a diagonal of one of the pentagonal sides and one perpendicular to the said edge. These form a triangle. Changing the scaling point inside that triangle gives, amongst others, the following shapes.
One of them is a soccer ball..the first ever fractal one!
;D
Looks definetly that 3 planes are sufficient to obtain platonic and regular-polyhedron-sierpinski :). The triangle you described is called the fundamental triangle and the symmetries defined by the planes defined by the edges of that triangle and the origin are in fact the generator set of the group of symmetries of dodecahedron (see Coxeter groups (http://en.wikipedia.org/wiki/Coxeter_group) and Wythoff caleidoscopic construction (http://en.wikipedia.org/wiki/Wythoff_construction)). It should be the same for tetrahedra and octahedra.
When you apply rotations, the resulting fractals will be different depending on the set of symmetry planes used even if they belong to the same symmetry group.

yay, a soccer ball :D

give those darn soccer players that ball. It's so pretty, they'll stop spamming TV  ;D
;D

Here is a quick sample movie of the full octohedral folding going from 0 to 6.3 degrees on the Y axis (only on the first rotation before the folding, the second rotation is 0,0,0).
Your videos are awesome just like the trees picture. Thank you (because I'm not able patient enought to do that myself ;D)

You could say that these are julia sets of the type of fractal described here http://www.fractalforums.com/3d-fractal-generation/continuous-conformal-mandelbrots/ (http://www.fractalforums.com/3d-fractal-generation/continuous-conformal-mandelbrots/).
Yes thay are! They are just a subset of the whole class of fractals based on your ideas. Could we call it "continuous conformal Piecewise transformations fractals"? ^-^

However, after making that thread I discovered that it is impossible to do the +C part to these fractals and keep the result conformal. So adding +C to the above fractals may add more variety, but will add some stretch too. For this reason it seems to me better to view these Julias directly, as this thread is doing, since the Mandelbrot version (with the +C) is in some sense invalid in 3d so long as the fractal involves any rotation.
It's true that the "mandelbrot" versions of the "Kaleidocopic IFS" are featureless and not interresting at all.

The folding operation has to be done sequentially, so I am surprised that the resulting fractals (eg the icosahedron) still keep the same symmetries, does the order of folding make a difference to the resulting shape?
I'll try to do some tests but it seems that the answer is "no" in that particular case. You can obtain for example the same dodeca-sierpinski fractal by using different sets of symmetry planes. What surprises me most is that only 3 symmetries are sufficient according to Jos Leys results.

The ball-fold (that the mandelbox performs) could be added into the mix as it is the final mobius transform to be added to the set used in this thread (which is reflection, rotation, translation and scale) while keeping the mapping continuous. The unique thing about adding this operation is that it gives spherical geometries, compared to planar ones from the other operations.
I've tried ball-folds (which center is not necessarily [0,0,0]) in 2d and tested Buddhi's DE technique. everything works as a charm (well, sometimes it's necessary to scale down the estimated distance). No 3D for now though.

Wonderful fractals, am I correct in saying that what makes these different from normal IFS fractals is that they are linear time (you aren't doubling the tests each iteration) so the fractal is tractable and deep zooms are achievable.
Yes! that's what make them so interresting, but they are not really IFS fractals (in general). There are DE technique For IFS that are not exponential in time (see this article (http://www.inf.uni-konstanz.de/cgip/bib/files/HePrSa91.pdf)). David Makin have also developped a technique similar to one that is described in that article.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Tglad on May 15, 2010, 02:59:11 AM
One difference with the ball-fold is that it will make a multi-fractal rather than a simple fractal. So it would be clearer to put Kaleidoscopic+ball-fold into its own category.
I must say I like Kaleidoscopic as a name, and looking at Softology's videos it really does resemble a Kaleidoscope in how it changes form. Maybe 'Kaleido' for short, I just discovered it is Latin for beautiful shape! Which is accurate :)

I think this might be the most general formula:
Code:
for each I
 float length = dot(point, Direction[I])
 if (length > Distance[I])
   point -= 2*Direction[I]*(length-Distance[I])  // fold
end
point.rotate(AngleVector)
point += Offset
point *= Scale

for any set of Directions, Distances and for any AngleVector, Offset and Scale>1. I don't think it can be made simpler and any rearrangement can be put into the above form I think.

I wonder whether it is possible to generate the (smooth) platonic solids with this method... so a sierpinski tetrahedron can from from a regular tetrahedron just like a Koch curve can form from a straight line.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 15, 2010, 04:39:02 PM
For the Kaleidoscopic IFS, the transforms are linear or piecewise linear; and conformal or anti-conformal. The fixed point of those transforms, beside the stretching, is [0,0,0]. The fixed point of the stretching transform is defined by [Cx,Cy,Cz]. According to this definition, the menger sponge family is not, strictly speaking, a keleidoscopic IFS.
The most general formula would be:
Code:
point.rotate(AngleVector[k1])
for each I
  point.rotate(AngleVector[i1])
  float length = dot(point, Direction[I])
  if (length > Distance[I])
    point -= 2*Direction[I]*(length-Distance[I])  // fold
  point.rotate(AngleVector[i2])
end
point.rotate(AngleVector[k2])
point += Offset
point *= Scale
if rotatei1 is the inverse of rotatei2, the rotation can be embeded into Directioni instead. i.e. if fold(direction,x) is the folding transform we have:
rotation-1(fold(direction,rotation(x)))==fold(rotation-1(direction),x). In the general case, it can't be simplifyed this way. (or maybe i'm wrong)

By composing the rotations, the above algorithm could be simplifyed to:
Code:
point.rotate(AngleVector0)
for each I
  float length = dot(point, Direction[I])
  if (length > Distance[I])
    point -= 2*Direction[I]*(length-Distance[I])  // fold
  point.rotate(AngleVector[i])
end
point += Offset
point *= Scale

In the "origami IFS", the origin [0,0,0] desn't need to be a fixed point of the foldings and the rotations. It's equivalent to introducing translations in the algorithm.

There are also different types of foldings that can't be obtained by composing simple foldings. one example is the box folding.
Adding sphere foldings, gives the most general set of this kind of fractals. The sphere folding center may be arbitrary. Moreover, it could have 3 centers instead of one if I'm not getting it wrong.

I don't know exactly what multi-fractal means, but if it imply that the fractal dimension depends on position and scale, I think that the Kaleidoscopic IFS are in general multifractal.

It's possible to generate the platonic solids (+ regular and semi-regular solids) with this metod. For example the tetrahedra, octa and dodeca-sierpinski becomes smooth for 1<scale<=1.5.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Tglad on May 15, 2010, 11:11:08 PM
I think you can simplify the folding down to the code I wrote, rotating the point for after each fold should be equivalent to having each subsequent direction vector rotated, and a total rotation at the end. The rotations should also compose down into just 1 rotation.

Good point about the box fold, I suppose unusual folding could fall into a larger category which would need to be individually coded as there are probably loads of types of combined folds.

Multi-fractal means it doesn't have a single fractal dimension, this happens if the scale factor varies with location. ball-fold scales the space more near the minRadius than at the fixed radius, so such fractals can't be given an exact fractal dimension.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 16, 2010, 04:18:26 AM
Yes! that's what make them so interresting, but they are not really IFS fractals (in general). There are DE technique For IFS that are not exponential in time (see this article (http://www.inf.uni-konstanz.de/cgip/bib/files/HePrSa91.pdf)). David Makin have also developped a technique similar to one that is described in that article.

Just skimmed that article and would just like to add a comment - to get the probabilities and fractal dimension for an affine system then the correct method is to solve:

    log(p0)/log(s0) = log(p1)/log(s1) = ........... = log(pn)/log(sn) = fractal dimension

Where p0 to pn are the probabilities for transforms 0 to n and s0 to sn are the scales.
Obviously it assumes you know the scales - either calculated or estimated.

For example for an IFS where all the scales are the same (such as the Menger Sponge) then you can calculate the probability anyway and the dimension reduces to:

   log(p)/log(s)

In the case of the Menger Sponge the probability is 1/20 and the scale is 1/3 giving dimension = log(1/20)/log(1/3) i.e. 2.7268330278608420413960946363642 :)

The above method comes from:

"A Multifractal Analysis of IFSP Invariant Measures With Application to Fractal Image Generation"
by J.M. Gutierrez and A. Iglesias and M.A. Rodrıguez

I don't have the source for the above except that it used to be available on the internet as "fractals96.pdf" :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 16, 2010, 03:02:31 PM
Yes! that's what make them so interresting, but they are not really IFS fractals (in general). There are DE technique For IFS that are not exponential in time (see this article (http://www.inf.uni-konstanz.de/cgip/bib/files/HePrSa91.pdf)). David Makin have also developped a technique similar to one that is described in that article.

Just skimmed that article and would just like to add a comment - to get the probabilities and fractal dimension for an affine system then the correct method is to solve:

    log(p0)/log(s0) = log(p1)/log(s1) = ........... = log(pn)/log(sn) = fractal dimension

Where p0 to pn are the probabilities for transforms 0 to n and s0 to sn are the scales.
Obviously it assumes you know the scales - either calculated or estimated.

For example for an IFS where all the scales are the same (such as the Menger Sponge) then you can calculate the probability anyway and the dimension reduces to:

   log(p)/log(s)

In the case of the Menger Sponge the probability is 1/20 and the scale is 1/3 giving dimension = log(1/20)/log(1/3) i.e. 2.7268330278608420413960946363642 :)

The above method comes from:

"A Multifractal Analysis of IFSP Invariant Measures With Application to Fractal Image Generation"
by J.M. Gutierrez and A. Iglesias and M.A. Rodrıguez

I don't have the source for the above except that it used to be available on the internet as "fractals96.pdf" :)


Just to add that the above is directly analagous to the measure theory version of fractal dimension i.e. log(new length)/log(old length) i.e. the probability is analagous to new length and the scale to old length.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Buddhi on May 16, 2010, 06:03:41 PM
I have just done first steps with IFS formula. I used formula proposed by tglad and knighty. I like this formula because is very easy for parametrisation (will be easy to render morph animation). My final (little simplified) version of formula is:

Code:
point = mRotation.RotateVector(point);
for(int i=0; i<IFSfoldingCount; i++)
{
   length = point.Dot(IFSDirection[i]);
   if(length > IFSDistance[i])
   {
point -= IFSDirection[i]*2.0*(length - IFSDistance[i]);
   }
}
point += IFSOffset;
z *= scale;

My first image was rendered with following parameters

Symmetry vectors:
direction 1 = {1.0, 0, 0}
direction 2 = {0.5, -0.5, -0.707}
direction 3 = {0.5, 0.5, -0,707}
distance1 = distance2 = distance3 = 1
scale = 2;
offset = {0,0,0}

(http://www.fractalforums.com/gallery/2/640_16_05_10_5_54_05.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Buddhi on May 16, 2010, 08:39:35 PM
This is the most amazing formula I have ever seen!!! I gives almost unlimited possibilities. Thank you for share this.

My latest render:
Symmetry vectors:
s1 = {1.0, 0, -0,5}
s2 = {0, 1/sqrt(3), 1/3}
s3 = {0, 1/sqrt(3), -1/3}
s4 = {-1.0,0,-0.5}
scale = 2;
offset = {0,0,0}
distance1 = distance2 = distance3 = distance4 = 1

(http://www.fractalforums.com/gallery/2/640_16_05_10_8_34_57.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 16, 2010, 11:12:41 PM
Nice renderings :). Rotating the folding planes and adding the last rotation will give you much more variety.

I think you can simplify the folding down to the code I wrote, rotating the point for after each fold should be equivalent to having each subsequent direction vector rotated, and a total rotation at the end. The rotations should also compose down into just 1 rotation.
I realize now that you were right. This is good news because the simplified algorithm is faster.

Take three reflection planes in a dodecahedron, one through an edge, one through a diagonal of one of the pentagonal sides and one perpendicular to the said edge. These form a triangle. Changing the scaling point inside that triangle gives, amongst others, the following shapes.
One of them is a soccer ball..the first ever fractal one!
;D
Looks definetly that 3 planes are sufficient to obtain platonic and regular-polyhedron-sierpinski :). The triangle you described is called the fundamental triangle and the symmetries defined by the planes defined by the edges of that triangle and the origin are in fact the generator set of the group of symmetries of dodecahedron (see Coxeter groups (http://en.wikipedia.org/wiki/Coxeter_group) and Wythoff caleidoscopic construction (http://en.wikipedia.org/wiki/Wythoff_construction)). It should be the same for tetrahedra and octahedra.
Good new! I was wrong ;D. Using the plans defined by the fundamental triangle will give close but different (and interresting) results. Here is the dodeca "siepinski" I obtained:
(http://www.fractalforums.com/gallery/2/932_16_05_10_10_33_27_2.jpeg)

But I had to do 4 pre folds.(the same iteration but without the stretch).

Here is what I obtained with 0,1,2 and 3 pre folds:
(http://www.fractalforums.com/gallery/2/932_16_05_10_10_33_27_1.jpeg)

I've also tried using only one folding. Here are the results:
(http://www.fractalforums.com/gallery/2/932_16_05_10_10_33_27_3.jpeg)
(http://www.fractalforums.com/gallery/2/932_16_05_10_10_36_46_0.jpeg)
(http://www.fractalforums.com/gallery/2/932_16_05_10_10_33_27_4.jpeg)
In case you are interrested (and have a powerful PC) here are the evaldraw (http://advsys.net/ken/download.htm) scripts I used for those pictures: Kaleidoscopic IFS experiments (http://code.google.com/p/implicit/downloads/detail?name=Kaleidoscopic-IFS-experiments.zip&can=2&q=).(use 1/4 resolution for near realtime exploration :))


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 16, 2010, 11:16:49 PM
picture obtained using non uniform scaling:
(http://www.fractalforums.com/gallery/2/932_16_05_10_10_33_27_0.jpeg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Hamilton on May 16, 2010, 11:42:37 PM
Well, I can say that this is one of the most interesting thread about IFS fractals I've ever read so far...
Thanks again for sharing this, guys!


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 17, 2010, 12:13:45 AM
Knighty, what you have there in that first image is the icosa sierp, not the dodeca.
..and I think there is something wrong with your code, as one should not be able to see the background through it...
Here us what I get (scale=2)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 17, 2010, 01:15:00 AM
those results are amazing!
So you now directly extended any generic 2D IFS to any generic 3D IFS!

Well, any not-tree-like IFS, I guess.... What's about branches like in L-systems? Could they be extended and added in a similar fashion?

Maybe a tree with actual thickness could be figured out by using non-uniform scales like the one spiky fractal?
And then blend that with a Mandelbulb to get it to have fruits :D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: cbuchner1 on May 17, 2010, 01:39:44 AM
those results are amazing!
So you now directly extended any generic 2D IFS to any generic 3D IFS!

I agree, this is wonderful. With all the discoveries made during the last 6 months or so (Mandelbulb, Mandelbox, Kaleidoscopic IFS) there is certainly enough material to fill an entire book about the science and the beauty of 3D fractals. What I am desperately missing is some reference material collecting all the formulas in one place. There exists a nice thread summarizing the formulas for different varieties of Mandelbulbs, but I haven't found anything similar for the new varieties of 3D fractals yet.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Tglad on May 17, 2010, 02:35:34 AM
Excuse the low res pics, this is a quick variation I tried out, fractal rocks
Code:
Vector dir = randomDirectionVector()
float dot = point.dot(dir)
float dist = randomFloat0to1()
if (dot > dist)
 point -= 2*dir*(dot-dist)
elseif (dot < -dist)
 point -= 2*dir*(dot+dist)
point *= 1.15


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 17, 2010, 06:16:01 AM
I have been running a brute force search across all combinations of the prefold and postfold rotation angles to see if anything unique or interesting popped out.  Here are a few samples.  All of these use the "octo sierpinski" folding with rotations done around the origin and [1,0,0] as the center of stretch.

(http://farm4.static.flickr.com/3597/4612644839_87a435400c_o.jpg)

(http://farm5.static.flickr.com/4030/4612921299_22763da876_o.jpg)

(http://farm4.static.flickr.com/3374/4613956354_3036745209_o.jpg)

(http://farm4.static.flickr.com/3361/4614036202_71992066f1_o.jpg)

(http://farm4.static.flickr.com/3352/4613450659_b77604159b_o.jpg)

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: cbuchner1 on May 17, 2010, 09:32:02 AM

Stop copying nature ;)  Chances are it's patented already by Monsanto.  Humor aside, these are most excellent pics!


Title: Re: Kaleidoscopic (escape time) IFS
Post by: KRAFTWERK on May 17, 2010, 09:40:54 AM
WOW!  O0 O0 O0 O0

Stunning images!


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 17, 2010, 03:07:09 PM
Knighty, what you have there in that first image is the icosa sierp, not the dodeca.
Oops! sorry, I've always been confused on this :)

..and I think there is something wrong with your code, as one should not be able to see the background through it...
Here us what I get (scale=2)
I've checked everything and couldn't spot any error. Here is the code I used (the folding planes are not the same as yours BTW):
Code:
#define _PHI_ (0.5*(1+sqrt(5)))
static stc[3]={_PHI_,1,0};
#define IN3 (1/sqrt(14+6*sqrt(5)))
static n3[3]={IN3*_PHI_,-IN3*(_PHI_^2),-IN3*(2*_PHI_+1)};

fractal(x,y,z,scale){
   
   for(i=0;i<4;i++){//Pre-fold
      y=abs(y);
      z=abs(z);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
   }
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){//actual iterations
      y=abs(y);
      z=abs(z);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
     
      x=scale*x-stc[0]*(scale-1);
      y=scale*y-stc[1]*(scale-1);
      z=scale*z-stc[2]*(scale-1);
     
      r=x*x+y*y+z*z;
   }
   (sqrt(x*x+y*y+z*z)-2)*scale^(-i)
}

What's about branches like in L-systems? Could they be extended and added in a similar fashion?
Well... I think so, because :dink::
Excuse the low res pics, this is a quick variation I tried out, fractal rocks
Code:
Vector dir = randomDirectionVector()
float dot = point.dot(dir)
float dist = randomFloat0to1()
if (dot > dist)
 point -= 2*dir*(dot-dist)
elseif (dot < -dist)
 point -= 2*dir*(dot+dist)
point *= 1.15


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 17, 2010, 05:30:27 PM
Knighty, looks to me like your rays are missing the back part of the object as they pass through the holes. Try putting in a condition that your distance estimate can never increase. In other words, keep track of the DE as you step on the ray and if the DE is larger than a previous value on that ray, take the smaller value..


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 17, 2010, 09:44:51 PM
I have checked the estimated distance field (in 2d slices). There are no over estimation of the distances. It turns out that that is the result of the folding planes set used in this case: the icosahedra is hollow  :). I have tried with dodeca and tetra. With octahedra, i need two pre-folds but it stays hollow. For the tetrahedra, one prefold is sufficient and gives the regular tetra-sierpinski.
I think this "phenomenon" is due to the fact that the solid angle between the fundamental triangle and the origin is too small. while transformed, Interior points get outside too quickly. Anyway, I like it this way: more possibilities!
Could you give the set of folding planes and center of stretch you have used?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Jesse on May 17, 2010, 10:57:10 PM
Just got the animation feature working with the extended parameters and made a little sierpinski morph.
More randomly choosen parameters, but some spots are ok i think:

http://vimeo.com/11816563 (http://vimeo.com/11816563)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 17, 2010, 11:10:00 PM
Just got the animation feature working with the extended parameters and made a little sierpinski morph.
Very interesting. I love the lighting and shading you achieve with your renders. Do you have two light sources with proper ambient occlusion?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Hamilton on May 17, 2010, 11:24:06 PM
Just got the animation feature working with the extended parameters and made a little sierpinski morph.

Wow, this sequence is simply stunning!
Just love those "living" forms, especially the part from 01:02 to 01:30...


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 17, 2010, 11:26:14 PM
Quote
Could you give the set of folding planes and center of stretch you have used?
Normals for the three planes:
No[0,0]= -phi, No[0,1]= phi-1, No[0,2]=1
No[1,0]= 1,     No[1,1]=-phi,   No[1,2]=phi+1
No[2,0]= 0,     No[2,1]= 0,      No[2,2]=-1

Center that generates the icosa : P[0,0]=0.850650808,P[0,1]=0.525731112,P[0,2]=0


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Jesse on May 18, 2010, 12:42:41 AM
Very interesting. I love the lighting and shading you achieve with your renders. Do you have two light sources with proper ambient occlusion?

Just a fake AO based on z-buffer and phong shading with up to 4 lights in infinity positions, so i only need 2 angles for them.
Have some improvements in mind to get a better AO that takes care of the background and object colors.

Just love those "living" forms, especially the part from 01:02 to 01:30...

Is also my favorite part  :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: KRAFTWERK on May 18, 2010, 08:40:20 AM
Totally alien  :alien:

I am so glad I found this forum, a new world almost every day...

Thanks!  O0


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 18, 2010, 12:54:33 PM
Knighty, I think the reason your icosa looks the way it does, is because you apply your pre-rotations outside the DE-loop (the left image). If you put the rotations inside the loop (the right image), it seems quite solid.

(http://farm5.static.flickr.com/4013/4618492024_db5be7c4ca_o.png)

Of course this slows down the rendering since you have to apply the reflections five times each iteration.

I use the x,y,z (abs) reflection to speed up the calculation a bit:

while (n < maxIterations) {
    p = abs(p); // saves us three repetitions
    if (dot(p, n1)>0) { p *= n1Mat; } // rep 1
    if (dot(p, n2)>0) { p *= n2Mat; }
    if (dot(p, n3)>0) { p *= n3Mat; }
    if (dot(p, n1)>0) { p *= n1Mat; } // rep 2
    if (dot(p, n2)>0) { p *= n2Mat; }
    if (dot(p, n3)>0) { p *= n3Mat; }
    p = p*scale - offset*(scale-1.0);
       
    if (dot(p, p) > bailoutSquared) break;
    n++;
}

Does anyone know of a faster way to reduce the number of reflections? Perhaps it is possible to transform to a new coordinate system, where the normals are perpendicular and axis-oriented, and use the fast 'abs' operator, before transforming back?

And, btw, thanks for a very interesting thread. These systems are truly fascinating.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 18, 2010, 04:49:35 PM
Those images and that animation are just great!  :D
Be careful that you're not sued for illegally copying nature's ideas, though :tease:


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 19, 2010, 10:40:47 PM
Hi, just wanted to share some images created with the hollow (pre-rotated) Icosahedron variant.

(http://farm5.static.flickr.com/4037/4621983786_858f4ff425_b.jpg) (http://www.flickr.com/photos/syntopia/4621983786/sizes/l/)

(http://farm4.static.flickr.com/3334/4621977652_65299280a9_b.jpg) (http://www.flickr.com/photos/syntopia/4621977652/sizes/l/)

(http://farm5.static.flickr.com/4049/4621973610_53901e66d6_b.jpg)
 (http://www.flickr.com/photos/syntopia/4621973610/sizes/l/)

(All rendered on a GPU using Subblue's Pixel Bender raytracer)

Best, Mikael.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 19, 2010, 10:58:24 PM
Great anim jessy!  :worm:  :thumbsup1:

Jos Leys: I'm getting almost exactly the same effect. Perhaps you are applying it 3 to 5 (?) times inside the loop as suggested by Syntopia. Are you? :)

BTW, Welcome Syntopia! :)
Actually, I was wondering if three folds only were suficient to get the icosa and or dodeca. Otherwise, what's the minimal number of folds necssary to get the icosa (p=abs(p) counts 3  :evil1:).
Also, I like the hollow icosa (I see that you like it too... great renderings ;)). I can fly through! While playing with the foldings I've found one that is made of 20 sierpinski triangles:
Code:
fractal(x,y,z,scale,rot[3][3]){
   
   for(i=0;i<5;i++){//5 pre-folds
      y=abs(y);
      z=abs(z);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
   }
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
#ifdef PRE_ROTATE
      x1=rot[0][0]*x+rot[1][0]*y+rot[2][0]*z;
      y1=rot[0][1]*x+rot[1][1]*y+rot[2][1]*z;
      z1=rot[0][2]*x+rot[1][2]*y+rot[2][2]*z;
      x=x1;y=y1;z=z1;
#endif
      y=abs(y);
      //z=abs(z);//I've removed this
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
     
      x=scale*x-stc[0]*(scale-1);
      y=scale*y-stc[1]*(scale-1);
      z=scale*z-stc[2]*(scale-1);
     
      r=x*x+y*y+z*z;
   }
   (sqrt(x*x+y*y+z*z)-2)*scale^(-i)
}
Here is what I get without the rotation:
(http://www.fractalforums.com/gallery/2/932_19_05_10_9_59_50_0.jpeg)
And with the rotation (and different offset):
(http://www.fractalforums.com/gallery/2/932_19_05_10_9_59_50_1.jpeg)
(http://www.fractalforums.com/gallery/2/932_19_05_10_9_59_50_2.jpeg)

Now another variant:
Code:
fractal(x,y,z,scale,rot[3][3]){
   
   for(i=0;i<5;i++){//5 pre-folds
      y=abs(y);
      z=abs(z);x=abs(x);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
       
   }
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
#ifdef PRE_ROTATE
      x1=rot[0][0]*x+rot[1][0]*y+rot[2][0]*z;
      y1=rot[0][1]*x+rot[1][1]*y+rot[2][1]*z;
      z1=rot[0][2]*x+rot[1][2]*y+rot[2][2]*z;
      x=x1;y=y1;z=z1;
#endif
      y=abs(y);
      z=abs(z);x=abs(x);//added another fold
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t>0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}//changed the condition (t>0) instead of (t<0)
     
      x=scale*x-stc[0]*(scale-1);
      y=scale*y-stc[1]*(scale-1);
      z=scale*z-stc[2]*(scale-1);
     
      r=x*x+y*y+z*z;
   }
   (sqrt(x*x+y*y+z*z)-2)*scale^(-i)
}
Without rotations it gives 6 lines but applying rotation and changing the offset:
(http://www.fractalforums.com/gallery/2/932_19_05_10_9_59_50_3.jpeg)

Does anyone know of a faster way to reduce the number of reflections? Perhaps it is possible to transform to a new coordinate system, where the normals are perpendicular and axis-oriented, and use the fast 'abs' operator, before transforming back?
Yes, you can! but I think it's not always faster. In the case of tetrahedra, octahedra-cube it's quite easy to find (45° rotations) and should give some speed up (haven't tried so can't be sure). In the case of icosahedra-dodecahedra it's more tricky (it's difficlult to see without a good CAD software ;))


Title: Re: Kaleidoscopic (escape time) IFS
Post by: JosLeys on May 19, 2010, 11:11:54 PM
Here is what I find:
The tetra, the octa and the cube need 3 folds.
The dodeca and the icosa need 5 folds.
So the sequence is : fold around the three symmetry planes n times, scale from fixed point, fold n times, scale...etc.

BTW, the treshold scale value above which the polyhedron is not smooth anymore is :
1.5 for the tetra, dodeca and icosa
2.0 for the cube
1+phi/2 (about 1.8..) for the dodeca.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 19, 2010, 11:22:55 PM
Thank you very much! :) At some moment I was  :headbatting:  ;D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 20, 2010, 01:39:17 AM
Can anyone assist with the icos and dodec folding code?  I cannot follow the snippets so far.
I am using Knighty's method for folding like this for the full octahedral.  What should the folding code look like in this sort of format for icosa and dodeca?

Code:
      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}

Here is another sample movie.  Must be seen in full HD for all the finer details.

http://www.youtube.com/watch?v=XxfoPq_eKAE (http://www.youtube.com/watch?v=XxfoPq_eKAE)

The pre-rotate technique is great too.  Opens up another layer of parameter space to search.

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 20, 2010, 12:00:44 PM
Softology: I love how this one turns inside out and is nearly 2D in between :D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 20, 2010, 02:50:39 PM
Knighty, the number of reflections depend on the chosen symmetry planes and the order they are applied in. Using the set given by Jos Leys I had to repeat five times, for a total of 15 reflections, before scaling.

I've optimized it a bit by including the x,y,z planes for the following 6 reflections:

Code:
 		
int n = 0;
while (n < maxIterations) {
   p.y = abs(p.y);
   p.z = abs(p.z);
   if (dot(p, n2)>0.0) { p *= n2Mat; }
   p.x = abs(p.x);
   p.z = abs(p.z);
   if (dot(p, n1)>0.0) { p *= n1Mat; }       
   p = p*scale - offset*(scale-1.0);
   if (dot(p,p)> bailoutSquared) break;
   n++;
}
return (length(p) ) * pow(scale, -float(n));
      

And I think better solutions exist. Jos, when you said the icosa needed five folds, did you mean 5*3 reflections or just 5 reflections in total?

And Softology, you asked for code. I think you can use the DE above together with these definitions:

Code:
phi = 1.61803399; // golden ratio.
scale = 2.0;
offset = normalize(float3(1.0,phi-1.0,0.0));
n1 = normalize(float3(-phi,phi-1.0,1.0));
n2 = normalize(float3(1.0,-phi,phi+1.0));
n1Mat = reflectionMatrix(n1);
n2Mat = reflectionMatrix(n2);
     
// Return reflection matrix for plane with normal 'n'
float3x3 reflectionMatrix(float3 n)
{
return float3x3( 1.0 - 2.0*n.x*n.x,     - 2.0*n.y*n.x ,     - 2.0*n.z*n.x,
      - 2.0*n.x*n.y, 1.0 - 2.0*n.y*n.y ,     - 2.0*n.z*n.y,
      - 2.0*n.x*n.z,     - 2.0*n.y*n.z , 1.0 - 2.0*n.z*n.z );
}


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 20, 2010, 09:55:30 PM
Knighty, the number of reflections depend on the chosen symmetry planes and the order they are applied in. Using the set given by Jos Leys I had to repeat five times, for a total of 15 reflections, before scaling.
Yes it depends on the symmetry set choosen. If I'm not mistaken, 15 is the total number of symmetry planes of the dodeca and icosa. If you want only the icosa, 5 folds are sufficient. Same thing with the dodeca. The set that gives dodeca that way, is not the same for icosa. I've already found a "full" folding planes set for dodeca, icosa and the semi regular polyhedra that are in between. The number of folds was 9 but I think that it is possible with 8 folds.

I've optimized it a bit by including the x,y,z planes for the following 6 reflections:

Code:
 		
int n = 0;
while (n < maxIterations) {
   p.y = abs(p.y);
   p.z = abs(p.z);
   if (dot(p, n2)>0.0) { p *= n2Mat; }
   p.x = abs(p.x);
   p.z = abs(p.z);
   if (dot(p, n1)>0.0) { p *= n1Mat; }       
   p = p*scale - offset*(scale-1.0);
   if (dot(p,p)> bailoutSquared) break;
   n++;
}
return (length(p) ) * pow(scale, -float(n));
      
Whi do you use a symmetry matrix? Why not:
Code:
      float t=dot(p,n);
      if (t>0.0) p-=2.0*t*n;
Which gives the same result and is, in principle, faster. :)

B.T.W, You are getting very nice results.

Can anyone assist with the icos and dodec folding code?  I cannot follow the snippets so far.
Jason.
Here is another variant that gives the "full" symmetry:
Code:
#define PHI (0.5*(1+sqrt(5))) // Phi is the golden ratio

The three points that are the vertices of a fundamental triangle.
static ftris[3]={PHI,1,0};// vertex
static ftria[3]={PHI,0,0};// middle of edge
static ftric[3]={1/3*(1+2*PHI),0,PHI/3};//center of an icosa triangle.

#define IN3 (1/sqrt(14+6*sqrt(5))) //This is the normalisation factor of the following vector
static n3[3]={IN3*PHI,-IN3*(PHI^2),-IN3*(2*PHI+1)};//this is the normal of one of the folding planes.
// The 2 others planes' normals are: {0,1,0} and {0,0,1}

//
fractal(x,y,z,scale,rot[3][3]){
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
// PRE_ROTATE
      x1=rot[0][0]*x+rot[1][0]*y+rot[2][0]*z;
      y1=rot[0][1]*x+rot[1][1]*y+rot[2][1]*z;
      z1=rot[0][2]*x+rot[1][2]*y+rot[2][2]*z;
      x=x1;y=y1;z=z1;

// Foldings. 10 in total but 7 of them are abs() ;o)
      x=abs(x);
      y=abs(y);
      z=abs(z);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
      y=abs(y);
      z=abs(z);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
      y=abs(y);
      z=abs(z);
      t=x*n3[0]+y*n3[1]+z*n3[2];
      if(t<0){x-=2*t*n3[0];y-=2*t*n3[1];z-=2*t*n3[2];}
     
// Stretching:
// for an icosahedron: stc[]=ftris[];
// for a dodecahedron: stc[]=ftric[];
// In general you can choose: stc[]=a*ftris[]+b*ftria[]+c*ftric[]; where: a+b+c=1;
      x=scale*x-stc[0]*(scale-1);
      y=scale*y-stc[1]*(scale-1);
      z=scale*z-stc[2]*(scale-1);
     
      r=x*x+y*y+z*z;
   }
   return (sqrt(x*x+y*y+z*z)-2)*(scale)^(-i);
}

Note the:
    if (t<0)...
Syntopia and Jos Leys are doing:
    if (t>0)...
This is because of the direction of the planes we are using! Perhaps that's why you were confused. (I was at some point :))


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 20, 2010, 11:08:10 PM
Yes it depends on the symmetry set choosen. If I'm not mistaken, 15 is the total number of symmetry planes of the dodeca and icosa. If you want only the icosa, 5 folds are sufficient. Same thing with the dodeca. The set that gives dodeca that way, is not the same for icosa. I've already found a "full" folding planes set for dodeca, icosa and the semi regular polyhedra that are in between. The number of folds was 9 but I think that it is possible with 8 folds.

I guess I'm a bit confused about what exactly count as a 'fold'. Do you mean you need only apply 5 conditional reflections before the scaling? Because I've only found (different) solutions with 6 conditional reflections for the icosa and dodeca.

Whi do you use a symmetry matrix? Why not:
Code:
      float t=dot(p,n);
      if (t>0.0) p-=2.0*t*n;
Which gives the same result and is, in principle, faster. :)

Well, both for readability, and because I assumed that matrix multiplications would be faster on the GPU. I just tested it, and I was wrong though: I get 22.8 fps (matrix) versus 23.4 fps (vector).  :)

Best, Mikael.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 20, 2010, 11:27:33 PM
Yes it depends on the symmetry set choosen. If I'm not mistaken, 15 is the total number of symmetry planes of the dodeca and icosa. If you want only the icosa, 5 folds are sufficient. Same thing with the dodeca. The set that gives dodeca that way, is not the same for icosa. I've already found a "full" folding planes set for dodeca, icosa and the semi regular polyhedra that are in between. The number of folds was 9 but I think that it is possible with 8 folds.

I guess I'm a bit confused about what exactly count as a 'fold'. Do you mean you need only apply 5 conditional reflections before the scaling? Because I've only found (different) solutions with 6 conditional reflections for the icosa and dodeca.

Yes, by "fold", I mean "conditional reflexion".
Sorry! that was 6 for me too. According to Jos Leys 5 are sufficient if I undestood well.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 21, 2010, 02:15:10 AM
Thanks for the code snippets guys.  That cleared everything up and I now have icosahedral and dodecahedral folding working.

Jason

(http://farm4.static.flickr.com/3409/4625111805_e5a7a8c2ce_o.jpg)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 21, 2010, 11:58:24 AM
also a really nice one :D

I wonder what happens with aribitary symmetry planes... Maybe something along the lines of a starfish or even a more complex biological lifeform could be recreated?
We already have a lot of (gorgeous) sponges. :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 21, 2010, 07:37:47 PM
Yes it depends on the symmetry set choosen. If I'm not mistaken, 15 is the total number of symmetry planes of the dodeca and icosa. If you want only the icosa, 5 folds are sufficient. Same thing with the dodeca. The set that gives dodeca that way, is not the same for icosa. I've already found a "full" folding planes set for dodeca, icosa and the semi regular polyhedra that are in between. The number of folds was 9 but I think that it is possible with 8 folds.

I guess I'm a bit confused about what exactly count as a 'fold'. Do you mean you need only apply 5 conditional reflections before the scaling? Because I've only found (different) solutions with 6 conditional reflections for the icosa and dodeca.
Yes, by "fold", I mean "conditional reflexion".
Sorry! that was 6 for me too. According to Jos Leys 5 are sufficient if I undestood well.

So far, Ive found a minimum of 5 folds for icosa and 6 folds for dodeca and 8 for full dodeca-icosa symmetry set. More infos after. :)

also a really nice one :D

I wonder what happens with aribitary symmetry planes... Maybe something along the lines of a starfish or even a more complex biological lifeform could be recreated?
We already have a lot of (gorgeous) sponges. :)

There are already some rederings by Buddhi in this thread and this woderful gallery (http://www.flickr.com/photos/syntopia/) by Syntopia. :banana:

Thanks for the code snippets guys.  That cleared everything up and I now have icosahedral and dodecahedral folding working.

Jason

(http://farm4.static.flickr.com/3409/4625111805_e5a7a8c2ce_o.jpg)

You'r welcome!  :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 22, 2010, 12:01:41 AM
Wow!
Thanks for sharing :)
I especially like #4 and #6 :D
#6 isn't actually that far away from a starfish, I guess :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 22, 2010, 12:20:42 AM
Thanks, Kram and Knighty - actually I made the images after reading your suggestion to tweak the planes.

And #6 was an attempt to model a starfish. Guess I did not fail completely :-)

So far, Ive found a minimum of 5 folds for icosa and 6 folds for dodeca and 8 for full dodeca-icosa symmetry set. More infos after. :)

Oh no, that means I've been sloppy.

There is really a lot of possibilities and parameters to explore here. And so many possible extensions: alternating sets of symmetries, stochastic conditionals, non-linear scaling and folds, softening the folds, ...


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Tglad on May 22, 2010, 01:44:09 AM
#4 is almost exactly the shape of hyperbolic space.

I wonder how many of these can be made with a single fold per iteration, after-all up to 3 folds can probably be made a repeated single fold and rotation.
That would give a very simple definition for such fractals-
They are the many valued vector
 v = o + q*abs(v)      for some quaternion q, offset o, and where abs just operates on the real axis if we imagine the vector as (r,i,j)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 22, 2010, 05:36:36 PM
So far, Ive found a minimum of 5 folds for icosa and 6 folds for dodeca and 8 for full dodeca-icosa symmetry set. More infos after. :)

Oh no, that means I've been sloppy.
You weren't but I was. ;)

Here are the 8 folding planes that fold the icosa to the fundamental triangle ( phi , 1 , 0 ) ; ( phi , 0 , 0 ) ; ( ( 2 * phi + 1 ) / 3 , 0 , phi / 3 ):
( 1 , 0 , 0 )
( 0 , 1 , 0 )
( 0 , 0 , 1 )
0.5 * ( phi , 1 - phi , -1 )
( phi , phi^2 , -( 1 + 2 * phi )) * 1 / sqrt( 14 + 6 * sqrt( 5 ))
0.5 * ( 1 , -phi , phi - 1 )
( phi , -phi^2 , -1 ) * 1 / sqrt( 6 + 2 * sqrt(5))
( phi , -phi^2, -( 1 + 2 * phi)) * 1 / sqrt( 14 + 6 * sqrt(5))

The five first planes give an icosahedron when the center of stretching is (phi,1,0).

There is really a lot of possibilities and parameters to explore here. And so many possible extensions: alternating sets of symmetries, stochastic conditionals, non-linear scaling and folds, softening the folds, ...
May I add L-system and finite state machine...


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 24, 2010, 03:50:40 PM
#4 is almost exactly the shape of hyperbolic space.

I wonder how many of these can be made with a single fold per iteration, after-all up to 3 folds can probably be made a repeated single fold and rotation.
That would give a very simple definition for such fractals-
They are the many valued vector
 v = o + q*abs(v)      for some quaternion q, offset o, and where abs just operates on the real axis if we imagine the vector as (r,i,j)
Wow! it took me a while to understand! :crazy:
I think it may be simplified further to:
v:= A * absx/y/z/xy/xz/yz/xyz(v);
Where A is an affine transformation and abs() acts on x,y,z,xy,xz,yz or xyz components.
'A' may be constructed this way:
A=R1*S*T*R2;
R: rotation matrix;
S: Homotety matrix;
T: Translation matrix;


Title: Re: Kaleidoscopic (escape time) IFS
Post by: subblue on May 24, 2010, 10:23:02 PM
Wow! it took me a while to understand! :crazy:
I think it may be simplified further to:
v:= A * absx/y/z/xy/xz/yz/xyz(v);
Where A is an affine transformation and abs() acts on x,y,z,xy,xz,yz or xyz components.
'A' may be constructed this way:
A=R1*S*T*R2;
R: rotation matrix;
S: Homotety matrix;
T: Translation matrix;
I can't say I understand this yet. Have you managed to code an implementation of this?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 24, 2010, 11:28:13 PM
Wow! it took me a while to understand! :crazy:
I think it may be simplified further to:
v:= A * absx/y/z/xy/xz/yz/xyz(v);
Where A is an affine transformation and abs() acts on x,y,z,xy,xz,yz or xyz components.
'A' may be constructed this way:
A=R1*S*T*R2;
R: rotation matrix;
S: Homotety matrix;
T: Translation matrix;
I can't say I understand this yet. Have you managed to code an implementation of this?

I would be interested in a snippet of code that covers this too if you work it out.  Looks like a great way to open up even more space for finding new fractals within.

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 25, 2010, 10:24:00 PM
It's just a simplification of the one fold family. Nothing new. I've implemented it and it works.  :)
Short answer:
The algorithm I already used was something like this (in vectorial form):
Code:
// v is the input point
i=0;
r=dot(v,v);
while (i<max_iterations && r<bailout_squared) do{
      rotate1(v);
      fold(v);
      rotate2(v);
      v=scale*v-(scale-1)*offset;
      r=dot(v,v);
      i=i+1;
}
distance=sqrt(r)/scale^i;
the first rotation have the side effect of rotating the whole fractal. so we can place it after the scaling but the fractal will not rotate anymore, which is a good thing ;D.
As Syntopia has noticed, a fold by an arbitrary plane is equivalent to an abs() operation in a different coordinates frame.
So we can do (+ some algebraic manipulations):

Code:
// v is the input point
i=0;
r=dot(v,v);
while (i<max_iterations && r<bailout_squared) do{
     
      v.z=abs(v.z);//for example
      rotate2(v);//rotation
      v=v-offset*(scale-1)/scale;//translation, ((scale-1)/scale) is here just in order to keep the size of the fractal "constant" while changing the scale.
      v=scale*v;//scale
      rotate1(v);//rotation
      r=dot(v,v);
      i=i+1;
}
distance=sqrt(r)/scale^i;
As you know, using homogeneous coordinates make it possible to express translation operation as a matrix. thus, the transformation in the above code can be written:
v=(v.x,v.y,abs(v.z));
v=R1*S*T*R2*v=A*v;

Of course, it's possible to apply the abs() operation to x or y or z or x and y...etc.

(See also this (http://www.fractalforums.com/index.php?topic=3158.msg17187#msg17187) post)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 25, 2010, 11:18:49 PM
As Syntopia has noticed, a fold by an arbitrary plane is equivalent to an abs() operation in a different coordinates frame.

Actually I tried, and couldn't get it to work.

What I wanted to do was to take the following (where n1,n2,n3 are not perpendicular):

Code:
 if (dot(p, n1)>0.0) { p *= n1Mat; }
 if (dot(p, n2)>0.0) { p *= n2Mat; }
 if (dot(p, n3)>0.0) { p *= n3Mat; }
 (repeated the necessary number of times)

And optimize it by using a coordinate system where n1,n2,n3 are axis-aligned:

Code:
 // The columns of the (skewed) transformation-matrix M should be the normals: n1,n2,n3
 p = M*abs(M_inverse*p);

But it did not work. Suggestions are welcome :-)



Title: Re: Kaleidoscopic (escape time) IFS
Post by: David Makin on May 25, 2010, 11:24:08 PM

As you know, using homogeneous coordinates make it possible to express translation operation as a matrix. thus, the transformation in the above code can be written:
v=(v.x,v.y,abs(v.z));
v=R1*S*T*R2*v=A*v;

Of course, it's possible to apply the abs() operation to x or y or z or x and y...etc.

(See also this (http://www.fractalforums.com/index.php?topic=3158.msg17187#msg17187) post)

So basically the single fold version is a single transform standard escape-time IFS with the addition of one or more abs() operators ?

And the multi-fold version is essentially standard escape-time LRIFS but again with the addition of abs() operators and restriction based on dot products ? (Language Restricted IFS, see http://www.fractalforums.com/programming/escape-time-lrifs/)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 26, 2010, 10:39:27 PM
Well, I don't know :sad1:. I'll try to dig the subject :).

As Syntopia has noticed, a fold by an arbitrary plane is equivalent to an abs() operation in a different coordinates frame.

Actually I tried, and couldn't get it to work.

What I wanted to do was to take the following (where n1,n2,n3 are not perpendicular):

Code:
 if (dot(p, n1)>0.0) { p *= n1Mat; }
 if (dot(p, n2)>0.0) { p *= n2Mat; }
 if (dot(p, n3)>0.0) { p *= n3Mat; }
 (repeated the necessary number of times)

And optimize it by using a coordinate system where n1,n2,n3 are axis-aligned:

Code:
 // The columns of the (skewed) transformation-matrix M should be the normals: n1,n2,n3
 p = M*abs(M_inverse*p);

But it did not work. Suggestions are welcome :-)
It works that way only if M is a combination of a rotation (+ eventually a symmetry) and a translation. This imply that the three planes have to be orthogonal to each other.
For a sigle fold it always works. That's what I was talking about.:)

___________________________________________
Here is another version of the menger Sponge (that makes it a true "Kaleidoscopic IFS"):
Code:
Menger3(x,y,z){
   r=x*x+y*y+z*z;
   for(i=0;i<MI && r<bailout;i++){
      rotate1(x,y,z);

      x=abs(x);y=abs(y);z=abs(z);
      if(x-y<0){x1=y;y=x;x=x1;}
      if(x-z<0){x1=z;z=x;x=x1;}
      if(y-z<0){y1=z;z=y;y=y1;}
     
      z-=0.5*CZ*(scale-1)/scale;
      z=-abs(-z);
      z+=0.5*CZ*(scale-1)/scale;

      rotate2(x,y,z);
   
      x=scale*x-CX*(scale-1);
      y=scale*y-CY*(scale-1);
      z=scale*z;
     
      r=x*x+y*y+z*z;
   }
   return sqrt(x*x+y*y+z*z)*scale^(-i);
}


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 28, 2010, 06:10:38 AM
It's just a simplification of the one fold family. Nothing new. I've implemented it and it works.  :)

OK, so the variations now come down to;

option to pre-rotate before main loop
for i=1 to maxiterations
    rotate1 (if not already set as a pre-rotate)
    fold (whichever fold method - tetra/cubic/icosa etc)
    rotate2
    stretch
    if radius>bailout then break
end

The rotatations can either be around the origin or around the stretch center.  I originally had the rotations around the strech center which was incorrect but it leads to other unique images so I left it in as an option.

Also for the stretching, it can be the usual
     z.x=scale*z.x-kcx*(scale-1)
     z.y=scale*z.y-kcy*(scale-1)
     z.z=scale*z.z-kcz*(scale-1)
kcx/y/z the center of stretch.  This can either be constrained to the unit sphere (normalised) or used as is.  I have an option for both.
Including the option to alternate the z stretch with
     z.z=scale*z.z
     if (z.z>0.5*kcz*(scale-1)) then z.z:=z.z-kcz*(scale-1)
also gives another method for new fractals

Does that cover all the variations so far?

Here are another 2 sample movies.  Both are created by only morphing/tweening the rotate1 and rotate2 values between frames.  Both really need to be watched in the full HD resolution to see the finer fractal details.

http://www.youtube.com/watch?v=eJI0PW6EQhI (http://www.youtube.com/watch?v=eJI0PW6EQhI)

http://www.youtube.com/watch?v=renxaQZfsdk (http://www.youtube.com/watch?v=renxaQZfsdk)

Jason.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 28, 2010, 12:24:31 PM
As you know, using homogeneous coordinates make it possible to express translation operation as a matrix. thus, the transformation in the above code can be written:
v=(v.x,v.y,abs(v.z));
v=R1*S*T*R2*v=A*v;

Btw, I tried out using homogeneous coordinates (Pixel Bender supports 4-component matrices and vectors):

Code:
 // Prefolds.
p = abs(p);
t=dot(p,n1); if (t>0.0) { p-=2.0*t*n1; }
t=dot(p,n2); if (t>0.0) { p-=2.0*t*n2; }
 
while (n < maxIterations) {
   // folds
   p = abs(p);           
   t=dot(p,n1); if (t>0.0) { p-=2.0*t*n1; }
   t=dot(p,n2); if (t>0.0) { p-=2.0*t*n2; }
   
   // rotate1,scale,rotate2
   p4.xyz = p; p4.w = 1.0;
   p = (M*p4).xyz;
   
   n++;         
}

Where M is precalculated once-per-frame as:

Code:
M = toMatrix4(rotationMatrix2) * translate(offset) * scale4x4(scale) * translate(-offset) * toMatrix4(rotationMatrix1);

The framerate went from 13.9 to 17.2 fps, or ~23% faster, so it might be worth implementing (at least on a GPU).

However in order to combine the matrix, you'll have to move the first rotation below the folds, and I think you restrict the variety of shapes this way. I could imagine the rotation matrices becoming more dependent this way.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on May 28, 2010, 10:05:00 PM
It's just a simplification of the one fold family. Nothing new. I've implemented it and it works.  :)
OK, so the variations now come down to;

option to pre-rotate before main loop
for i=1 to maxiterations
    rotate1 (if not already set as a pre-rotate)
    fold (whichever fold method - tetra/cubic/icosa etc)
    rotate2
    stretch
    if radius>bailout then break
end
I would say it comes down to:
Code:
for i=1 to maxiterations
    fold (whichever fold planes set)
    Multiply by An affine (or projective?) transform matrix. (in general a composition of translations, rotations and uniform scaling. You can obtain interresting results with other types of transformation but the Distance estimation must be adapted in this case)
    if radius>bailout then break
end
This formulation is good on the side of the computer because it's simple, general and fast. On the side of the user that's perhaps not the best representation.

The rotatations can either be around the origin or around the stretch center.  I originally had the rotations around the strech center which was incorrect but it leads to other unique images so I left it in as an option.
That was not incorrect just different :). In fact you can use any center for the rotations.

Does that cover all the variations so far?
Honestly, I don't know. The case of the menger sponge makes me think that there is an ingredient that is missing in the above "general" algorithm.

Nice videos. Thanks for sharing. I like particulary the second: it look like a boiling cloud :)

However in order to combine the matrix, you'll have to move the first rotation below the folds, and I think you restrict the variety of shapes this way. I could imagine the rotation matrices becoming more dependent this way.
I don't think so. The only difference I could see is an overall rotation.

GPUs are optimized for matrix-vector operations. It seem that they are very well optimized :w00t:. Have you tried the alternate formulation with rotations and abs() (without branchings)? Is it faster this way?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Syntopia on May 29, 2010, 12:17:58 AM
However in order to combine the matrix, you'll have to move the first rotation below the folds, and I think you restrict the variety of shapes this way. I could imagine the rotation matrices becoming more dependent this way.
I don't think so. The only difference I could see is an overall rotation.

I get different results? For instance, for the icosa, if I rotate 180 degrees around the x-axis before the folds, the icosa is unaffected. If I do the same rotation after the folds, but before the scaling, it completely disappears (which seems fair because we rotate away from the scaling center). Also, for the icosa I get no overall rotation from the first rotation - it happens for the dodeca, though.

GPUs are optimized for matrix-vector operations. It seem that they are very well optimized :w00t:. Have you tried the alternate formulation with rotations and abs() (without branchings)? Is it faster this way?

Not yet, but the conditional reflections are expensive. If I omit them (and get a very crippled icosa) I get around 40 fps.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Nahee_Enterprises on May 29, 2010, 03:43:42 AM
    Here are another 2 sample movies.  Both are created by only
    morphing/tweening the rotate1 and rotate2 values between frames.  Both really need to be watched in the full HD resolution to see the finer fractal details.

Really enjoyed seeing the various shapes possible in the first one of these two videos.    :)
 


Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 29, 2010, 09:57:29 AM
Softology: Those animations where great :D
Both of them varried in brightness for just a second. Was that due to the surface or was it a bug?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Softology on May 29, 2010, 12:21:50 PM
Softology: Those animations where great :D
Both of them varried in brightness for just a second. Was that due to the surface or was it a bug?

I think it comes down to the surface.  When the surface is rough there are not as many smooth surfaces to catch the light so it darkens.  Both of them use a single light phong shading model.

Jason.




Title: Re: Kaleidoscopic (escape time) IFS
Post by: kram1032 on May 29, 2010, 12:44:59 PM
Ok, that's what I thought :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: AndyAlias on August 08, 2011, 06:58:12 AM
I found a small optimization for GPU implementations:

Quote
t=dot(p,n1);
if (t>0.0) { p-=2.0*t*n1; }

Can be rewritten as:

Quote
p-=2.0 * max(0.0, dot(p, n1)) * n1;

Edit: I think it may depend a bit on a case by case basis if this is actually faster. ie if the branch condition mostly is true for the particular IFS.


Title: Re: Kaleidoscopic (escape time) IFS
Post by: knighty on August 26, 2011, 01:34:27 AM
Thanks. :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Imagyx on October 25, 2011, 10:20:28 PM
Thank you for these formulas.  :)


Title: Re: Kaleidoscopic (escape time) IFS
Post by: PhotoComix on July 04, 2012, 10:48:01 AM
really a long topic, but i couldn't find the answer to my question :

there is a practical implementation a formula that may be used in M3D, for kaleidoscope IFS ?


Title: Re: Kaleidoscopic (escape time) IFS
Post by: DarkBeam on July 04, 2012, 05:08:08 PM
Guess what? Sierpinski3, Menger3, MengerIFS, Dodecahedron, Icosahedron, Octahedron :tease: ... All of them are KIFS!!!


Title: Re: Kaleidoscopic (escape time) IFS
Post by: PhotoComix on July 04, 2012, 08:30:42 PM
wow! :D


Title: Re: Kaleidoscopic (escape time) IFS
Post by: Clemensson on October 28, 2013, 10:23:48 PM
Hi Kaleidos!

So i made this small Dx11 fractal renderer for a course at my university, which is called 'Fractals" :D

Anyways the idea was to simply generate new Kaleidoscopic Fractals with a few cklicks. In other words: add operators, modify the scaling, change parameters on the fly. Its not something new in terms of Fractal Theory but i thought it might be cool to have a tool to fool around with math.

And actually after some (very simply) fooling around i came along those following monsters which are all named by my girlfriend and hopefully you guys have not already found them:

Devil-hedron:

(http://i.imgur.com/KzTpC51.png)

Simple extension of the Sierpinski Tetrahedron with a Sphere Fold (as in the Mandelbox). I think its nice because it not only contains itself and
the formula looks something like:
Code:
scale: 2
offset: -1 -1 -1
plane fold 1: 0.71 0.71 0
plane fold 2: 0.71 0 0.71
plane fold 3: 0 0.71 0.71
sphere fold: 0.25 1.00

Moonflake

(http://i.imgur.com/jMUnBFE.png)

Well this is essentially the Koch Snowflake with a Sphere Fold (see the pattern here?). It actually gives the former flat fractal a body with a copy of itself at the pointy end :)
the formula looks something like:
Code:
scale: 2.5
offset: -2 -1 0
plane fold 1: 0.71 -0.71 0
plane fold 2: 0.71 0 -0.71
plane fold 3: 0 0.71 -0.71
sphere fold: 0.25 1.00

P.S.: again if those are already know, i am sry and i wont take credit for it, just let me know :)