Title: A weird cut-fold toy
Post by: DarkBeam 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!) :D 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; }
Title: Re: A weird cut-fold toy
Post by: DarkBeam on March 22, 2015, 05:03:40 PM
Even crazier, a "Biomorph cube" :o 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; }
Title: Re: A weird cut-fold toy
Post by: Crist-JRoger on March 24, 2015, 04:28:58 PM
Cool! Thank you hot sharing ) That's from first script.
(http://orig09.deviantart.net/4319/f/2015/257/d/4/frag_76_by_crist_jroger-d99kn80.jpg) (http://orig09.deviantart.net/4319/f/2015/257/d/4/frag_76_by_crist_jroger-d99kn80.jpg)
Title: Re: A weird cut-fold toy
Post by: DarkBeam on March 24, 2015, 06:11:59 PM
:embarrass: How you everytime find that super stuff! ;)
I implemented a different version of the algo for MB3D, anyway :beer:
(The ones posted here are experiments ;) )
Title: Re: A weird cut-fold toy
Post by: Crist-JRoger on September 14, 2015, 06:07:50 PM
I like this script. Simple and very nice. This is raw renders
(http://pre10.deviantart.net/8d78/th/pre/f/2015/247/7/b/desert_srone_by_crist_jroger-d98btfm.png) (http://orig06.deviantart.net/d2a7/f/2015/247/a/5/frag_03_09_01_by_crist_jroger-d98bs2g.png)
(http://pre09.deviantart.net/9fbe/th/pre/f/2015/254/2/b/morning_by_crist_jroger-d98jzay.jpg) (http://orig05.deviantart.net/e7f8/f/2015/254/2/b/morning_by_crist_jroger-d98jzay.jpg)
Title: Re: A weird cut-fold toy
Post by: Patryk Kizny on September 14, 2015, 06:16:29 PM
Looks cool! Will give it a run
|