Logo by Dinkydau - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 26, 2024, 04:48:14 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1] 2 3   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: Procedural aperiodic fractals  (Read 4224 times)
0 Members and 1 Guest are viewing this topic.
tomkh
Alien
***
Posts: 24


« on: August 31, 2010, 12:33:06 AM »

Hello Fractal Forums!

I'm a new user here.

As a good start I will share with my latest experiment (I will post a routine later if anyone will be interested).
I did some procedural aperiodic penrose tiling and a simple fractal out of it.
It's a function (x,y) -> (r,g,b) , so it's truly procedural and can be calculated in parallel architectures (multi-core or GPU).
In fact it is very fast (real-time on my quad-core).
I don't know if it's anything new, it is a bit similar to kaleidoscopic IFS (using similar space folding idea that I knew before kaleidoscopic IFS was announced, but seeing those beautiful 3D renderings made by knighty and others inspired me to do more research in it).
Calculating aperiodic tiling involves several iterations per pixel (tile subsitution), and fractal version is just a modification in coloring.
One can extend the idea to any aperiodic tiling that is so called "volume hierarchic"... my dream is to make some 3D volume hierarchic aperiodic tilings.. but only a dream now :-)

This routine was prototyped and rendered in EvalDraw (some of you might know this wonderful :-) tool already).


* proceduralpenrose.jpg (195.51 KB, 768x450 - viewed 127 times.)
« Last Edit: August 31, 2010, 01:01:05 AM by tomkh » Logged
tomkh
Alien
***
Posts: 24


« Reply #1 on: August 31, 2010, 12:35:43 AM »

And a fractal version...


* proceduralpenrosefractal.jpg (243.54 KB, 918x542 - viewed 130 times.)
Logged
kram1032
Fractal Senior
******
Posts: 1863


« Reply #2 on: August 31, 2010, 12:45:36 AM »

really nice smiley

I think, I've read somewhere that it's not too hard to do Penrose-like tilings in 3D but it's impossible to have tilings which can only be tiled in a single definite pattern which stops somewhen if you make a mistake.
The 2D Penrose tiling will stop after some time if you put together two tiles in an invalid way.

So the 3D variant works but not perfectly alike the 2D one.

Also it's kind of hard to do nice 3D visual representations of tilings as the outer parts always occlude the interior and thus the beautiful aperiodic symmetry behind such tilings... - of course you can do cross sections or something but I think, in case of those tilings, the 2D case is artistically actually more interesting...
« Last Edit: August 31, 2010, 02:27:28 AM by kram1032 » Logged
fractower
Iterator
*
Posts: 173


« Reply #3 on: August 31, 2010, 01:01:15 AM »

I had a friend who worked on Danzer tiling (the 3D version) for his thesis. This is the getting started link he sent me.

http://www.cs.williams.edu/~98bcc/tiling/

Kram1032 has a good point about visualizing 3D tilings. Don't you hate knowing there is something cool inside that you cannot see.
Logged
tomkh
Alien
***
Posts: 24


« Reply #4 on: August 31, 2010, 01:32:41 AM »

Thanks for reply and links.
In conclusion - Danzer 3d tilings might be the anwser... inflation rules looks complicated though.
I guess they are not volume hierarchic either... it's not really a problem, unless you want (x,y,z) function,
would be nice to actually see someone visualise them in 3d.

For interior visibility problem - how about full color stereoscopy (or full VR) and translucent material (jelly-like) ?
I could try it at one point.
Logged
tomkh
Alien
***
Posts: 24


« Reply #5 on: August 31, 2010, 03:24:36 PM »

Here is some pinwheel fractal, easy to use procedural function (probably colors need some more tweaking)...


* proceduralpinwheelfractal.jpg (90.22 KB, 835x429 - viewed 118 times.)
Logged
lkmitch
Fractal Lover
**
Posts: 238



« Reply #6 on: August 31, 2010, 05:20:42 PM »

Tomkh,

