Logo by simon.snake - Contribute your own Logo!
News: Visit UltraFractalWiki for hints & tutorials on UltraFractal5
 
*
Welcome, Guest. Please login or register. October 21, 2014, 08:59:02 AM


Login with username, password and session length



Pages: [1]   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: Need Help to try my own formulas with Mandelbulber  (Read 780 times)
0 Members and 1 Guest are viewing this topic.
no_gravity
Guest
« on: September 14, 2011, 11:13:21 PM »

Hello!

I tried Mandelbulber and it renders really great images!

I would like to try my own formulas. So far, I managed to compile Mandelbulber from source and run it.

I guess I have to change the formula in the code, "make all" and "./install" again and then run Mandelbulber and it will run with the changed formula?

Im not sure where in the code the Mandelbulb formula is. I tried to change the code after

switch(actualFormula)
{
 case trig_DE:
  ...

in fractal.cpp. But that doesnt seem to impact the default renderings.

Any hints?
Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 5654


formerly known as 'Trifox'


WWW
« Reply #1 on: September 14, 2011, 11:38:46 PM »

you need to rebuild the whole program after changing a line in the source code, there must be a "build.bat" file, just run it and the executable is generated with new code ....
but be sure to not destroy anything by "checking-in" .....

there exist a possibility to write formula codes "DIRECTLY IN ASSEMBLY CODE" what is a pain in the ass, but user darkbeam here is doing quite well on it wink

regards and hello to the forums
Logged

---

divide and conquer - iterate and rule - chaos is No random!
no_gravity
Guest
« Reply #2 on: September 15, 2011, 07:46:19 AM »

Recompiling works fine now. If there would be a function isInSet(x,y,z) that I could overwrite then i would be ready to go. Maybe this part of fractal.cpp is the formula that gets iterated:

                                double r1 = pow(r, p - 1);
                                double r2 = r1 * r;
                                double th = z.GetAlfa();
                                double ph = -z.GetBeta();
                                if (Mode == 0)
                                {
                                        double p_r1_rdz = p * r1 * r_dz;
                                        double ph_phdz = (p - 1.0) * ph + ph_dz;
                                        double th_thdz = (p - 1.0) * th + th_dz;
                                        CVector3 rot(th_thdz, ph_phdz);
                                        dz = rot * p_r1_rdz + one;
                                        r_dz = dz.Length();
                                        th_dz = dz.GetAlfa();
                                        ph_dz = -dz.GetBeta();
                                }
                                CVector3 rot(p * th, p * ph);
                                z = rot * r2 + constant;
                                r = z.Length();

Im not sure what this does though. I think maybe z contains the coordinates af the current voxel as z.x, z.y and z.z?
Logged
marius
Iterator
*
Posts: 197


« Reply #3 on: September 15, 2011, 08:02:46 AM »

If there would be a function isInSet(x,y,z) that I could overwrite then i would be ready to go.

Mandelbulber is a ray marcher; it traces the fractal surface based on distance estimation.
It does not render the fractal as a 3d voxel cloud.

Check out syntopia's excellent posts on this topic at http://blog.hvidtfeldts.net/
Logged
no_gravity
Guest
« Reply #4 on: September 15, 2011, 11:56:42 AM »

Ah, ok. So the formula first has to be transformed in some way?

What could be an easy way to try new formulas?
Logged
Buddhi
Fractal Molossus
**
Posts: 655



WWW
« Reply #5 on: September 15, 2011, 09:21:39 PM »

Hi

There are three types of formulas:
1) which uses analytic distance estimation: trig_DE, trig_optim (default)
2) IFS formulas and Mandelbox: menger_sponge, tglad, smoothMandelbox, kaleidoscopic, mandelboxVaryScale4D
3) rest of formulas, which uses "delta DE" algorithm for distance estimation

Third type of formula is the easiest for modification and doesn't need special knowledge about distance estimation, because it is done by external function.
So if you want to test your own formula, try to overwrite for instance hypercomplex formula:

