Welcome to Fractal Forums

Community => Introduction to Fractals and Related Links => Topic started by: willvarfar on August 09, 2012, 04:27:57 PM




Title: questions: how to colour, performance and zoo
Post by: willvarfar on August 09, 2012, 04:27:57 PM
I'm a fractal newbie and the Ludum Dare competition is fast approaching so I need to learn quickly ;)

I've been doing ray marching and talking in the programming board, but I have some more general questions about 3D fractals:

1) Colouring: I've loved Syntopia's DE series; is there an equiv cheat sheet for colouing fractals?  How is it normally done?

2) Performance: which fractals (with typical iterations and bailouts etc) are the quickest to render?

3) Zoo: is there any nice summaries with lots of common 3D fractals thumbailed near and far?  So I can glance over and say "oooh that'd look good in this part of that game..."?


Title: Re: questions: how to colour, performance and zoo
Post by: bib on August 09, 2012, 05:01:17 PM

3) Zoo: is there any nice summaries with lots of common 3D fractals thumbailed near and far?  So I can glance over and say "oooh that'd look good in this part of that game..."?

On point 3) check this out for instance:

http://www.fractalforums.com/images-showcase-(rate-my-fractal)/familiar-fractals-in-the-mandelbox
http://miqel.com/fractals_math_patterns/3d_fractals_mandelbulb.html


Title: Re: questions: how to colour, performance and zoo
Post by: eiffie on August 09, 2012, 06:05:56 PM
I would be interested in the coloring info too!
The amazing box and variants are often used in demos for speed. One cheat I use is low iterations then return a distance to a square rather than a sphere. You lose detail but still have sharp edges. Use the distance field for collision detection and you should come up with a pretty good maze game :)


Title: Re: questions: how to colour, performance and zoo
Post by: willvarfar on August 10, 2012, 11:24:25 AM
I would be interested in the coloring info too!
The amazing box and variants are often used in demos for speed. One cheat I use is low iterations then return a distance to a square rather than a sphere. You lose detail but still have sharp edges. Use the distance field for collision detection and you should come up with a pretty good maze game :)

AmazingBox is another name for MandelBox, right?  Can you share your fast DE?  would other end shapes also be interesting?

Regards Ludum Dare, I always do a collaborative entry; this compo I'll post to the collabortion board here if there's anyone who wants and can join in.  (Or do other, competing entries; that'd also be cool :)


Title: Re: questions: how to colour, performance and zoo
Post by: eiffie on August 10, 2012, 07:52:38 PM
Yes ABox and MBox are same thing. This code was originally from rrrola but I have perverted it somewhat. There may be typos as I don't have a graphics card to try it right now. The vars in caps look something like ITERS (5 to 13), SCALE (-4 to 4), RADIUS (2 to 16) and SIZE is dependant on SCALE (just play around). This isn't the best DE, just a fast one as you can use low iters. Maybe you can even do a reflection off the nice flat surfaces??
Code:
float DE(vec3 z0)
{
vec4 z = vec4(z0,1.0),c=z; //or use a constant for c
for (int n = 0; n < ITERS; n++) {
z.xyz=clamp(z.xyz, -1.0, 1.0) *2.0-z.xyz; //box fold
z*=SCALE*clamp(1.0/dot(z.xyz,z.xyz),1.0,RADIUS); //scale and sphere fold
z+=c;
}
z=abs(z);
return (max(z.x,max(z.y,z.z))-SIZE)/z.w;
}
You can substitute this fold z.xyz=abs(z.xyz+1.0)-1.0 for a different look (from kali I think).
You can also substitute a cylinder fold or elliptical fold for the sphere fold or use a swizzle like this...
if (n==2)z=z.yzxw;
etc. etc. etc... Maybe try to make it a random box so you never play the same game twice :)