Nice images.  I particularly like the first one--it reminds me of an Islamic design.  I look forward to seeing your routines!
Logged
kram1032
Fractal Senior
******
Posts: 1863


« Reply #7 on: August 31, 2010, 07:08:00 PM »

pinwheel fractals can easily be extended into 3D, afaik smiley
Logged
tomkh
Alien
***
Posts: 24


« Reply #8 on: August 31, 2010, 11:15:42 PM »

Here is the routine for procedural penrose tiling (based on robinson substitution rules).
It's working EvalDraw script that maps (x,y) to (r,g,b) space.
Just increase number of substitutions if you want to cover larger area ("levels" constant) and of course scale it up :-)

Code:
(x,y,&r,&g,&b)

// Procedural penrose tiling
// 2010 (C) Tomasz Dobrowolski
// http://moonedit.com/tom

// This is based on Robinson substitution,
// prototiles are two iosceles triangles,
// type 0 with angles: 36, 36, 108 deg.
// type 1 with angles: 72, 72, 36 deg.

enum {
   levels = 9,         // number of substitutions
   sc = 2/(sqrt(5)-1),  // inflation scale
  
   // transformations constants:
   d1 = tan(54*PI/180),
   d2 = tan(18*PI/180),
   a1 = .5/cos(36*PI/180),
   a2 = (1+a1)*.5,
   a3 = tan(36*PI/180)*a2,
   cos1 = cos(144*PI/180)*sc,
   sin1 = sin(144*PI/180)*sc,
   cos2 = cos(108*PI/180)*sc,
   sin2 = sin(108*PI/180)*sc
};

type = 0; // starting triangle type

for(k=0; k<levels; k++)  // iterate all subsitutions
{
   if (type == 0)
   {
      // We substitute triangle type 0
      // with three possible triangles.
      // We detect in which of those three
      // triangle our current (x,y) lies
      // by checking line equations separating them:
      
      if (1 - d1*y - x > 0) // left triangle
      {        
         // only translation/mirror here:
         x = (1 - x)*sc;
         y = y*sc;            
      }
      else if (1 - d2*y - x > 0) // middle triangle
      {
        
         // translate:
         xx = x - a2;    
         yy = y - a3;
        
         // rotate:
         x = xx*cos1 - yy*sin1;
         y = xx*sin1 + yy*cos1;
        
         type = 1; // tile type changes here!        
      }
      else // right triangle
      {      
         // translate (x only):
         xx = x - (1+a1);
         yy = y;
      
         // rotate:
         x =  xx*cos1 + yy*sin1;
         y = -xx*sin1 + yy*cos1;        
      }      
   }
   else
   {
      // We substitute triangle type 1 with
      // two possible triangles (analogically).

      if (d1*y - x > 0) { // upper triangle
      
         // rotate only
         xx = x;
         yy = y;
         x = -xx*cos2 + yy*sin2;
         y =  xx*sin2 + yy*cos2;
                  
         type = 0; // tile type changes here!
        
      } else { // lower triangle
      
         // translate (x only):
         xx = x - a1;
         yy = y;
        
         // rotate:
         x =  xx*cos2 + yy*sin2;
         y = -xx*sin2 + yy*cos2;        
      }
   }  
}

// Now we found resulting tile type
// after given number of substitution:

// We can use (x,y) for some additional
// texture effects!

if (type == 0) {
   // return tile type 0 color (yellowish orange):
   r = 218;
   g = 213;
   b = 118;
} else {
   // return tile type 1 color (marine blue):
   r = 74;
   g = 101;
   b = 166;
}


The other tilings/fractals were generated in a similar way.
Just different prototiles, angles and line equations.


* proceduralpenrosescript.jpg (117.09 KB, 823x316 - viewed 122 times.)
« Last Edit: August 31, 2010, 11:21:49 PM by tomkh » Logged
Nahee_Enterprises
World Renowned
Fractal Senior
******
Posts: 2250


