iq
Guest


« Reply #390 on: November 12, 2009, 08:00:31 AM » 

Hi guys, I just registered to the forum because somebody pointed me to this thread this morning. I got interested in the trigonometric version of the Mandelbrot set posted here, so I wrote a small raymarcher (in C) and tried the idea. Results are interesting. First I tried it in the CPU: Render time was about 15 minutes (512 ambient occlusion rays, one shadow ray, two light sources, 2x2 antialias at 1280x720). The raymarcher is very rudimentary, the step size is constant, no distance estimation computations to speed the marching. Not yet. The surface normal (if such a thing exists for fractals) is computed by the central differences method, it's not analytic. Since a couple of years ago I did a demo with a quaternion 4d julia set in realtime with ambient occlusion in the GPU (Kindernoiser: http://iquilezles.org/prods/#kindernoiser), I decided to port this little raymarcher of this morning to the GPU this afternoon. Results are promising, I get almost realtime rendering (5 frames per second) without the distance estimation optimization and some nonraytracebased ambient occlusion. My motivation to try this has been one of those greenbroccoli zooms posted by Twenbie, it so much looks like real vegetation or a forest, it's amazing. I hope I can work a bit next days again and do something like that, I will continue to do so. Also, I think twenbie or somebody with a good raytracer handy should try some subsurfacescattering (translucent surfaces), that should rock quite a lot!!! About the topic, it's really a pity the thing doesn't work that nicely for exponent=2, otherwise I would say this would have been the definite 3D MSet. In any case, the choice of multiplying both angles by the exponent in the trigonometric multiplication is rather arbitrary I think. It's a pity. I somehow feel the real thing not trigonometric, but polynomial, although I'm not the one to tell. My best attempt so far was this http://iquilezles.org/www/articles/experimental3djulia/experimental3djulia.htm whici is completely ridiculous compared to the beautiful images produced by this trigonometric variation discussed in the thread.



Logged




bib


« Reply #391 on: November 12, 2009, 10:42:29 AM » 

Hi all, my WIP formula is not yet ready to add to the UF formula database but I've tidied it up a lot  not everything works yet (such as reordering the axes) but I think most will find it useable (unzip, copy all the text and paste into an open UF fractal window  needs UF5): http://www.fractalgallery.co.uk/MMFwip3D.zipThe UPR has quick example z^2+c quaternion renders  one solid on Analytical DE threshold and one on point trapping  note that pickover stalks do not produce good results on quaternions, try the other fractal types for those. Thanks so much David. Many hours of fun exploration to come



Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)



bib


« Reply #392 on: November 12, 2009, 10:48:31 AM » 



« Last Edit: November 14, 2009, 09:03:41 PM by bib, Reason: added the 2nd video »

Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)



Aexion


« Reply #393 on: November 12, 2009, 02:28:15 PM » 

