DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« on: March 22, 2015, 04:17:07 PM » |
|
I never get anything good from foldcut polyhedra, so I thought to combine it with Sierpinski stuff and a nonstandard iterated intersect. In other words, crazy stuff (and slow!) but look; #info Foldcut toy (DarkBeam 2015/knighty 2011) #define providesInit #include "DE-Raytracer.frag" #include "MathUtils.frag" #group Icosahedral
uniform float Scale; slider[0.00,2,4.00] uniform int Iterations; slider[0,2,10]
uniform vec3 Offset; slider[(-1,-1,-1),(1,1,1),(1,1,1)] uniform vec3 Offset2; slider[(-1,-1,-1),(1,0,0),(1,1,1)]
uniform float Angle1; slider[-180,0,180] uniform vec3 Rot1; slider[(-1,-1,-1),(1,1,1),(1,1,1)] //uniform float Angle2; slider[-180,0,180] //uniform vec3 Rot2; slider[(-1,-1,-1),(1,1,1),(1,1,1)] mat3 fracRotation2; mat3 fracRotation1;
void init() { //fracRotation2 = rotationMatrix3(normalize(Rot2), Angle2); fracRotation1 = Scale* rotationMatrix3(normalize(Rot1), Angle1); }
float DE(vec3 z) { float t; int n = 0; float scalep = 1; float DE1 = 1000; vec3 z0=z; // Folds. //Dodecahedral while (n < Iterations) { z *= fracRotation1; z = abs(z); z -= Offset; if (z.y>z.x) z.xy =z.yx; if (z.z>z.x) z.xz = z.zx; if (z.y>z.x) z.xy =z.yx; z -= Offset2; if (z.y>z.x) z.xy =z.yx; if (z.z>z.x) z.xz = z.zx; if (z.y>z.x) z.xy =z.yx; n++; scalep *= Scale; DE1 = min(DE1,z.x/scalep); } //Distance to the plane going through vec3(Size,0.,0.) and which normal is plnormal return DE1; }
|
No sweat, guardian of wisdom!
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #1 on: March 22, 2015, 05:03:40 PM » |
|
Even crazier, a "Biomorph cube" Added a "Qube" slider, helps to get more solid shapes #info BioCube #define providesInit #include "DE-Raytracer.frag" #include "MathUtils.frag" #group Icosahedral
//Cut and fold (Houdini?) technique with icosahedral folding //Well... in 2d, it's proved that any (simple?) polygon can be obtained with Cut and fold //Seems it's the same for non auto intersecting polyhedra. Right?
//Size of the polyhedra uniform float Scale; slider[0.00,1.5,4.00] uniform int Iterations; slider[0,2,50]
uniform vec3 Offset; slider[(-1,-1,-1),(0,1,1),(1,1,1)] uniform vec3 Offset2; slider[(-1,-1,-1),(1,-0.3,-0.3),(1,1,1)] uniform float Qube; slider[-1,0.1,1]
uniform float Angle1; slider[-180,0,180] uniform vec3 Rot1; slider[(-1,-1,-1),(1,1,1),(1,1,1)] //uniform float Angle2; slider[-180,0,180] //uniform vec3 Rot2; slider[(-1,-1,-1),(1,1,1),(1,1,1)] mat3 fracRotation2; mat3 fracRotation1;
void init() { //fracRotation2 = rotationMatrix3(normalize(Rot2), Angle2); fracRotation1 = Scale* rotationMatrix3(normalize(Rot1), Angle1); }
float DE(vec3 z) { float t; int n = 0; float scalep = 1;
vec3 z0=z; z = abs(z); //z -= (1,1,1); if (z.y>z.x) z.xy =z.yx; if (z.z>z.x) z.xz = z.zx; if (z.y>z.x) z.xy =z.yx; float DE1 =1.0-z.x; z = z0; // Folds. //Dodecahedral while (n < Iterations) { z *= fracRotation1; z = abs(z); z -= Offset; if (z.y>z.x) z.xy =z.yx; if (z.z>z.x) z.xz = z.zx; if (z.y>z.x) z.xy =z.yx; z -= Offset2; if (z.y>z.x) z.xy =z.yx; if (z.z>z.x) z.xz = z.zx; if (z.y>z.x) z.xy =z.yx; n++; scalep *= Scale; DE1 = abs(min(Qube/n-DE1,(+z.x)/scalep)); //DE1 = z.x/scalep; } //DE1 = z.x/scalep; //Distance to the plane going through vec3(Size,0.,0.) and which normal is plnormal return DE1; }
|
|
« Last Edit: March 22, 2015, 07:48:42 PM by DarkBeam »
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
Crist-JRoger
|
|
« Reply #2 on: March 24, 2015, 04:28:58 PM » |
|
Cool! Thank you hot sharing ) That's from first script.
|
|
« Last Edit: September 14, 2015, 06:02:25 PM by Crist-JRoger »
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #3 on: March 24, 2015, 06:11:59 PM » |
|
How you everytime find that super stuff! I implemented a different version of the algo for MB3D, anyway (The ones posted here are experiments )
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
|
Patryk Kizny
|
|
« Reply #5 on: September 14, 2015, 06:16:29 PM » |
|
Looks cool! Will give it a run
|
|
|
Logged
|
Visual Artist, Director & Cinematographer specialized in emerging imaging techniques.
|
|
|
|