use email to contact


nahee_enterprises Nahee.Enterprises NaheeEnterprise
WWW
« Reply #9 on: September 01, 2010, 10:52:07 AM »

    Hello Fractal Forums!
    I'm a new user here.

    As a good start I will share with my latest experiment (I will post a routine later
    if anyone will be interested).  I did some procedural aperiodic penrose tiling and
    a simple fractal out of it.    ...........

    This routine was prototyped and rendered in EvalDraw....

Greetings, and Welcome to this particular Forum !!!    smiley

Not really familiar with that "tool", but always interested in seeing what else is available.
 
Logged

tomkh
Alien
***
Posts: 24


« Reply #10 on: September 02, 2010, 12:35:34 PM »

It is sort of like writing a shader for GPU, in fact it should be easy to port to a shader.

You have your input x,y coordinates and output &r,&g,&b.
Then, you can write a general code in C that describes your function.
EvalDraw manages threads so your function can be executed in parallel to draw
entire screen as fast as possible. It is mostly useful for prototyping, tweaking equations;
like it is not intended to produce hi-quality images.
Instead you can for example use lower pixel resolution if your function
is too slow or whenever you change something in code you
see immediate result.

Moreover, this is only one of possible modes. You also have animated 2D mode
(x,y,t,&r,&g,&b), 3D voxel mode (x,y,z,&r,&g,&b), sound generation mode,
general mode (for small apps) etc...

Excuse me a little bit advertisement, but I was a bit involved in development of this tool,
and it is free anyway smiley

Here is the link: http://advsys.net/ken/download.htm#evaldraw
(just copy and paste my routine and while holding left/right mouse buttons you can pan/zoom into the structure, it's also fun if you increase "levels" or change output colors in the last few lines)
« Last Edit: September 02, 2010, 01:44:44 PM by tomkh » Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #11 on: September 07, 2010, 02:45:25 AM »

There is at least on user of evaldraw here... me. afro Most of the pictures that I've posted here are made with this tool.
Very nice Idea by the way. I always wanted to do some Penrose tilings. Thanks for sharing.
Do you have refrences about Robinson substitutions?
Logged
tomkh
Alien
***
Posts: 24


« Reply #12 on: September 09, 2010, 11:57:00 PM »

Hi Knighty!
I was actually thinking about you and evaldraw, since I was reading some of your old posts on this forum :-)

For Robinson Triangles, I was mostly using Tilings Encyclopedia:
http://tilings.math.uni-bielefeld.de/substitution_rules/robinson_triangle

Unfortunately they don't provide info about angles, but those are easy to derive, there is actually only one possibility,
so smaller angle is just 180/5 degrees.

One can use any tiling they call "volume hierarchic" with my method.
My next pick would be "Triangle Duo" and "Cyclotomic rhombs 7-fold". The latter looks especially cool !
Just check it out: http://tilings.math.uni-bielefeld.de/substitution_rules/cyclotomic_rhombs_7_fold
Although, I'm a bit lazy to derive angles and line equations, so I was actually thinking about writing small
editor for that - you would just draw those substitutions like in a CAD software and it will generate .kc for you.
It will take me some time to do it, though.

BTW
Great work with 3D kaleidoscopic-IFS, it really impressed me!
I was once talking with Inigo Quilez (maybe you know him? he did an extraordinary fractal rendering research!)
and I was sharing with him with my simple idea of procedural tree xy function based on space folding.
I guess folding is probable something very basic in fractal generation, but at a time I didn't think about all possibilities,
like rendering it with distance function in 3D! And maybe there is much more to explore.

