Welcome to Fractal Forums

Fractal Software => Tutorials => Topic started by: mclarekin on December 04, 2014, 05:05:42 AM




Title: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 04, 2014, 05:05:42 AM
Here is a basic  tutorial modifying Mandelbulbers' standard Quarternion formula. Its for using openCL custom formulas in a basic way.


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 04, 2014, 05:12:12 AM
If it works and you use the parameters shown, the resulting shape should look like the attached render (at 800 x 600 with AO on my old i3 CPU 24seconds.)


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 04, 2014, 08:44:35 AM
This basic tutorial adds a box fold to the quarternion


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 04, 2014, 09:17:48 AM
Further on quarternion adding box fold tutorial
In the code below the box fold has been moved from after to in front of the quarternion part of the formula, file saved, recompiled, rendered and zoomed even further out.  The first quarternion tutorial started with just one parameter to tweek. Now we have six parameters to tweek and two locations for the box fold. The possibilities have increased greatly and yet the quarternion is still quite boring.

Code:
 

// quart abcd box fold v2 formula

int4 cond1, cond2;

cond1 = isgreater(z4, foldingLimit);

cond2 = isless(z4, -foldingLimit);

z4 = select(z4,  foldingValue - z4, cond1);

z4 = select(z4,  -foldingValue - z4, cond2);

zp = 2.0 * quaternionMul(z4, zp);
newz = quaternionSqr(z4);
z4 = newz + c4;
r = length(z4);
   


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 04, 2014, 11:24:14 AM
The last part of the Mandelbulber 1.21 quarternion opencl custom formula tutorial series. Be warned don't expect a happy ending.

Oops I forgot to change float rr = dot(z,z); to float rr = dot(z4,z4);

And you know what, it made no apparent difference to the image. Trial and error sorts out what works and what doesn't. Hmmm I wonder, maybe I should be calculating  r = length (z4) after the last transform (it this case should only change the colour I think).  Errors are easy for the impatient non-programmer.


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: cKleinhuis on December 04, 2014, 01:50:17 PM
cool, thank you for the walkthroughs


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: youhn on December 04, 2014, 08:09:00 PM
Love the reflective comments in between, like in just after the small tutorial "And still the quarternions remain quite boring"  ;D (which for me is true aswell). I've scanned through the documents and might not use them directly, but this topic has moved me to dive into the Mandelbulber code. Might be a nice activity during the evenings of wintersport, around newyear.


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 04, 2014, 11:28:54 PM
@Christian. Thanks for checking it out.  Hope it made sense, its really designed for people like me who try and use the OpenCL Custom formulas feature without any programing background ( so I avoided resolving DE issues and if/else loops.) With the aid of this forum I have learnt so much over the last year and had a lot of enjoyment. My early attempts I now find quite funny, plenty of bits of added code that I now realise didn't do anything or were full of mistakes.

@youhn. Thanks also for checking it out. It was your recent post that made me realise I now knew enough to share some of what I had learnt with custom formulas. Those other tutorials you have found will be very helpful, wish they had been around when I started. And yes I chose the boring old quarternion to demonstrate the failures that can be easily achieved.

@anyone. I am happy to make any changes if  my terminology is incorrect or what I wrote was wrong or difficult in translation.  Try following this with tutorial but starting with a menger and include Mandelbox rotation.


Title: Re: Quarternion Custom Formulas in OpenCL Mandelbulber 1.21
Post by: mclarekin on December 06, 2014, 02:08:48 AM
Even a humorous quarternion is quite boring