DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« on: October 28, 2011, 06:45:53 PM » |
|
Okay! Those fractals were only in my dreams but two days ago I visited the photo gallery of Syntopia and I have seen this stunning image!!! http://www.flickr.com/photos/syntopia/6012768734/in/pool-1554549@N24/So I asked for the formula in a private message and he kindly shared his formula. Great dude float Sierpinski4(vec4 z) { float r; int n = 0; while (n < Iterations) {
// This is the hyper-tetraedral folding if(z.x+z.y<0.0) z.xy = -z.yx; if(z.x+z.z<0.0) z.xz = -z.zx; if(z.y+z.z<0.0) z.zy = -z.yz; if(z.x+z.w<0.0) z.xw = -z.wx; if(z.y+z.w<0.0) z.yw = -z.wy; if(z.z+z.w<0.0) z.zw = -z.wz; Rotate4D (z,Angles4D); // <- placed by me to make it a "true" KIFS z = z*Scale - Offset4*(Scale-1.0); n++; } return (length(z) ) * pow(Scale, -float(n)); }
Those are my formulas, still improvable I know ... Menger4IFS(x,y,z,w){ r=x*x+y*y+z*z; for(i=0;i<MI && r<bailout;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;} if(x-w<0){x1=w;w=x;x=x1;} if(y-w<0){x1=w;w=y;y=x1;} if(z-w<0){y1=w;w=z;z=y1;}
rotate4D(x,y,z,w);
x=scale*x-CX*(scale-1); y=scale*y-CY*(scale-1); w=scale*w-CW*(scale-1); z-=0.5*CZ*(scale-1)/scale; z=-abs(-z); z+=0.5*CZ*(scale-1)/scale; z=scale*z; r=x*x+y*y+z*z; } return sqrt(x*x+y*y+z*z)*scale^(-i); float Octahedron4(vec4 z) { // ... See Sierpinski4 until folding then
// This is the hyper-octaedral folding // scale 2 and CScaleY=1 all other 0 should give you the normal octahedron x=abs(x);y=abs(y);z=abs(z);w=abs(w); 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;} // ... fold w like in Menger4 ... and finally // ... See Sierpinski4 } For now that's all.
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
eiffie
Guest
|
|
« Reply #1 on: October 29, 2011, 05:25:19 PM » |
|
thank you both for these! I will just add you can get nice animations rotating per iteration if(i==1)Rotate4D(x,y,z,w,angle1); if(i==2)Rotate4D(x,y,z,w,angle2); these conditionals won't slow your script down as all pixels take the same path
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #2 on: October 29, 2011, 08:05:46 PM » |
|
Great suggestion indeed ... but since I cannot run those advanced blenders, and I am using Jesse's program I am forced to use a limited number of params. Jesse add more rooms
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
Syntopia
|
|
« Reply #3 on: October 29, 2011, 11:38:00 PM » |
|
Hi Darkbeam, glad you like it! Now, all this 4D stuff got me thinking. These systems, like the Quaternion Julia 4D system, work by choosing a 3D-volume "slice" of 4D space (for instance, a fixed w-value) and drawing it. This would be similar to visualizing a 3D system by drawing a 2D plane-slice from it. But normally we do a perspective projection from 3D to 2D instead. Isn't it possible to do the same for 4D systems using distance estimated ray marching? I can see on Wikipedia ( http://en.wikipedia.org/wiki/Tesseract), that people are doing 4D perspective projections of the Tesseract (4D cube), something which seem to result in much richer structures than simple 3D slices. Has anyone tried something similar for fractals? Btw, I also did a 4D Menger thingy some time ago - I cannot find the formula, but I think it is similar to yours. I did a small animation here (starts out extremely slowly!):
http://vimeo.com/moogaloop.swf?clip_id=20342823&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=01AAEA
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #4 on: October 30, 2011, 12:16:32 PM » |
|
All fractals are similar, too bad similar is not enough Anyway thanks again
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #5 on: October 30, 2011, 12:30:40 PM » |
|
Now, all this 4D stuff got me thinking. These systems, like the Quaternion Julia 4D system, work by choosing a 3D-volume "slice" of 4D space (for instance, a fixed w-value) and drawing it. This would be similar to visualizing a 3D system by drawing a 2D plane-slice from it. But normally we do a perspective projection from 3D to 2D instead. Isn't it possible to do the same for 4D systems using distance estimated ray marching? I can see on Wikipedia ( http://en.wikipedia.org/wiki/Tesseract), that people are doing 4D perspective projections of the Tesseract (4D cube), something which seem to result in much richer structures than simple 3D slices. Has anyone tried something similar for fractals? Well we have this pretransform by Aexion, hope it helps x' = abs( x + y + z) + Offset y' = abs(-x - y + z) + Offset z' = abs(-x + y - z) + Offset w' = abs( x - Y - z) + Offset PRETRANSFORM; do it once before all other calculations
|
|
« Last Edit: October 30, 2011, 12:34:20 PM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #6 on: October 30, 2011, 12:52:11 PM » |
|
Example 2 Example of "4D rotation of the whole bulb" on a single axis Uploaded at ImageFra.me
|
|
« Last Edit: October 30, 2011, 01:00:22 PM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
Jesse
Download Section
Fractal Schemer
Posts: 1013
|
|
« Reply #7 on: October 30, 2011, 03:16:06 PM » |
|
Hi Darkbeam, glad you like it!
Now, all this 4D stuff got me thinking. These systems, like the Quaternion Julia 4D system, work by choosing a 3D-volume "slice" of 4D space (for instance, a fixed w-value) and drawing it. This would be similar to visualizing a 3D system by drawing a 2D plane-slice from it. But normally we do a perspective projection from 3D to 2D instead. Isn't it possible to do the same for 4D systems using distance estimated ray marching?
I think you just have to use a 4d vector for stepping, define a z.w for the camera and a 4th vec component based on the 4d rotation of the camera. Let it to you to post the first image of such a quat or ifs, since i am a bit slow at the moment
|
|
|
Logged
|
|
|
|
Syntopia
|
|
« Reply #8 on: October 30, 2011, 04:22:54 PM » |
|
Hi Darkbeam, glad you like it!
Now, all this 4D stuff got me thinking. These systems, like the Quaternion Julia 4D system, work by choosing a 3D-volume "slice" of 4D space (for instance, a fixed w-value) and drawing it. This would be similar to visualizing a 3D system by drawing a 2D plane-slice from it. But normally we do a perspective projection from 3D to 2D instead. Isn't it possible to do the same for 4D systems using distance estimated ray marching?
I think you just have to use a 4d vector for stepping, define a z.w for the camera and a 4th vec component based on the 4d rotation of the camera. Let it to you to post the first image of such a quat or ifs, since i am a bit slow at the moment Yes, I think most of the implementation should be straightforward, but there are some issues with the camera. In 3D (with a pinhole camera model) you have a camera position and direction, and the 2D viewport will be a plane orthogonal to the camera direction - the position and size of the viewport plane determines, how different the angles of each of the camera rays will be (and thus the FOV for x and y). In 4D space, you would have a (4D) camera position and camera direction. There is no 2D plane orthogonal to this 4D direction (instead there is an orthogonal 3D volume). So how do you decide the direction of the individual camera rays (for each pixel in the 2D viewport), given the 4D direction? Well, I think I need to do some experiments or google it a bit more (I found this introduction: http://eusebeia.dyndns.org/4d/vis/vis.html, but it doesn't seem to be technical enough).
|
|
|
Logged
|
|
|
|
Jesse
Download Section
Fractal Schemer
Posts: 1013
|
|
« Reply #9 on: October 30, 2011, 10:39:04 PM » |
|
Yes, I think most of the implementation should be straightforward, but there are some issues with the camera. In 3D (with a pinhole camera model) you have a camera position and direction, and the 2D viewport will be a plane orthogonal to the camera direction - the position and size of the viewport plane determines, how different the angles of each of the camera rays will be (and thus the FOV for x and y). In 4D space, you would have a (4D) camera position and camera direction. There is no 2D plane orthogonal to this 4D direction (instead there is an orthogonal 3D volume). So how do you decide the direction of the individual camera rays (for each pixel in the 2D viewport), given the 4D direction? Well, I think I need to do some experiments or google it a bit more (I found this introduction: http://eusebeia.dyndns.org/4d/vis/vis.html, but it doesn't seem to be technical enough). FOV came also into my mind after posting, a simple aproach would be to see it as a combination of two camera vector rotations of the xz and yz planes, so the w component would stay untouched. Dunno if this makes much sense since i have not spend much time for this topic right now. And maybe this would lead to more or less the same possibilities that you can already do with 4d rotations in M3D yet?
|
|
|
Logged
|
|
|
|
|