If you are intersted, here is my original tomtree.kc from June 2007:
Code:
(x,y,t)
static ot = -1;
static co = 1;
static si = 0;
if (t != ot) {
   s = sin(t)*.5;
   co = cos(-pi/4+s);
   si = sin(-pi/4+s);
   ot = t;
}
xp = x;
yp = abs(y);
s = .5;
d = .25;
c = 0;
k=0;
while(1) {     
   if (abs(xp)<d && abs(yp-s)<s) {
      c2 = .5-abs(xp)/d;
      if (c < c2) c = c2;
   }
   if (k>16)
      break;
   xp = abs(xp)*1.2;
   yp -= s*2; //1.8;
   x2 = co*xp + si*yp;
   y2 = co*yp - si*xp;
   xp = x2;
   yp = y2;
   k++;
   s *= 2/3;   
   d *= 2/3;   
}
c
Logged
tomkh
Alien
***
Posts: 24


« Reply #13 on: September 10, 2010, 12:00:38 AM »

As a bonus, here is tomtree.kc after some little tweaking:

Code:
(x,y,t)
static ot = -1, co, si, si2, co2;
if (t != ot) { ot = t;
   s = -.5+sin(t*.6174)*.5;
   co = cos(-pi/4+s);
   si = sin(-pi/4+s);
   si2 = sin(t);
   co2 = cos(t*.374325);
}
xp = x; yp = abs(y);
ys = 2+si2*.5; xs = co2*.5-.5;
s = .5; d = .25; c = 0;
for(k=0; k<16; k++) {
   c2 = 1-(xp^2 + (yp-s)^2);
   if (c < c2) c = c2;
   xp = abs(xp-xs)*1.2;
   yp = abs(yp-ys)*1.2 - s*2;
   x2 = co*xp + si*yp;
   y2 = co*yp - si*xp;
   xp = x2;
   yp = y2;
   s *= 2/3;  
   d *= 2/3;  
}
c

Update: I just found your KIFS renderer experiment in evaldraw - it's just insanely cool! :-)
« Last Edit: September 10, 2010, 12:54:29 AM by tomkh » Logged
knighty
Fractal Iambus
***
Posts: 819


« Reply #14 on: September 10, 2010, 01:18:14 AM »

Thank you very much. smiley
It should be possible to get a distance function to those "fractal tilings" and do some nice caves (hehe!) in 3D.

I did some modification to your script to give the distance field:
Code:
(x,y,t)
static ot = -1, co, si, si2, co2;
if (t != ot) { ot = t;
   s = -.5+sin(t*.6174)*.5;
   co = cos(-pi/4+s);
   si = sin(-pi/4+s);
   si2 = sin(t);
   co2 = cos(t*.374325);
}
xp = x; yp = abs(y);
ys = 2+si2*.5; xs = co2*.5-.5;
s = .5; d = .25; c = 0;
scl=1.75;
for(k=0; k<30; k++) {
   xp = abs(xp-xs)*scl;
   yp = abs(yp-ys)*scl;
   x2 = co*xp + si*yp;
   y2 = co*yp - si*xp;
   xp = x2;
   yp = y2; 
}
distance=sqrt(xp^2+yp^2)/scl^k;
distance^0.25//for better contrast
You were pretty close to the KIFS  grin

PS: IQ is a living legend!   afro
PS²: Your work on fractal caves and growing creatures are awesomely cool too!
Logged
Pages: [1] 2 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Sunflow Procedural Fractal Images Showcase (Rate My Fractal) doncasteel8587 7 1855 Last post August 13, 2007, 01:42:48 AM
by doncasteel8587
two b&w 3d fractals 3D Fractal Generation lycium 0 7056 Last post August 25, 2007, 12:16:05 AM
by lycium
Mandelbox with procedural glows Images Showcase (Rate My Fractal) eq 4 1056 Last post May 08, 2010, 05:26:35 AM
by Pauldelbrot
No man's Sky - procedural computergame Fractal News across the World Chillheimer 1 1014 Last post August 15, 2014, 01:14:59 PM
by kram1032
3D Procedural content generations. Fractals. Commission an Artist verstkabond 0 1023 Last post February 07, 2017, 10:17:01 PM
by verstkabond

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.197 seconds with 26 queries. (Pretty URLs adds 0.02s, 2q)