Code:
case hypercomplex:
{
CVector3 newz(z.x * z.x - z.y * z.y - z.z * z.z - w * w, 2.0 * z.x * z.y - 2.0 * w * z.z, 2.0 * z.x * z.z - 2.0 * z.y * w);
double neww = 2.0 * z.x * w - 2.0 * z.y * z.z;
z = newz + constant;
w = neww;
r = sqrt(z.x * z.x + z.y * z.y + z.z * z.z + w * w);
break;
}

There are two very important variables:
z - iteration vector (z.x,z.y,z.z) which you use for your formula ( z = formula(z) )
r - length of iteration vector - must be calculated after formula calculation - needed for bailout checking. If formula is 3-dimensional you can use r = z.Length();

You can't implement there formula like isInSet(x,y,z), because there has to be possibility to estimate distance to fractal surface. The output of formula can't be binary. It has to return actual length of iteration vector, which is used for distance estimation function.

If you put there your formula and re-compile the program, you can test it by selecting "Hypercomplex" formula.

If you use third type of formula, you don't have to transform formula in any special way.

Adding of completely new formulas (by not overwriting) is much more difficult, because you have to make some additional changes in other parts of program.

Edit: there is third also important variable: constant which is c from e.g. z = z^2 + c formula.
« Last Edit: September 15, 2011, 09:23:23 PM by Buddhi » Logged

no_gravity
Guest
« Reply #6 on: September 16, 2011, 12:01:01 AM »

Hello Buddhi,

first of all congratulations on this great piece of software!

I dont know if its possible to fit my formula inside the existing loop. I tried it for a while, but to no avail. My formulas are not the usual z=z^2+c type of functions. They use different kind of data structures, different break conditions etc.

As an example, imagine the following function isInSet(x,y,z): Via a hash function, for each point(x,y,z) you create a position on a chess board. Then you let 2 programs play from that position. If white wins, the point is in the set.

Now when I want to squeeze that into the code for case hypercomplex, I would have to iterate on an iteration vector z. But thats not possible. Because the hash function I use to create a chess position from x,y,z is not reversible. So I cannot squeeze it back into z. And I have to calculate r, the length of the iteration vector. But what is the length of a chess position?

Or am I missing something?

I wrote my own simplistic raymarcher today. It gives me a first impression of my formulas. But I would loooove to render them in something as advanced as Mandelbulber.
Logged
DarkBeam
Global Moderator
Fractal Senior
******
Posts: 1666


The spaghetti formula coder


« Reply #7 on: September 20, 2011, 10:29:36 PM »

you need to rebuild the whole program after changing a line in the source code, there must be a "build.bat" file, just run it and the executable is generated with new code ....
but be sure to not destroy anything by "checking-in" .....

there exist a possibility to write formula codes "DIRECTLY IN ASSEMBLY CODE" what is a pain in the ass, but user darkbeam here is doing quite well on it wink

regards and hello to the forums

If you say so... shocked
Logged

Formulas are never too much (?)

Pages: [1]   Go Down
  Print  
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
has anybody tried using ifs formulas with the mandelbuld/mandelbox formulas? 3D Fractal Generation cKleinhuis 4 2549 Last post May 05, 2010, 03:17:07 PM
by Power 8
More Formulas? Mandelbulb 3d The Rev 2 1151 Last post November 21, 2010, 11:51:25 PM
by The Rev
Rot Box formulas Mandelbulb 3d The Rev 7 1838 Last post December 21, 2010, 01:37:13 PM
by Power 8
Formulas Mandelbulb 3d scheven_architect 5 1236 Last post April 28, 2011, 05:51:13 PM
by DarkBeam
Mandelbulb 3d formulas Mandelbulb 3d paolo 3 3867 Last post June 05, 2011, 02:37:58 PM
by cKleinhuis

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines

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