Hello, This very simple iteration can produce some interesting results (in a very unoptimized C code): bool JuliaSimple(double x, double y, double z){ double radius,ny,nx,nz; unsigned char Counter; for(Counter=0;Counter<50;Counter++){ nx = x*xz*z0.27; nz = 2*x*z; ny=y; x=nz; y=nx; z=ny; radius=x*x+y*y+z*z; if (radius>1000) break; } if(radius>1000) return false; //its outside of the set else return true; //its on the set } These are two other C values: /*nx = x*xz*z0.285; nz = 2*x*z0.1;*/ /*nx = x*xz*z0.27; nz = 3*x*z;*/ here are two renders of this system: http://www.rfractals.net/gallery/main.php/v/JuliaSets/3DJulia1.htmlhttp://www.rfractals.net/gallery/main.php/v/JuliaSets/3DJulia2.htmlThe Mandelbrot of this series doesn't looks good but I have tested it on many other julia equations (such as the phoenix and the newton fractal) and it looks interesting.



Logged

 Fractals all the way.. Incendia for 3D Fractals Aural for Musical Fractals 



Buddhi
Fractal Molossus
Posts: 678


« Reply #394 on: November 12, 2009, 05:40:27 PM » 

Hello Aexion It is very nice to see new person in FractalForums. I saw your renderings and they looks very interesting. You have very strange iteration formula. It looks like z^2+c formula but with additional rotation by 90 degrees after each iteration. The results are awesome because there are visible lots of beautiful spirals.



Logged




iq
Guest


« Reply #395 on: November 12, 2009, 08:39:37 PM » 

I have some feedback to share. I implemented the polynomial version of the 8x rotation (it's slightly different than the Mathematicaone posted above  I did my own derivation based on the spherical coordinate system I'm using). The speed improvement in the CPU version was great (4 to 5 times faster). However, the GPU version runs equally fast, no speed gain at all between trigonometric or polynomial version. Still, it's very fast (interactive to realtime, depending on the resolution/quality settings) This is disappointing, and might be related to the fact that probably the trig functions are partially implemented by little texture lookups which are fast, while the polynomial version consumes lots of instructions (MADs). Of course I took into account that most terms in the polynomials where even, so only one square root is needed per iteration in the end. So conclusion is: big speed gains in CPU, but no speed gain in the GPU



Logged




Buddhi
Fractal Molossus
Posts: 678


« Reply #396 on: November 12, 2009, 09:21:56 PM » 

Since a couple of years ago I did a demo with a quaternion 4d julia set in realtime with ambient occlusion in the GPU (Kindernoiser: http://iquilezles.org/prods/#kindernoiser), I decided to port this little raymarcher of this morning to the GPU this afternoon. Results are promising, I get almost realtime rendering (5 frames per second) without the distance estimation optimization and some nonraytracebased ambient occlusion. Hi IQ It is nice surprise to see you in Fractal Forums. I know your 4k and 64k intros and 4kGfxExe from Demoscene (scene.org). I have never made any intro or demo but I have watched every demo from famous copyparties since I had my first Amiga 600. I can said that your 4kGfxExe are the best I know. I saw also your the newest Elevated 4kIntro. It is relay impressive ( http://ftp://ftp.scene.org/pub/parties/2009/breakpoint09/in4k/rgba_tbc_elevated.zip) I think we can learn a lot from you how to optimise fractal rendering and how use some capabilities like SSE, MMX, GPU. Of course if you would like to share some knowledge. Maybe we can also help you to improve your fractal intros



Logged




bib


« Reply #397 on: November 12, 2009, 09:56:13 PM » 

Hi This is a zoom in the picture I posted above, using David Makin's Mtrue3D formula



Logged

Between order and disorder reigns a delicious moment. (Paul Valéry)



iq
Guest


« Reply #398 on: November 12, 2009, 10:07:25 PM » 

For reference, if anybody want to try the GPU version, here goes the GLSL version of the iteration formula:
// // interate z > z^8 + c (trigonometric) // float zr = sqrt( dot(z,z) ); float zo = acos( z.y/zr ); float zi = atan( z.x,z.z );
zr = pow( zr, 8.0 ); zo = zo * 8.0; zi = zi * 8.0; z = zr*vec3( sin(zo)*sin(zi), cos(zo), sin(zo)*cos(zi) );
z = z + c; //
The coordinate axes and spherical coords are arranged like they teach you at school (and as OpenGL does): x=right, y=up, z=towards you. "zo" is the angle between the point/vector and the y axis, and zi is the angle between it's shadow in the xz horizontal plane and the z axis. After some maths in paper I got that:
cos(8x) = c^8 + s^8  28c^6s^2  28c^2s^6 + 68c^4s^4 sin(8x) = 8sc^7  8s^7c  56c^5s^3 + 56s^5c^3
where c=cos(x) and s=sin(x)
I think I didn't make any mistake, as images look identical to the ones rendered with the trigonometric version. After optimization it got quite ugly thou....:
// // interate z > z^8 + c (polynomic) // float zr2 = dot(z,z); float zq2 = dot(z.xz,z.xz); float izr2 = 1.0/zr2; float izq2 = 1.0/zq2;
vec4 k2 = vec4( izr2*z.y*z.y, izr2*zq2, izq2*z.z*z.z, izq2*z.x*z.x ); vec4 k4 = k2*k2; vec4 k6 = k4*k2; vec4 k8 = k4*k4;
float ko = izr2*z.y*sqrt(zq2); float ki = izq2*z.z*z.x;
float cozo8 = k8.x + k8.y  28.0*k6.x*k2.y  28.0*k2.x*k6.y + 68.0*k4.y*k4.x; float cozi8 = k8.z + k8.w  28.0*k6.z*k2.w  28.0*k2.z*k6.w + 68.0*k4.w*k4.z; float sizo8 = 8.0*ko*(k6.x  k6.y  7.0*k2.y*k4.x + 7.0*k2.x*k4.y); float sizi8 = 8.0*ki*(k6.z  k6.w  7.0*k2.w*k4.z + 7.0*k2.z*k4.w);
float zr8 = zr2*zr2; zr8 = zr8*zr8; z = zr8*vec3( sizo8*sizi8, cozo8, sizo8*cozi8 );
z = z + c; //
It's GLSL, should be easy to translate to HLSL, CG or simple plain C.



Logged




cKleinhuis


« Reply #399 on: November 12, 2009, 10:26:20 PM » 

Since a couple of years ago I did a demo with a quaternion 4d julia set in realtime with ambient occlusion in the GPU (Kindernoiser: http://iquilezles.org/prods/#kindernoiser), I decided to port this little raymarcher of this morning to the GPU this afternoon. Results are promising, I get almost realtime rendering (5 frames per second) without the distance estimation optimization and some nonraytracebased ambient occlusion. Hi IQ It is nice surprise to see you in Fractal Forums. I know your 4k and 64k intros and 4kGfxExe from Demoscene (scene.org). I have never made any intro or demo but I have watched every demo from famous copyparties since I had my first Amiga 600. I can said that your 4kGfxExe are the best I know. I saw also your the newest Elevated 4kIntro. It is relay impressive ( http://ftp://ftp.scene.org/pub/parties/2009/breakpoint09/in4k/rgba_tbc_elevated.zip) I think we can learn a lot from you how to optimise fractal rendering and how use some capabilities like SSE, MMX, GPU. Of course if you would like to share some knowledge. Maybe we can also help you to improve your fractal intros hi there iq, i do look forward for an amazing realtime 3d fractal demo, although i might be also in creating an own one for next years breakpoint perhaps we meet at the competition, and fractals will become a renaissance in the demo scene



Logged


divide and conquer  iterate and rule  chaos is No random!



Aexion


« Reply #400 on: November 13, 2009, 01:00:37 AM » 

Hello Aexion It is very nice to see new person in FractalForums. I saw your renderings and they looks very interesting. You have very strange iteration formula. It looks like z^2+c formula but with additional rotation by 90 degrees after each iteration. The results are awesome because there are visible lots of beautiful spirals. Thanks Buddhi, its nice to be here. About this iteration formula, you're right, its just a mix between the mandelbrot iteration and a normalized rotation matrix (that I have simplified for speed): nx = x*xz*z0.27; nz = 2*x*z0.1; ny=y; x=a*nx +b*ny+ c*nz; y=d*nx +e*ny+ f*nz; z=g*nx +h*ny+ i*nz; For some rotations, I get interesting 3d julias, but not for all.. many of them produces some sort of fractal potatoes.. Anyways, I'm still playing with them adding things like scaling and shearing, to see what happens.



Logged

 Fractals all the way.. Incendia for 3D Fractals Aural for Musical Fractals 



David Makin


« Reply #401 on: November 13, 2009, 01:10:40 AM » 

Hello Aexion It is very nice to see new person in FractalForums. I saw your renderings and they looks very interesting. You have very strange iteration formula. It looks like z^2+c formula but with additional rotation by 90 degrees after each iteration. The results are awesome because there are visible lots of beautiful spirals. On a similar theme it may be interesting to try "selfrotation" as well  performed like this in 2D complex (either pre or post the main iteration calculation): t = cabs(z) if t > 0 z = z*z/t endif Obviously one can use higher degrees of selfrotation i.e. rotate by multiples of "own angle". As an aside this method increases the overall amount of chaos in a system generally leading to more strangely attractive orbits.



Logged




cKleinhuis


« Reply #402 on: November 13, 2009, 04:13:53 AM » 

and welcome to aexion, i almost forgot to greet you to personally
aexion is the develop of incendia fractal renderer



Logged


divide and conquer  iterate and rule  chaos is No random!



fpsunflower
Forums Newbie
Posts: 4


« Reply #403 on: November 13, 2009, 07:47:10 AM » 

Hi everyone! Just wanted to share my experience rendering this fractal. I'm using the analytical DE method. You can easily write a trigfree iteration formula for arbitrary powers that updates both derivative and value at the same time once you implement multiplication with these "triplex" numbers. You just need to remember the formulas for adding angles: cos(a+b) = cos(a)*cos(b)  sin(a)*sin(b) sin(a+b) = sin(a)*cos(b) + sin(b)*cos(a)
Its a bit more expensive than iq's version because the square roots don't cancel out anymore, but its more flexible and still way faster than the trig version (10x for my java implementation). Another observation I haven't heard mentioned here yet: you can get semianalytic normals without central differencing by implementing a dual arithmetic version of the distance estimation routine. Its maybe a tiny bit faster, although the normal estimation is a tiny fraction of rendering time if you are shooting many rays. Its only semianalytic because its no more accurate than the "analytic" distance estimation is, but at least it gives you the true derivative to whatever precision you are calculating the distance with, without adding extra epsilons into your code. Here's an image I rendered (n=7, microfacet reflection model, image based lighting and depth of field): Finally a question: I'm using this formula for the distance estimate: return 0.5f * R * (float) Math.log(R) / dR;
Is the leading term 0.5 for all powers? Is the log supposed to be the natural log or the log in some other base? Does anyone have the reference to the explanation of how this formula actually works?



Logged




JosLeys


« Reply #404 on: November 13, 2009, 08:37:34 AM » 

You can easily write a trigfree iteration formula for arbitrary powers... Great! Could you give an example? you can get semianalytic normals without central differencing by implementing a dual arithmetic version of the distance estimation routine Sorry, I don't understand what you mean..Could you explain? I use the same distance formula for all powers: DE=R.ln(R)/dR, (so it is the base e log), but I advance the point on the ray by a fraction of DE. Normally 0.5 works, but sometimes I have to take something lower. The formula relies on the so called Hubbard Douady potential. See for instance http://iquilezles.org/www/articles/distancefractals/distancefractals.htm .



Logged




