Logo by mclarekin - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 24, 2024, 04:03:19 AM


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]   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 1198 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: 7044


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
Fractal Lover
**
Posts: 206


« 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 Iambus
***
Posts: 895



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: 2512


Fragments of the fractal -like the tip of it


« 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

No sweat, guardian of wisdom!
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 15594 Last post May 05, 2010, 03:17:07 PM
by Power 8
More Formulas? Mandelbulb 3d The Rev 2 4019 Last post November 21, 2010, 11:51:25 PM
by The Rev
Rot Box formulas Mandelbulb 3d The Rev 7 4915 Last post December 21, 2010, 01:37:13 PM
by Power 8
Mandelbulber V2.05 extended formulas EXAMPLES Mandelbulber « 1 2 » mclarekin 23 8800 Last post October 29, 2015, 02:05:30 AM
by mclarekin
Mandelbulber V2.06 extended formulas EXAMPLES Mandelbulber mclarekin 10 5778 Last post December 06, 2015, 10:32:10 AM
by mclarekin

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.162 seconds with 25 queries. (Pretty URLs adds 0.01s, 2q)