Welcome to Fractal Forums

Fractal Software => Mandelbulb 3d => Topic started by: M Benesi on December 17, 2016, 01:00:33 AM




Title: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: M Benesi on December 17, 2016, 01:00:33 AM
  Cool for animations.

  It's continuous, so it should blend well with a variety of static (non-animated) fractals.

  Set cycleshift=0 for a component (x, y, or z) if you want to skip some calculations (don't want to use it for an axis- 0 cycleshift skips calculations on that axis).  

  There are 2 versions, one is an xyz all in one function, and one has them split up.  They are called Accordion_cycleshift and xyz_Accordion_cycleshift...  the xyz_cycleshift thing lets you shift all cycles at once.  :D

  https://drive.google.com/open?id=0B0EcJQ49B_yObGlXbVk4SURRdmc

  (http://i.giphy.com/l0HlD9NLuDuBbnbHi.gif)  

(http://i.giphy.com/3oz8xZ3aopPvJBsveg.gif)


Title: Re: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: DarkBeam on December 17, 2016, 11:35:07 AM
How it is done Matt :alien:


Title: Re: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: M Benesi on December 18, 2016, 01:29:35 AM
I want to write a more symmetric version (reflected along an axis) so it can be used with polyfolds and stuff, but it's based on the following code (which is only for the x-axis!):

  uniform list (floats):   AccCycle, CycleShift, AccEnd, AccStart

Code:
float Accordion (inout vec3 z) {
float zx=z.x;
float cycle=abs(AccCycle);
if (cycle<.06) {cycle=.06;}
float i=1.0; //why did he use a float here?  :p
float cycleshift=abs(mod(CycleShift,abs(AccCycle)));
float cyclemod= (mod(abs(AccEnd-AccStart),AccCycle));
cyclemod=mod(cycle+cyclemod-cycleshift,cycle);
if ((cycle)>abs(AccEnd-AccStart)) {cycle=abs(AccEnd-AccStart);}
float rotdir=1.0;
if (AccEnd-AccStart<0.0) {
cycle=-cycle;
cyclemod=-abs(cyclemod);
cycleshift=-abs(cycleshift);
if (zx>AccStart) {
// do nothing
} else if (zx<AccStart && zx>(AccStart+cycleshift)) {
//first cycle!!!
zx=zx-(AccStart);
if (zx<(cycleshift/2.)) {
zx=cycleshift-zx+AccStart;
} else {zx+=AccStart;}
//done
}
else if (zx<(AccStart) && zx>(AccEnd-cyclemod)){
zx=zx-AccStart-cycleshift;
//i+=1.0;
rotdir*=-1;
while (zx<(cycle) && i<3000.0) {
zx-=cycle;i+=1.0;rotdir*=-1;
}
if (zx<(cycle/2.)) {
zx=cycle-zx+AccStart;//rotdir*=-1;
} else {zx+=AccStart;}
//done
}
else if (zx<(AccEnd- cyclemod)  && zx>AccEnd) {
zx=AccEnd-zx;
if (zx<cyclemod/2.0) {
zx=cyclemod-zx+AccStart;
} else {
zx=zx+AccStart;
}
}  
else if (zx<AccEnd) {
zx=zx-AccEnd+AccStart;
}
} else {    //pos section   AccEnd-AccStart >0
cycle=abs(cycle);
cyclemod=abs(cyclemod);
cycleshift=abs(cycleshift);
if (zx<AccStart) {
// do nothing
} else if (zx>AccStart  && zx<AccStart+cycleshift) {
//first cycle!!!
zx=zx-AccStart;  
if (zx>cycleshift/2.) {
zx=cycleshift-zx+AccStart;
} else {
zx+=AccStart;
}

} else if (zx>(AccStart) && zx<(AccEnd-cyclemod)){
zx=zx-AccStart-cycleshift; //i+=1.0;
rotdir*=-1;
while (zx>(cycle) && i<3000.0) {
zx-=cycle;i+=1.0;rotdir*=-1;
}
if (zx>(cycle/2.)) {
zx=cycle-zx+AccStart;//rotdir*=-1;
} else {zx+=AccStart;}
//done
}

else if (zx>(AccEnd- cyclemod)  && zx<AccEnd) {
zx=AccEnd-zx;
if (zx>cyclemod/2.0) {
zx=cyclemod-zx+AccStart;
} else {
zx=zx+AccStart;
}
//i+=floor((AccEnd-cyclemod-AccStart)/cycle)+1.0;
}  
else if (zx>AccEnd) {
zx=zx-AccEnd+AccStart;
//i+=floor((AccEnd-cyclemod-AccStart)/cycle)+2.0;
}
}

z.x=zx;



return z;
}

  This version starts at a point you pick (AccStart), then cycles (up towards the midpoint of a cycle then back down to the beginning of the cycle if you're going in a positive direction,  down towards the midpoint then back up to the beginning of the cycle if you're going in a negative direction) until you reach the end.  The cycle shift shifts the location of the cycles, so you can introduce movement, or change something around a bit.  

  I'd like to make a similar function centered at a point along an axis for a symmetric version (extends out from a central point)...  need to draw it on a piece of paper before I start coding I think.  

  (http://i.giphy.com/l0MYEzjjkEg67pwvm.gif)


Title: Re: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: quaz0r on December 18, 2016, 04:37:56 AM
it kinda looks like one of those things from the matrix


Title: Re: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: M Benesi on December 18, 2016, 08:41:23 AM
(https://lh3.googleusercontent.com/J1lb0kUglRWqYltDgm_rwIn1ETkEeHkujBZmzzHDMPImux6Oy0bZqAFcTHJjZnZodsyrK7Ym_o11FA=w800-h600-no)

that one show??


Title: Re: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: M Benesi on December 19, 2016, 11:32:20 PM
xyz_Accordion_Double is symmetric for all axes (so can be used with polyfolds if you have symmetries to use):

(http://i.giphy.com/l4JzafhvzM9CYnRDO.gif)

It's in the same directory:  https://drive.google.com/open?id=0B0EcJQ49B_yObGlXbVk4SURRdmc


  Or you can use it with other continuous functions....
(http://i.giphy.com/jgM5cQ27VzRS0.gif)



Title: Re: Continuous Boxtiling Function (Accordion+cycleshift)
Post by: M Benesi on December 21, 2016, 04:58:47 AM
I made it weirder.  :D

https://www.youtube.com/watch?v=Raw4N3l-OSs&edit=vd