Welcome to Fractal Forums

Fractal Software => Mandelbulb 3d => Topic started by: M Benesi on October 25, 2015, 12:22:53 AM




Title: A few formulas (For Luca... :D)
Post by: M Benesi on October 25, 2015, 12:22:53 AM
  UPDATE:  For those of you who used the old formulas from this thread, I changed the names in this formula update.  Parameter files that you created using the old formula names will not work with the new formula names.  You can copy the parameters manually by having both formula names in your M3Formulas directory (folder).  

BT1Pine
 Pine 1.  The main formula, without bells and whistles.  It's transform 1 then a pine tree Mandelbulb.

BT1Pinegon  Same as above, allows rotations and polygonal transforms in between transform 1 and the pine tree Mandelbulb.  Rotations are before the circle to polygon transform.  If you want to try it in a different order... I'll explain below.

BT1Pinehedron  Similar to the Pinegon, it applies the polyhedral transform after T1 and the rotations, instead of the polygonal tranform.  

BT2Pine  Pine 2.  Transform 2 then a pine tree Mandelbulb.  Combined so you don't have to use 2 formula slots.  Actually, you can use just transform2, instead of transform 2 and the pine tree Mandelbulb (this combined formula) but it's a bit different (of course!).  

BPine_only  Just the Pine Tree Mandelbulb z^2.  Pretty plain.  I use BT1_Transform1, then other transforms, then this with only the x pixel component added in.  

_BPolygonFromCircle     I'm going to update its functionality at some point.  For now, it transforms circles centered on the x axis into polygons.   I'm thinking about putting a rotation (and possibly translation) in all of the geometric space transforms, so that the axis the transform is completed around can be changed (so you can transform stuff around the y or z axes, or any arbitrary axis (vector)).  

_BPolygonToCircle   This transforms regular polygons centered on the x axis with the midpoint of one face on the + y axis into circles.  It reverses the above transform.

_BPolyhedronFromSphere
  Transforms a sphere into a polyhedron.  The only regular polyhedron created is a cube, the tetrahedron is stretched along the x-axis (compared to a regular tetrahedron), and the simple way this formula works doesn't allow for multiple face shapes to be generated specifically for the other Platonic solids.

_BPolyhedronToSphere  Inverse of the above transform.  Makes a polyhedron into a sphere.  Works with the Menger to make it into a sphere (if you use it correctly) because the Menger is a cube.  If you want to change the shape of a Menger into another polyhedron, do the above transform, followed by this one (with sides and sides2 both equal to 4), then the Menger (click "repeat from here" in the Menger formula tab).

 _BStellahedronFromSphere   Stellated polyhedrons from sphere.  Still some work to be done, but it works nice with the BT1Pine, sides=6 , sides2=6, angle1~.9, angle2 ~???.

_BRotateFromMag  Rotate the whole coordinate system from the (-1,-1,-1) to (1,1,1) axis, to the x axis (-1,0,0)  to (1,0,0).  

_BRotateToMag   The inverse of the above formula.  Use these formulas if you want to try doing something around the mag axis, and then want to apply it to the pine tree Mandelbulb (BPine_only).  So.. rotate to mag, do your stuff, rotate from mag, pine tree Mandelbulb (BPine_only).

_BSkewXmaxV1  This adds to or subtracts from the x component in various ways, based on various things, to distort the T1 pine tree Mandelbulb fractal types in nice ways.  This formula is not complete, and if I don't get distracted, there will be an update with altered parameters which will be named V2 or V1.1 depending on what I change.


  _BT1_Transform1.  Rotate from x axis (-1,0,0) to (1,0,0), to magnitude axis  (-1,-1,-1) to (1,1,1).  Take absolute value.  Rotate back.  Multiply by scale, subtract offset from x.  Try this by itself, and Luca's switch YZ, if you want to see an asteroid.  Mix it with Mandelbulb or other formulas.  I'll have to add a BJustCoordinates.m3f so you can make a fractal out of just this transform- Mandelbulb 3D won't let you use just transforms to make an object, so if we make a "JustCoordinates" main formula, we'll be able to make things out of just the "transforms"....

_BT1_4D_clampXYZ  4 dimensional transform 1 which preserves the magnitude of x,y, and z so it doesn't introduce as much distortion to 3d fractals.

_BT1_4D_Transform1  4d transform 1.

_BT2_Transform2 makes the fractal "hollow", and gives you lots of neat little connected areas, and what not.  

_BT3_Transform3  Similar to t3, a bit less continuous.

_BT4_Transform4  Similar to both the above.

  Old formulas.rar has the old formula names, if you need them for some reason.  ;)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 25, 2015, 12:23:53 AM
never mind.  I'll zip em.

  Here are a few images (from images showcase thread) (http://www.fractalforums.com/index.php?topic=22567.msg88000#msg88000):

The 4th one is a bit better bigger.  Click any to enbiggen.  

(https://lh3.googleusercontent.com/-GX7d2FRnAVc/VisEbyw_fLI/AAAAAAAADQ0/VVgsxIglMcw/s640-Ic42/doy2.jpg) (https://lh3.googleusercontent.com/-GX7d2FRnAVc/VisEbyw_fLI/AAAAAAAADQ0/VVgsxIglMcw/s0-Ic42/doy2.jpg)

(https://lh3.googleusercontent.com/-0kT3i4qAr0E/Vir_CWtouII/AAAAAAAADQc/zZZafM2QEf4/s640-Ic42/doy.jpg)
 (https://lh3.googleusercontent.com/-0kT3i4qAr0E/Vir_CWtouII/AAAAAAAADQc/zZZafM2QEf4/s0-Ic42/doy.jpg)
  Parameters and formulas (for the above image) in this thread: http://www.fractalforums.com/index.php?topic=22123.msg87998#msg87998

(https://lh3.googleusercontent.com/-BoU8gAkkrl0/VisGOluC76I/AAAAAAAADRI/_AtWoYrZKCk/s640-Ic42/doy3.jpg)
 (https://lh3.googleusercontent.com/-BoU8gAkkrl0/VisGOluC76I/AAAAAAAADRI/_AtWoYrZKCk/s0-Ic42/doy3.jpg)
I should make another parameter set... here is for the next one.  Need the formulas from the thread.

Code:
Mandelbulb3Dv18{
g.....s/...c3...w....2....kuN9SddYUvz0AGSDGiNA1EHZ0uiHI9qzfEGGXEmD0VzA2atMI6l5sj
................................OFppo6qBF.2........A./..................y.2...wD
...Uz6....U3/.../M.0/.....kj....3/....E3.....YhlfusQh1nD/..........m0dkpXm1....U
./....kD12../..........wz.................................U0.....y1...sD...../..
.z1...sDpBCMhudpjwX0khd8V.A3zgJSFrJajDkjE59uBRVbRvfiSuGIfhC6z6oT/9BADpmDrwdB1fWw
KwHFoN28Npq8zKiJopj.m.mDU.....o82.............sD.6....sD..G.....................
.............oAnAt1...sD....z...........................................D....k1.
.....Ksulz1.......kz.wzzz1.U..6.P....Y2...EB....a/...s/....F....6/...I1.....SF52
...U.0aZczDM6/nzMg2czX6dE16.0c..jeDk..UoK/nl2xvj6sM93P58iz1...........U.8.UQgk0.
.wUmc2beYz1.dA8E5Exwz0........../EU0.wzzz1...........s/...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1...................................UTVR..y3q/yzz/k.1A..1Ak.vzDsnwF.UDn
5VTzThdht0kaqaPiQs5y3q/.sLM5s1bTsLM5.UTVRUDlyVTVR..y3q/yMw5y3q/.sLM5snqTsLM5.UTV
RUDkzVTVR..y3q/y...y3q/bzz/k.1Akyz1yATomxzpaqaff................................
E.E..I.B/3U.....I....6....UEZtKNnZ4IdtKNlsqPNd3.................................
...................../.........E................................................
................................................................................
.....................2.....3....0....6INiJqQd/JOiJKA.waQhB1.....................
...............................E..........2.....................................
................................................................................
................................/....E/...U.....0JaPZBLOI7LMiBbNj7LPn.EOY/......
................................nAnAnAnAvznAnAnAnAnyz..................CD02.....
.UnX.1.................CD02......UnX.1..........................................
..........................................U.....I....6....UEZtKNnZ4IdtKNlsqPNd3.
...................................................../.........E................
................................................................................
.....................................................2.....3....0....6INiJqQdFZQ
VtqQaxaQh71....................................................E..........2.....
................................................................................
................................................................}
{Titel: doy5}


(https://lh3.googleusercontent.com/-qDpCdZVLeBA/VisJS9N-ffI/AAAAAAAADRg/UBCKZG_XFtI/s800-Ic42/doy5.jpg) (https://lh3.googleusercontent.com/-qDpCdZVLeBA/VisJS9N-ffI/AAAAAAAADRg/UBCKZG_XFtI/s0-Ic42/doy5.jpg)

(https://lh3.googleusercontent.com/-Zr5P8pL-WXM/VisJWAkjFwI/AAAAAAAADRo/rPFcdH5uedA/s640-Ic42/doy4.jpg) (https://lh3.googleusercontent.com/-Zr5P8pL-WXM/VisJWAkjFwI/AAAAAAAADRo/rPFcdH5uedA/s0-Ic42/doy4.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 25, 2015, 02:21:16 AM
Thanks for the concise breakdown of the transforms.  If I had only weighted a day, this would have saved me having to piece it together from the original post. LOL.

I sometimes use these transforms in conjunction with other common  transforms  to hollow out  mandelbulbs

// Spherical Offset  (has a  "scale" included to control the size.)
      
Code:
CVector3 temp = z;
double tempAuxDE = aux.DE;
double lengthTempZ = -z.Length();
z *= 1 + sphericalOffset.offsetRadius / lengthTempZ;
z *= sphericalOffset.scale;
aux.DE = aux.DE * fabs(sphericalOffset.scale) + 1.0;
// Box offset
Code:
	{
CVector3 temp = z;
if (z.x > 0)
{
z.x = z.x + boxOffset.boxOffset.x;
aux.color += boxOffset.color.factor.x;
}
else
{
z.x = z.x - boxOffset.boxOffset.x;
aux.color += boxOffset.color.factor.x;
}
if (z.y > 0)
{
z.y = z.y + boxOffset.boxOffset.y;
aux.color += boxOffset.color.factor.y;
}
else
{
z.y = z.y - boxOffset.boxOffset.y;
aux.color += boxOffset.color.factor.y;
}
if (z.z > 0)
{
z.z = z.z + boxOffset.boxOffset.z;
aux.color += boxOffset.color.factor.z;
}
else
{
z.z = z.z - boxOffset.boxOffset.z;
aux.color += boxOffset.color.factor.z;
}
//weight function
if (boxOffset.control.weightEnabled)
{
z = SmoothCVector(temp, z, boxOffset.control.weight);
}
}
}


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 25, 2015, 04:57:39 AM
So I have transform1  called     BenesiMagTransform1 and I am wondering if this naming system would be appropriate for me to use on the four transforms?  There are now so many possibilities with these transforms that I will have to build a separate tab to run them all on. ( I was going to  just include them in an existing tab.)

Then I learn how to open a rar file ( I am new to Ubuntu) and open Transform1. I read your latest code and I note the changes and was wondering  is this one of those tricky mathematical "simplifications"  or an actual change in the formula.?


I am still exploring simply alternating  BenesiMagTransform1 code  and Pine Tree ( and other mandelbulbs) and adding other transforms, it may be weeks before I stop exploring and find time to code the other three  BenesiMagTransforms  :)

 As I have two z = z + (C * const.)  transforms on my tab I can set the first one to add x.pixel only for one iteration and have x,y,& z addition starting on second iteration, so at least that combination is easy for me to run. My DE gets bad on low powers so I may have to try Delta DE and /or drop the quality.  (Or more likely I have done something wrong!)



Code:
// STEP1: "Benesi transform 1"
tx=(x*sqrt(2/3)-z*sqrt(1/3))*sqrt(1/2);      //                  I note that  this block of code has changed?
z=abs(x*sqrt(1/3) + z*sqrt(2/3));   
x=abs(tx-y*sqrt(1/2));         
y=abs(tx+y*sqrt(1/2));                     

tx=x*sqrt(1/2)+y*sqrt(1/2);   //                optimise   tx =    ( x  + y ) *sqrt(1/2
y=-x*sqrt(1/2)+y*sqrt(1/2);  //                optimise  y =    ( x  + y ) *sqrt(1/2)
x=tx*sqrt(2/3)+z*sqrt(1/3);
z=-tx*sqrt(1/3)+z*sqrt(2/3);
x=scale*x-offset;  //scale =2    offset=2       
y=scale*y;
z=scale*z;


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 25, 2015, 05:50:55 AM
and I am wondering if this naming system would be appropriate for me to use on the four transforms? 
  hahaha...  I like it for numerous reasons.  :D 

Then I learn how to open a rar file ( I am new to Ubuntu) and open Transform1. I read your latest code and I note the changes and was wondering  is this one of those tricky mathematical "simplifications"  or an actual change in the formula.?
  Tricky...  Luca did it.   And the part you were talking about optimizing is.. probably optimized already in the assembly portion of the code.  The (assembly language) code looked pretty tight to me.  The main slowdown in a lot of formulas is atan2, cos, sin, and the like.  So... ya know. 

My DE gets bad on low powers so I may have to try Delta DE and /or drop the quality.  (Or more likely I have done something wrong!)
  I haven't looked into DE too much- from what I recall, it doesn't like discontinuous functions, which I work with a lot.  That may be the problem.  I don't know the implementation in M3D, so...  I will play more.




Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on October 25, 2015, 08:50:41 AM
Ahh finally some order ;) but too many formulas  :sad1:
Thanks so much but are they really necessary? :)
The transforms are ok. I would call BenesiPine0 the base formula (no folds) ... will look again later :)


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 25, 2015, 08:54:27 AM
Quote
  Tricky...  Luca did it.
     Hmmmm, simplified by Luca the Trickster. That rearranging  maths blows my mind.!!   I am glad I don't have to do it.

Aha, yes! Discontinuous functions, I didn’t think about that.   So maybe there will not be a whole tab devoted to these formulas unless Buddhi  can spare the time.  :sad1: I only know how to use basic DE.  The only active “real” programmers with Mandelbulber are Buddhi and Zebastian, and they already have a lot to do.  So it is unlikely that I will be able to replicate your amazing images just yet 

Anyway, I am going to code everything up and add it to Mandelbulber (and I want to test it with the MengerSponge).     BenesiMagTransform1 is already  cool in Mandelbulber,  I just have to avoid too much discontinuity.


Title: Re: A few formulas (For Luca... :D)
Post by: cKleinhuis on October 25, 2015, 10:18:45 AM
people, in my point of view the whole hybridisation process needs to be node based :D
in my tiny world a mandelbulb would consist of just the triplex formulas placed sequencially...
to be defined as node system and reusable as a base formula then ... and so on :D


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on October 25, 2015, 10:54:13 AM
I have found on the net precise approximations  (eps is 10e-5) of sine and cosine using roundint() that at least in my pc are a lot faster than normal sin(). Interested? :)
Atan is also approximable


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 25, 2015, 12:42:00 PM
Quote
to be defined as node system

At present all new Mandelbulber formulas are made from a sequential order of base transforms. So standard group:-  Mbox uses 4 i.e. boxFold, Spherical Fold, Scale and additionConstant.   Mbulb 2,  Quat 2.

So the iteration loop is made up of just single lines of code calling each base transform.

The complete trial formula is then made up with a selection of other transforms, as well as duplicate copies, so many combinations are possible to explore. Each transform  has an enable checkBox and stop/start iteration parameters.

The maybe mythical next stage is for building a loop with a dynamic array(s), where you drag & drop your transforms on the UI into your trial sequence.

But thinking nodes, hmmmm,  I start thinking, hmmmmmm,  it does not have to be just a single sequence. Node based thinking allows for parallel sequences of transforms, that can interact. Drag & drop & link  sounds much better. In OpenCL I tested running some transforms in parallel (learnt from chaosTube) then combining them as a weighted addition at some stage before the end of the loop (with only limited success). It would be much easier for me to test now that I can do some basic C++ code. The simplest form would have just simple Y joints to  “fork” and “combine”.  Easy to think about, but would take expertise and time.


@ Christian.  I am blindly assuming that is what a node system is ;D :embarrass: ;D

@ M.Benesi.   My detail level is bad. However, playing with all of BenesiMagTransformOne's variables,  produces all sorts of cool stuff when combined with mandelbulbs.  And I have  barely taken one step up the mountain of infinity) :) :)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 25, 2015, 06:22:48 PM
Ahh finally some order ;) but too many formulas  :sad1:
Thanks so much but are they really necessary? :)
The transforms are ok. I would call BenesiPine0 the base formula (no folds) ... will look again later :)
  I don't want to confuse people with too many options, but at the same time, each of the transforms create slightly different fractals.

  If we make the options part of a single transform formula, which allows people to select which transform they want from within the formula, I think the formula will run slower because of the conditionals.  I've run into problems with if/then statements adding a lot of compute time- but I think it might have been the compiler I was using, so maybe doing it in assembly won't create that problem?.

  So we could combine the transforms into one big formula, and then select which one we wanted to do from within the formula menu.

  The only active “real” programmers with Mandelbulber are Buddhi and Zebastian, and they already have a lot to do.  So it is unlikely that I will be able to replicate your amazing images just yet 

Anyway, I am going to code everything up and add it to Mandelbulber (and I want to test it with the MengerSponge).     BenesiMagTransform1 is already  cool in Mandelbulber,  I just have to avoid too much discontinuity.
  Ohh, I didn't know you were using Mandelbulber- I must have missed you saying that- I was wondering about the look of the tabs you were posting, I thought you wrote/hacked your own version of M3D.

  I have another formula to port to M3D (having problems with it!  assembly looks right!!  arghh...), but if I can compile code for Mandelbulber, I can probably port these formulas over after I get the stuff I am working on done. 

 
people, in my point of view the whole hybridisation process needs to be node based :D
in my tiny world a mandelbulb would consist of just the triplex formulas placed sequencially...
to be defined as node system and reusable as a base formula then ... and so on :D
  Well, these things don't have to be called Mandelbulbs.  :D  We can call them Mandelbulb's redneck cousin, the Mandelbubba. 


Title: Re: A few formulas (For Luca... :D)
Post by: cKleinhuis on October 25, 2015, 07:10:42 PM


    Well, these things don't have to be called Mandelbulbs.  :D  We can call them Mandelbulb's redneck cousin, the Mandelbubba. 

no, if the result is a mandelbulb it is a mandelbulb, the redneck cousins would occur as soon as anything is changed in the order, formula or values, e.g. add a rotate formula inside the scale+rotate+translate triplex ordering


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 25, 2015, 09:10:24 PM
  So, here are images from the transforms by themselves (each with their own settings, because they are different).

T1, by itself is a cube... (https://lh3.googleusercontent.com/-UxifAecbYW0/Vi01EW2hrXI/AAAAAAAADUk/ExkshVqSDIk/s280-Ic42/trans%2525201%252520alone.jpg).

T1, with yz switched;  T2 (scale 3.7, offset 1);  T3 (scale 1.7, offset 1.7);  T4 (scale 2, offset 1);
(https://lh3.googleusercontent.com/-lQbssECfUtI/Vi00x3nPu9I/AAAAAAAADUI/VYJV93zcR6c/s400-Ic42/trans%2525201%252520with%252520yz%252520flip.jpg)   (https://lh3.googleusercontent.com/-KPmBtnemw84/Vi00xpDGoNI/AAAAAAAADUM/uRHxfxaDgqs/s400-Ic42/trans%2525202%252520alone.jpg)
(https://lh3.googleusercontent.com/-g4TjwITjZsk/Vi00ybN2FsI/AAAAAAAADUQ/O8dy5FK6h6M/s400-Ic42/trans%2525203%252520alone.jpg)   (https://lh3.googleusercontent.com/-yy69cUd1dh8/Vi00yzUgGhI/AAAAAAAADUY/qhQesrILoas/s400-Ic42/trans%2525204%252520alone.jpg)

  So T2 and T4 are very similar (in fact, t3 may be adjustable to be like either!).  In fact... I'm thinking about T4 with different powers for the one part, because of something I saw Inigo Quilez do.


  So.. not sure yet Luca.  Different math is different math- different results are good.  If T2 can be eliminated?? 


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 26, 2015, 12:23:38 AM
@ M.Benesi

Quote
if/then statements adding a lot of compute time-

yes it starts to add up (especially with fractals that run a lot of iterations before termination.)   Mandelbulber_extended formula tabs are great for testing and exploring, but not for rendering animations. So after exploring I would hard code in a formula with all redundant if() functions removed, then render the animation.

Quote
I thought you wrote/hacked your own version of M3D.

Haha.  Way, way, WAAAAAY! out of my ability. Maybe in my dreams.  LOL

Quote
but if I can compile code for Mandelbulber

I don't yet know about the Non-DE formulas in Mandelbulber,  but if you tested your formulas in Mandelbulber first before adding them to that incredibly long list of M3D formulas, it would save me  a lot of time LOL
Adding BenseiMagTransformOne  would take you guys about 15minutes. For me it takes a lot longer, plus all my code has to be thoroughly  checked by the "real" programmers.

If you can use QT creator in Ubuntu, you can download dev Version 2.06 and you would see how simple it is to add transforms  (The simplification of  transform inclusion has been added since the current V2.05 release.  )


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 26, 2015, 04:08:12 AM
Well..  it would be a lot of work to shift stuff around, create a new partition, install Ubuntu, QT creator, etc.  Which I don't mind doing, but not feeling like jumping through those hoops at the moment.  

  If you've got an idea for an easier solution....   ;)  You know what.. I'll see if I can grab my dad's old laptop from him and install ubuntu on it.  It's slow...... but it works.  2 computers crunching fractals is better than one anyway, although I think it might be about half as fast as my 8 year old notebook that I'm working on now.  


  So I made a rotate to mag, and rotate back transform.  So you can do a Bulb, rotate to mag, do something along the lines of absolute value like one of the transforms, or maybe amazing box with absolute value or something, then rotate back.  

  What is weird is.. well, you'll see.
(https://lh3.googleusercontent.com/-0zRqp_hzAqM/Vi2XyCN1pSI/AAAAAAAADVw/XnMD-Otgv40/s400-Ic42/test%252520rotate%2525202.jpg)  (https://lh3.googleusercontent.com/--ebCE0apPG0/Vi2XyR6ve6I/AAAAAAAADV0/810xnzIrwg4/s400-Ic42/test%252520rotate.jpg)

  So the rotated one (I rotated and rotated back) change colors!  I'm wondering how M3D calculates colors... which I haven't explored yet.  


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 26, 2015, 05:02:29 AM
@ M.Benesi

earlier post T4 looks promising, like It is just waiting to be hybridised with a Menger or a MBox.  I think I will code that T4  tnext :)

I don’t know what is available in M3D, but i use a cheap method for varying Mbulb power (or any constant)

Extra parameters are just  are a single "start at/ stop at variable" iteration choice and the the amount Power Variable.

So it runs with the initial power until start variable,  does a linear increase (or decrease) until the stop variable iteration is met, then continues with the new power until termination. So you can make stop = start and have a sudden change or maybe choose a long transition.   As you know the big changes happen in the first few iterations, so i will run a pwr2 for maybe 1 or 2 iters, then increase.   Being linear it is cheap to run.

I  like using it with CVectors3 constants like "scale", because then I have the three independent scale parameters x, y & z,  So I can choose to scale just the x part for  a few iters, then transition it back to a scale of 1. I can have y increasing and z decreasing.  However the general rule is the more I tweak the lower the render quality.  And I am restricted by the how the DE calc copes with the extra parameters.

,





Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 26, 2015, 06:54:50 AM
@ M.Benesi

earlier post T4 looks promising, like It is just waiting to be hybridised with a Menger or a MBox.  I think I will code that T4  tnext :)
 nice.  :D  I'm currently trying to translate one formula... and having problems.  I'm missing some error in the assembly, tried various things.

  Anyway... if I get it to work, it will be nice... it'll add cool details to the existing pine trees.
here are ChaosPro images, It by itself, and blended with a bulb... it should be mixed with other things...

 (https://lh3.googleusercontent.com/-sOoRz5-avNU/Vi29NMKeTYI/AAAAAAAADXE/IqqbwJ9rpJU/s400-Ic42/chaospro%252520mag%252520xyz2.jpg) (https://lh3.googleusercontent.com/-FUy2Lo3J4Ek/Vi29NCtXGGI/AAAAAAAADXA/i76IiICWnrM/s400-Ic42/chaospro%252520mag%252520xyz2%252520blend.jpg)

Code:

  Chaospro..  followed by non-working M3D code....  
sx=sqr(sx);
sy=sqr(sy);
sz=sqr(sz);
r=((sx)+(sy)+(sz));

if (r!=0) {
d=18;     //18
dd=2; //2
b=2; //2
nx=(b*sx+r)*((d-dd)*sx-sy-sz)/((d+dd)*sx+sy+sz)+seed;   //seed = -.6
ny=(b*sy+r)*((d-dd)*sy-sx-sz)/((d+dd)*sy+sx+sz)+seed;  // after rotation = 2
nz=(b*sz+r)*((d-dd)*sz-sx-sy)/((d+dd)*sz+sx+sy)+seed;  // this is old code
}


[OPTIONS]
.Version = 2
.DEscale = 1
.SIpower = 2
.Double Seed = -.5
[CONSTANTS]
Double = 9
[CODE]
558BEC81EC300000005356578B75088B7E308BD8D9D0DD03D8C8DD5DF890DD02D8C8DD5DF090DD01D8C8DD5DE8d9d0DD45F8DC45F0DC45

E8DD5DE0d9d0DD45F8DC0FDC45F0DC45E8DD45F8DC0FDC65F0DC65E8DEF9DD45E0DC45F8DEC9DC47F0DC4618DD1BD9D0DD45F0DC0FDC45

F8DC45E8DD45F0DC0FDC65F8DC65E8DEF9DD45E0DC45F0DEC9DC47F0DC4620DD1AD9D0DD45E8DC0FDC45F8DC45F0DD45F0DC0FDC65F8DC

65F0DEF9DD45E0DC45E8DEC9DC47F0DC4628DD19D9D08BC35F5E5B8BE55DC20800
[END]


Description:

  mag xyz z^2 fast...


sx=sqr(sx);
sy=sqr(sy);
sz=sqr(sz);

r=((sx)+(sy)+(sz));

nx=(2*sx+r)*(16*sx-sy-sz)/(20*sx+sy+sz)+seed+pixel;
   //2, 16, and 20 can be variables
ny=(2*sy+r)*(16*sy-sx-sz)/(20*sy+sx+sz)+seed+pixel; // and probably should be variables to tell you the
nz=(2*sz+r)*(16*sz-sx-sy)/(20*sz+sx+sy)+seed+pixel;
// truth... for now, the code uses a simpler form:

nx=(sx+r)*(9*sx-sy-sz)/(9*sx+sy+sz)+seed+pixel;
   // until I get it to work...
ny=(sy+r)*(9*sy-sx-sz)/(9*sy+sx+sz)+seed+pixel;   // learning... assembly.. slowly.
nz=(sz+r)*(9*sz-sx-sy)/(9*sz+sx+sy)+seed+pixel;
   // .....

0100701E   55               PUSH EBP
0100701F   8BEC             MOV EBP,ESP
01007021   81EC 30000000    SUB ESP,30
01007027   53               PUSH EBX
01007028   56               PUSH ESI
01007029   57               PUSH EDI
0100702A   8B75 08          MOV ESI,DWORD PTR SS:[EBP+8]
0100702D   8B7E 30          MOV EDI,DWORD PTR DS:[ESI+30]
01007030   8BD8             MOV EBX,EAX
01007032   D9D0             FNOP


01007034   DD03             FLD QWORD PTR DS:[EBX]    load x
01007036   D8C8             FMUL ST,ST x*x
01007038   DD5D F8          FSTP QWORD PTR SS:[EBP-8] save to EBP
0100703B   90               NOP
0100703C   DD02             FLD QWORD PTR DS:[EDX]   y
0100703E   D8C8             FMUL ST,ST y*y
01007040   DD5D F0          FSTP QWORD PTR SS:[EBP-10] save to EBP
90   nop
01007043   DD01             FLD QWORD PTR DS:[ECX]
01007045   D8C8             FMUL ST,ST
01007047   DD5D E8          FSTP QWORD PTR SS:[EBP-18]


D9D0             FNOP
 DD45 F8          FLD QWORD PTR SS:[EBP-8]
DC45 F0          FADD QWORD PTR SS:[EBP-10]
DC45 E8          FADD QWORD PTR SS:[EBP-18]
0100704C   DEC1             FADDP ST(1),ST
0100704E   DD5D E0          FSTP QWORD PTR SS:[EBP-20]
01007051   D9D0             FNOP
01007053   DD45 F8          FLD QWORD PTR SS:[EBP-8]

558BEC81EC300000005356578B75088B7E308BD8D9D0DD03D8C8DD5DF890DD02D8C8DD5DF090DD01D8C8DD5DE8d9d0DD45F8DC45F0DC45

E8DD5DE0d9d0DD45F8

DC0FDC45F0DC45E8DD45F8DC0FDC65F0DC65E8DEF9DD45E0DC45F8DEC9DC47F0DC4618DD1BD9D0DD45F0DC0FDC45F8DC45E8DD45F0

DC0FDC65F8DC65E8DEF9DD45E0DC45F0DEC9DC47F0DC4620DD1AD9D0DD45E8DC0FDC45F8DC45F0DD45F0DC0FDC65F8DC65F0DEF9DD45E0

DC45E8DEC9DC47F0DC4628DD19D9D08BC35F5E5B8BE55DC20800

01007056   DC0F             FMUL QWORD PTR DS:[EDI]
01007058   DC45 F0          FADD QWORD PTR SS:[EBP-10]
0100705B   DC45 E8          FADD QWORD PTR SS:[EBP-18]
0100705E   DD45 F8          FLD QWORD PTR SS:[EBP-8]
01007061   DC0F             FMUL QWORD PTR DS:[EDI]
01007063   DC65 F0          FSUB QWORD PTR SS:[EBP-10]
01007066   DC65 E8          FSUB QWORD PTR SS:[EBP-18]
01007069   DEF9             FDIVP ST(1),ST
0100706B   DD45 E0          FLD QWORD PTR SS:[EBP-20]
0100706E   DC45 F8          FADD QWORD PTR SS:[EBP-8]
01007071   DEC9             FMULP ST(1),ST
01007073   DC47 F0          FADD QWORD PTR DS:[EDI-10]
01007076   DC46 18          FADD QWORD PTR DS:[ESI+18]
01007079   DD1B             FSTP QWORD PTR DS:[EBX]
0100707B   D9D0             FNOP
0100707D   DD45 F0          FLD QWORD PTR SS:[EBP-10]
01007080   DC0F             FMUL QWORD PTR DS:[EDI]
01007082   DC45 F8          FADD QWORD PTR SS:[EBP-8]
01007085   DC45 E8          FADD QWORD PTR SS:[EBP-18]
01007088   DD45 F0          FLD QWORD PTR SS:[EBP-10]
0100708B   DC0F             FMUL QWORD PTR DS:[EDI]
0100708D   DC65 F8          FSUB QWORD PTR SS:[EBP-8]
01007090   DC65 E8          FSUB QWORD PTR SS:[EBP-18]
01007093   DEF9             FDIVP ST(1),ST
01007095   DD45 E0          FLD QWORD PTR SS:[EBP-20]
01007098   DC45 F0          FADD QWORD PTR SS:[EBP-10]
0100709B   DEC9             FMULP ST(1),ST
0100709D   DC47 F0          FADD QWORD PTR DS:[EDI-10]
010070A0   DC46 20          FADD QWORD PTR DS:[ESI+20]
010070A3   DD1A             FSTP QWORD PTR DS:[EDX]
010070A5   D9D0             FNOP
010070A7   DD45 E8          FLD QWORD PTR SS:[EBP-18]
010070AA   DC0F             FMUL QWORD PTR DS:[EDI]
010070AC   DC45 F8          FADD QWORD PTR SS:[EBP-8]
010070AF   DC45 F0          FADD QWORD PTR SS:[EBP-10]
010070B2   DD45 F0          FLD QWORD PTR SS:[EBP-10]
010070B5   DC0F             FMUL QWORD PTR DS:[EDI]
010070B7   DC65 F8          FSUB QWORD PTR SS:[EBP-8]
010070BA   DC65 F0          FSUB QWORD PTR SS:[EBP-10]
010070BD   DEF9             FDIVP ST(1),ST
010070BF   DD45 E0          FLD QWORD PTR SS:[EBP-20]
010070C2   DC45 E8          FADD QWORD PTR SS:[EBP-18]
010070C5   DEC9             FMULP ST(1),ST
010070C7   DC47 F0          FADD QWORD PTR DS:[EDI-10]
010070CA   DC46 28          FADD QWORD PTR DS:[ESI+28]
010070CD   DD19             FSTP QWORD PTR DS:[ECX]
010070CF   D9D0             FNOP
010070D1   8BC3             MOV EAX,EBX
010070D3   5F               POP EDI
010070D4   5E               POP ESI
010070D5   5B               POP EBX
010070D6   8BE5             MOV ESP,EBP
010070D8   5D               POP EBP
010070D9   C2 0800          RETN 8



[/code]


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 26, 2015, 12:46:37 PM
Playing with BenesiMagTransformOne is too distracting. I am sure I should be doing something else :)


A BenesiMagTransformOne test

 BenesiMagTransformOne is set for late starting, so is missing during first iteration, therefore it's influence is greatly reduced.

Using  two transforms:-

    BenesiMagTransformOne (scale.xyz = 2, offset.x = 2, start itr = 1)
    Standard MB pwr9   +C = ( c.x *1.0,  c.y *0.4,  c.z * 0.2)

Three loop sequences:-

Image 1)  NO Benesi!
{
Mbulb;
}

Image 2)  BenesiMbulb loop
{
Benesi;
Mbulb;
}

Image 3) BenesiMagTransformOne is enclosed in an additional transform.
{
tempC = z;
Benesi;
z += tempC; // TODO  * someConstantModifierParameter;
Mbulb;
}

Number 2 gets my vote!


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 26, 2015, 05:46:35 PM
Hey... the real test is for the pow 2.  Pow 2 Mandelbulbs are pretty boring, for the most part.  Try doing a power 2 (all the images I've been posting have been z^2... pow 2).

  For other things (this requires more formulas to be used, using up valuable tabs!).  If you want to hybridize an Amazing Box with a Bulb, rotate to mag, _amazing box (no c!!, scale ~1.7), rotate back, pine tree bulb no YZ.  The rotations, plus not adding in the x component make it more interesting.  

  Still... I like just the plain old Pine1 no x, pine 1, pine 1 no x *2, transform 2,3,4  (4 is.. well, very nice)... etc. 



Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 26, 2015, 10:17:43 PM
and Luca is going to kill me... :tongue1:  T5 is on board.  I wanted to do a trick that I learned from Inigo Quilez's website- to make things a bit more "square" and sharp.  

  (https://lh3.googleusercontent.com/-PWgANU0-WWc/Vi6WWX2W5UI/AAAAAAAADYA/X2STaFFJycs/s640-Ic42/T5b%2525203noyz%2525202xyz.jpg)


  Still, I need to edit descriptions of these transforms.  Will do so soon.  Downloaded Mandelbulber, have some stuff to do this afternoon, but might figure out how to transfer the formulas later tonight, or tomorrow.  

  T5 is attached....  I think I used ~1.7,1.7 for the image.. I forget.  attached its param file because.... I forget.:D


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 27, 2015, 02:49:07 AM
My Slow Progress

So far  I have learnt that Delta DE works for all fractals so I can now render  discontinuous functions. Cool, but takes a lot longer to render :sad1:.

I  can do the bensei pinetree with my existing tab as I have two Multi-Mbulbs Transforms in my loop,  So I simply  “zero”  C.y & C.z with a 0.0 constant multiplier in Mbulb number 1. So alternating Ptx, Ptxyx,. ….

I also have two copies of BenseiMagTransformOne in the loop.  ( I should have coded all your transforms by now, plus the fast non-trig PWR2 PineTrees, but I enjoy exploring more than coding, and I get sidetracked easily.)

I am thinking about turning  BenseiMagTransformOne into three separate transforms (a bit slower but more possibilities for exploring),

mag forward;
z = abs(z);   // will try replace with z = abs( z + const.A ) - abs ( z - const.B ) - z;
mag back;

I am currently sidetracked with the “mag” transform and want to try and find where I can use it without being slowed down with DeltaDE. Defiantly the beauty is with the PWR2 PineTee but I am sure “mag” transform will be useful in all sorts of fractal formulas.

Oh know!!  T5 already!! I coding is getting waaaay behind.  :)



Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 27, 2015, 02:55:02 AM
Using Multiple C values

Many fractals are made up of  more than one transform, the last being the adding of C pixels.

I call the the current z value prior to an individual transform in the loop, a new tempC “pixels”. Hence I can apply a different tempC to each transform that makes up the “fractal”.

In making image 3 I used a BenseiMagTransformOne and placed it as transform number 18 in the iteration loop, ( with 1 - 17 disabled). So In my terminology BenseiMagTransformOne is T18 and it produces z18 Cvector. The previous z leading into this transform is called c18. So at the end of the transform the addition of a pixel component was ;-

 z18 += c18; 

If I also enable transforms T4, T5 & T6,  then for c18 I have the choice of

 c18 = c4, c5, c6 or original Cpixels   or a modified combinations of tempC's.

e.g.  a chaotic tempC could be  c18  = ( c4.x + c5.x,  atan(c6.y/c4.y), sin(c6.z /(c4.x + c5.y))); and would create a mess, but keeping it simple works in some cases.

This approach can cause massive discontinuity, and if I had not recently learnt to use DeltaDE, it would be un-renderable.

Simply by applying a constant multiplier to c18, I can dictate it's influence on z18. So image 2 is just image 3  with constant multiplier set to 0.0 (I.e no “c18” influence).

I will now forget about this subject, and try and catch up with my coding. ;D


Title: Re: A few formulas (For Luca... :D)
Post by: ericr on October 27, 2015, 08:38:47 AM
your fractal are wonder full !
is it possible to make apollonian gasekt wih it ?
inormaly yes, like all but how amazingisf  donest work , your farctal are not isf

thx  for your big job and answering if you want


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 27, 2015, 01:49:57 PM


Coded the fast Pinetree pwr2.  It sure is beautiful ;D


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on October 27, 2015, 05:03:51 PM
Strange. I remember it more "fat" not empty inside. But I may be wrong ;)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 27, 2015, 05:12:43 PM
  Good Job Mclarekin!  You can use the code you used to make that as a template to do the other transforms.  I left out the bulb portion for the other transforms.


  Luca- increasing the offset makes it more "hollow" on the inside. 


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 27, 2015, 05:56:51 PM
your fractal are wonder full !
 Thank you again!
is it possible to make apollonian gasekt wih it ?
 (repeat from other thread)  I did something like that a while ago- I don't recall the exact steps, but I think I did a spherical inversion of T2.

  I think T2 and T4 are basically the spaces around the spheres in a Apollonian sphere packing with a large central sphere.

  Basically ended up with a sphere in the center, instead of space, and lots of spheres around it instead of having the space in between the spheres.  At first glance, I don't see a ready made formula in M3D to do the spherical inversion that I did...  I think I did it in Fragmentarium??

  I don't think it was super interesting, but it might be interesting hybridized with other fractals, so if I can figure out how to port it to M3D (having a bit of trouble with some assembly language, because I hadn't written in assembly until this past week), we can try it out.


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 27, 2015, 08:54:47 PM
So I created  Benesis_Tranforms UI, it has 35 transforms, so far only five of them being Benesi.  My image had an extra  normal addC and a little bit of spherical offset.


 BenesiMagFormulaOne is such a cool fold on its own. The basic cube can be changed into lots of interesting geometric shapes :) :) :) :) :) :) :).

Using DeltaDE is slow but  the rewards are certainly worth it. Thanks  guys . :beer: :beer: :beer:




Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 28, 2015, 09:30:43 AM

This is C++ versions,  ( WARNING McLarekin code may contain mistakes, bad coding and un-optimisations.)

benesiFastPwr2PineTree
Code:
    CVector3 temp = z;
    z *= z;
    double t = 2 * temp.x/sqrt(z.y + z.z);
    z.x = (z.x - z.y - z.z) + c.x * benesiFastPwr2PineTree.constantMultiplierVect.x;
    z.z = (t * (z.y - z.z)) + c.y * benesiFastPwr2PineTree.constantMultiplierVect.y;
    z.y = (2 * t * temp.y * temp.z)  + c.z * benesiFastPwr2PineTree.constantMultiplierVect.z;

benesiMagTransformOne
Code:
    CVector3 temp = z;
    CVector3 tempV1;
    CVector3 newZ;
    tempV1.x = z.x * 0.81649658092772603273242802490196 - z.z * 0.57735026918962576450914878050196;
    newZ.z = z.x * 0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196;
    newZ.x = (tempV1.x  - z.y) * 0.70710678118654752440084436210485;
    newZ.y = (tempV1.x  + z.y) * 0.70710678118654752440084436210485;
    newZ.x = fabs(newZ.x);
    newZ.y = fabs(newZ.y);
    newZ.z = fabs(newZ.z);
    tempV1.x = (newZ.x + newZ.y) * 0.70710678118654752440084436210485;
    newZ.y = (-newZ.x + newZ.y) * 0.70710678118654752440084436210485;
    newZ.x = tempV1.x * 0.81649658092772603273242802490196 + newZ.z * 0.57735026918962576450914878050196;
    newZ.z = -tempV1.x * 0.57735026918962576450914878050196 + newZ.z * 0.81649658092772603273242802490196;
    z = benesiMagTransformOne.scale * newZ - benesiMagTransformOne.offset; // applying six variables:-  scale.x, scale.y, scale.z,  offset.x, offset.y, offset.z


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on October 28, 2015, 09:53:15 AM
Question! Why don't you use constants :)


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 28, 2015, 12:39:44 PM
Because I wanted to be able to reproduce images I had made in Mandelbulber OpenCL versions.

I like to explore with the constants being variable. And if I ever did  morph animation I would  need it that way.

Attached images I think are all just the BenesiMagTranformOne with the variables adjusted. No pineTree. :)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 28, 2015, 04:51:47 PM
  Looks good.  I stuck with single offsets and scales, instead of vectors, because I thought they introduced too much variety, but actually... sort of cool.  Nice work!

  Try doing a y-z switch after T1, and see what you get for the same values above... might be interesting.  

This is C++ versions,  ( WARNING McLarekin code may contain mistakes, bad coding and un-optimisations.)
 It is easy to read.  I like that.  :D  

To make T2,T3,T4,T5b, change the central part  (first one below is T4).  

Code:
    CVector3 temp = z;
    CVector3 tempV1;
    CVector3 newZ;
    tempV1.x = z.x * 0.81649658092772603273242802490196 - z.z * 0.57735026918962576450914878050196;
    newZ.z = z.x * 0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196;
    newZ.x = (tempV1.x  - z.y) * 0.70710678118654752440084436210485;
    newZ.y = (tempV1.x  + z.y) * 0.70710678118654752440084436210485;

//  Change this for different transforms   This is T4:
    newZ.x = fabs(newZ.z * newZ.z + newZ.y * newZ.y - benesiMagTransform4.offset.x) * benesiMagTransform4.scale.x ;
    newZ.y = fabs(newZ.z * newZ.z + newZ.x * newZ.x - benesiMagTransform4.offset.y) * benesiMagTransform4.scale.y ;
    newZ.z = fabs(newZ.x * newZ.x + newZ.y * newZ.y - benesiMagTransform4.offset.z) * benesiMagTransform4.scale.z ;

    tempV1.x = (newZ.x + newZ.y) * 0.70710678118654752440084436210485;
    newZ.y = (-newZ.x + newZ.y) * 0.70710678118654752440084436210485;
    newZ.x = tempV1.x * 0.81649658092772603273242802490196 + newZ.z * 0.57735026918962576450914878050196;
    newZ.z = -tempV1.x * 0.57735026918962576450914878050196 + newZ.z * 0.81649658092772603273242802490196;
    z = newZ ; // applying six variables:-  scale.x, scale.y, scale.z,  offset.x, offset.y, offset.z

  So put these in the middle section for T3 and T5b.  
Code:
//For T3:
    newZ.x = fabs(fabs(newZ.z) + fabs(newZ.y) - benesiMagTransform3.offset.x) * benesiMagTransform3.scale.x ;
    newZ.y = fabs(fabs(newZ.z) + fabs(newZ.x) - benesiMagTransform3.offset.y) * benesiMagTransform3.scale.y ;
    newZ.z = fabs(fabs(newZ.x) + fabs(newZ.y) - benesiMagTransform3.offset.z) * benesiMagTransform3.scale.z ;

//  I don't know how optimized the compiler you're using is??  if  x^8 = x^2; x^2; x^2;... it's good.  I also don't know
// if you can do 4th roots, so I did 2 square root operations in a row.  Don't know the name of the square root command
//  so I used sqrt(x), although it might be fsqrt(x) or gorgleflummuxmopmop(x), for all I know...
// for T5b:

// I wrote the pow function into this... if you want to try it.. original is below.
//  with pow:
    newZ.x = fabs(sqrt(sqrt(pow(newZ.z,8) + pow(newZ.y,8))) - benesiMagTransform5.offset.x) * benesiMagTransform5.scale.x;
    newZ.y = fabs(sqrt(sqrt(pow(newZ.z,8) + pow(newZ.x,8))) - benesiMagTransform5.offset.y) * benesiMagTransform5.scale.y;
    newZ.z = fabs(sqrt(sqrt(pow(newZ.x,8) + pow(newZ.y,8))) - benesiMagTransform5.offset.z) * benesiMagTransform5.scale.z;

// no pow:

    newZ.x = fabs(sqrt(sqrt(newZ.z^8 + newZ.y^8)) - benesiMagTransform5.offset.x) * benesiMagTransform5.scale.x;
    newZ.y = fabs(sqrt(sqrt(newZ.z^8 + newZ.x^8)) - benesiMagTransform5.offset.y) * benesiMagTransform5.scale.y;
    newZ.z = fabs(sqrt(sqrt(newZ.x^8 + newZ.y^8)) - benesiMagTransform5.offset.z) * benesiMagTransform5.scale.z;



Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 28, 2015, 09:30:42 PM
I  was wondering why there were no vectors :)

Now you know why my progress on T2, T3 etc has been slow. It is because T1 is soooooooooooooo much fun. ;D
So placing a T1  as first or second position in a loop has a dramatic influence on any fractal, and it can be easily controlled with the six variables.

The Benesi_Transforms UI  already had the transforms to build a Mbox so I tested it last night, cool.

I have yet to cut & paste a  menger into the UI  but I suspect that it will keep me interested for a while.

So with my code, with  Pt XYZ I simply zero cx and cy then I have  PTnoYZ .

T1 will eventually be divided into three transforms.  so that I can drop "anything"  into the middle to experience the mag folds ;D








Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 28, 2015, 11:53:02 PM
  The problem with separating the rotations from the transforms, at least for M3D, is that it takes up 3 formula slots to do a single transform.

  So I like to have them combined.  It's even better, for some cases, to have them combined with the Pine Tree Mandelbulb formula (like Luca did with transform 1), without the y and z pixel components (although I could just build multipliers into the formula, like you did). 

  So, for M3D, the project is to get the pixel multiplier components added in.  Also, maybe add different scale and offset for each variable, although that is a bit more work for assembly than it is for C or Delphi... and I've already ran into some problems with creating assembly formulas that should have worked fine, but ended up doing weird stuff. 


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 29, 2015, 03:00:55 AM

Thank you for the coding, it is the converting where I make my most mistakes.  Now if you would only  put  a space, before and after, your  + = - *,   I would just have to  cut & paste. ;D


 Another great thing about these magTransforms is they uses the same controls (scale & offset). so I can use the same groupbox template for each one. :D

 
Quote
so I used sqrt(x), although it might be fsqrt(x) or gorgleflummuxmopmop(x),

it is the last one.LOL

Wait a minute I will have to check,  yep,     sqrt(x).

and I guess its exp(  x, n )   for powers. I could be wrong. Until I added the “start @  iter/ stop @ iter “controls, I had been avoiding more expensive functions in the transforms. 

Your Pinetrees are great examples to demonstrate how a single transform iteration placed early  in the loop, makes  a huge change to the fractal. So  running an expensive transform once, instead of 10 - 40 iterations, makes a big saving..

As I don't do maths well any more, can you tell me this:-

I render a BenesiMagTranformOne  then change the global view of the fractal to get it aligned with x,y,z axis by applying rotations  of 90 degrees to x_axis and about 35 degrees to the y_axis.

  Do you know what this angle actually is or how it is derived? :hmh:

Cheers




Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 29, 2015, 06:13:10 AM
Thank you for the coding, it is the converting where I make my most mistakes.  Now if you would only  put  a space, before and after, your  + = - *,   I would just have to  cut & paste. ;D

  Didn't know about the space.  You got it.  Actually.. I'll go back and check, did the +,-, and *.... not the equals.  Seriously?  What language requires this for special characters?  Or are you teasing me (which would be totally fine, just curious)?

it is the last one.LOL
 Yeah.  I've never been able to figure out why they use sqrt(x) instead of gorgleflummuxmopmop(x) in some of these new compilers.  It makes no sense.  Anyway, we'll just have to deal with the weird terminology, such as sqrt(x), when dealing with square roots, because of the way the compilers are written.

and I guess its exp(  x, n )   for powers. I could be wrong. Until I added the “start @  iter/ stop @ iter “controls, I had been avoiding more expensive functions in the transforms.  
 Ok, so you'll have to try out different things.  If it's C++ (I saw a lot of .cpp files in the source)... pow!!!!   pow(x,n);
http://www.cplusplus.com/reference/cmath/pow/

  If it's Delphi (I recently read that something was written in Delphi- it might be M3D???), then it depends on what libraries are included...  There is a big Delphi reference library here. (http://www.efg2.com/Lab/Library/Delphi/index.html)

I render a BenesiMagTranformOne  then change the global view of the fractal to get it aligned with x,y,z axis by applying rotations  of 90 degrees to x_axis and about 35 degrees to the y_axis.

  Do you know what this angle actually is or how it is derived? :hmh:
  I know what the angle is called (and it can be found in many things- I found it in a fractal I was playing with years ago).  I was trying to face the fractal square on, and I moved around until I was zoomed exactly at a certain point.  Then sometime later I found out what the angle was....

  It's:  https://en.wikipedia.org/wiki/Magic_angle    (the Wikipedia article on tetrahedral molecular geometry is also interesting, if you feel like reading a bit further)

   Technically, we use 90 - the magic angle (pi/2 - acos(1/sqrt(3)) for our first rotation, and 45, aka pi/4, for our second.

  I tried the other rotation method of using a single rotation (just using the magic angle), around a vector from (0,-1, 1) to (0,1,-1), and I can't recall specifically why I picked this one.  I think I liked the 2 rotation method more.. or maybe it was easier to implement.  To tell you the truth, I think the single rotation method looked slightly different, so I had to rotate around the x axis first anyway to achieve the same effect???  It was over a year ago.. maybe I didn't implement the single rotation method correctly.  I can't remember.  
  
  The transforms, by themselves, don't change with the rotations.  The rotations are to align the Mandelbulb and the transforms so that they work well together....  :shrug:


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 29, 2015, 07:36:03 AM
the spaces are for readability, with my poor eyesight on my laptop screen.

ooops,  pow(x,n) seems much better LOL. You have been warned, I am a magnet for  mistakes.  Apparently www.cplusplus.com is good for those who can understand that stuff.

The "magic_number"  O0 O0 O0. 

H'mmmmm  :hmh:, I cannot get T2 to work, can you see anything wrong?

Code:
//benesiMagTransformTwo  3D
void benesiMagTransformTwoTransform3D(const sTransformBenesiMagTransformTwo &benesiMagTransformTwo, CVector3 &z, int i)
{
  if (benesiMagTransformTwo.control.enabled && i >= benesiMagTransformTwo.control.startIterations && i < benesiMagTransformTwo.control.stopIterations)
  {
    CVector3 temp = z;
    // STEP1: "Benesi fold 2"
    double tx = (z.x * 0.81649658092772603273242802490196 - z.z * 0.57735026918962576450914878050196) *  0.70710678118654752440084436210485;
    z.y = z.y * 0.70710678118654752440084436210485;
    z.z = (z.x *0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196) * (z.x * 0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196);
    tx = (tx - z.y) * (tx - z.y);
    double ty = (tx + z.y) * (tx + z.y);

    z.x = fabs(sqrt(ty + z.z) - benesiMagTransformTwo.offset.x) * benesiMagTransformTwo.scale.x;
    z.y = fabs(sqrt(tx + z.z) - benesiMagTransformTwo.offset.y) * benesiMagTransformTwo.scale.y ;
    z.z = fabs(sqrt(tx + ty) - benesiMagTransformTwo.offset.z) * benesiMagTransformTwo.scale.z ;

    tx = z.y + z.x;
    z.y = z.y - z.x;
    z.x = z.z * 0.57735026918962576450914878050196 + tx * 0.81649658092772603273242802490196;
    z.z = z.z * 0.81649658092772603273242802490196 - tx * 0.57735026918962576450914878050196;


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 29, 2015, 11:37:57 PM
So T2 didnt work T4 didnt work, so I had an excuse to stop and have fun instead.

So we drop T1 into a Menger_ Sponge_ UI with fast LinearDE.  Hmmmm  seems  a bit  tricky with the DE, just have to find what works.

Working with the Menger I begin  to see that  T1 is  a fast non-trig rotation to the mag axis and back with something  happening in between, with an  amazing amount of shapes formed from the variables parameter controls. MEGA COOL.  (Correct me if I am wrong).

Some of the possibilities T1 & Menger





Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 30, 2015, 12:54:22 AM
Very cool with the T1.  By itself, if you switch the variables afterwords... does some neat stuff.  I like what you did with the Menger...

  Not sure why T2 and T4 don't work... I'll look at your implementation of T2 a bit later- still planting a whole bunch of ground cover, and snuck away to check out fractal stuff.  :D


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 30, 2015, 01:04:45 AM
the spaces are for readability, with my poor eyesight on my laptop screen.
 Ok..  I'll try to keep that in mind.  

The "magic_number"  O0 O0 O0.  
 Magic angle spin, it's what we do to make the Mandelbulb work, just like they do it in solid state Nuclear Magnetic Resonance....

H'mmmmm  :hmh:, I cannot get T2 to work, can you see anything wrong?
 Yes.... yes I can.  :D  :p  You forgot to multiply by square root of .5 (at the bottom).... I fixed it.  I might have missed something else.  I better get back to gardening before the sun goes down.   Thanks for the fun!  

   I'm pretty sure I coded T4 for you up above... ??  I'll be back.  :D

Code:
//benesiMagTransformTwo  3D
void benesiMagTransformTwoTransform3D(const sTransformBenesiMagTransformTwo &benesiMagTransformTwo, CVector3 &z, int i)
{
  if (benesiMagTransformTwo.control.enabled && i >= benesiMagTransformTwo.control.startIterations && i < benesiMagTransformTwo.control.stopIterations)
  {
    CVector3 temp = z;
    // STEP1: "Benesi fold 2"
    double tx = (z.x * 0.81649658092772603273242802490196 - z.z * 0.57735026918962576450914878050196) *  0.70710678118654752440084436210485;
    z.y = z.y * 0.70710678118654752440084436210485;
    z.z = (z.x *0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196) * (z.x * 0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196);
    tx = (tx - z.y) * (tx - z.y);
    double ty = (tx + z.y) * (tx + z.y);

    z.x = fabs(sqrt(ty + z.z) - benesiMagTransformTwo.offset.x) * benesiMagTransformTwo.scale.x;
    z.y = fabs(sqrt(tx + z.z) - benesiMagTransformTwo.offset.y) * benesiMagTransformTwo.scale.y ;
    z.z = fabs(sqrt(tx + ty) - benesiMagTransformTwo.offset.z) * benesiMagTransformTwo.scale.z ;

  // you forgot the square root of .5....
    tx = (z.y + z.x) * 0.70710678118654752440084436210485;    //was  tx = z.y + z.x;  
    z.y = (z.y - z.x) * 0.70710678118654752440084436210485;    //was   z.y = z.y - z.x;
    z.x = z.z * 0.57735026918962576450914878050196 + tx * 0.81649658092772603273242802490196;
    z.z = z.z * 0.81649658092772603273242802490196 - tx * 0.57735026918962576450914878050196;


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 30, 2015, 04:30:55 AM

T4 is based on T1 with the applications of constants moved. So it should work.  but I just get some parallel cylinders instead of the Apollonian gasket looking thing  that you had for T2 & T4.

T2, I rewrote, it now has tempV1 and newZ, so  looks similar to the others. To me the problem should be in the first few lines, it is quite different to T1 & T4.


Code:
{
    CVector3 temp = z;
    CVector3 tempV1;
    CVector3 newZ;
    // STEP1: "Benesi fold 2"
    tempV1.x = (newZ.x * 0.81649658092772603273242802490196 - newZ.z * 0.57735026918962576450914878050196) *  0.70710678118654752440084436210485;
    newZ.y =  newZ.y * 0.70710678118654752440084436210485;
    newZ.z = (newZ.x * 0.57735026918962576450914878050196  +  newZ.z * 0.81649658092772603273242802490196) * (newZ.x * 0.57735026918962576450914878050196  +  newZ.z * 0.81649658092772603273242802490196);

    tempV1.x = (tempV1.x - newZ.y) * (tempV1.x - newZ.y);
    tempV1.y = (tempV1.x + newZ.y) * (tempV1.x + newZ.y);

    newZ.x = fabs(sqrt(tempV1.y + newZ.z));  // missing some brackets
    newZ.y = fabs(sqrt(tempV1.x + newZ.z));
    newZ.z = fabs(sqrt(tempV1.x + tempV1.y));

    newZ = (newZ - benesiMagTransformTwo.offset) * benesiMagTransformTwo.scale;

    tempV1.x = (newZ.y + newZ.x) * 0.70710678118654752440084436210485;
    newZ.y =   (newZ.y - newZ.x) * 0.70710678118654752440084436210485;
    newZ.x = newZ.z * 0.57735026918962576450914878050196 + tempV1.x * 0.81649658092772603273242802490196;
    newZ.z = newZ.z * 0.81649658092772603273242802490196  - tempV1.x * 0.57735026918962576450914878050196;


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 30, 2015, 05:07:38 AM
ooops missing some brackets in previous post.

Now the magTransform box has 9 spots on each face. ;D

Code:
 
    //newZ.x = fabs(newZ.x);
    //newZ.y = fabs(newZ.y);
    //newZ.z = fabs(newZ.z);
    newZ.x = fabs( newZ.x + benesiMagTransformOne.offset.x) - fabs( newZ.x - benesiMagTransformOne.offset.x ) - newZ.x ;
    newZ.y = fabs( newZ.y + benesiMagTransformOne.offset.y) - fabs( newZ.y - benesiMagTransformOne.offset.y ) - newZ.y ;
    newZ.z = fabs( newZ.z + benesiMagTransformOne.offset.z) - fabs( newZ.z - benesiMagTransformOne.offset.z ) - newZ.z ;
    //newZ = fabs( newZ + benesiMagTransformOne.offset) -  fabs( newZ - benesiMagTransformOne.offset )  -   newZ ;


    tempV1.x = (newZ.y + newZ.x) * 0.70710678118654752440084436210485;
    newZ.y =   (newZ.y - newZ.x) * 0.70710678118654752440084436210485;
    newZ.x = newZ.z * 0.57735026918962576450914878050196 + tempV1.x * 0.81649658092772603273242802490196;
    newZ.z = newZ.z * 0.81649658092772603273242802490196 - tempV1.x * 0.57735026918962576450914878050196 ;
    z = benesiMagTransformOne.scale * newZ; //- benesiMagTransformOne.offset;


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on October 30, 2015, 05:40:17 AM
and if you want a lot of control over fabs()  albeit slower , you insert this instaed

Code:
//  fabsFormulaABCD   z = fabs(  z + const.A ) - fabs(  z - const.B )  + (  z * const.C  +  const.D );  3D
void fabsFormulaABCDTransform3D(const sTransformFabsFormulaABCD &fabsFormulaABCD, CVector3 &z, int i)
{
if (fabsFormulaABCD.control.enabled && i >= fabsFormulaABCD.control.startIterations && i < fabsFormulaABCD.control.stopIterations)
{
CVector3 temp = z;
CVector3 tempA = z * 0;
CVector3 tempB = z * 0;
if (fabsFormulaABCD.fabsFormulaABCDEnabledAx)
{
tempA.x = fabs(z.x + fabsFormulaABCD.fabsFormulaABCDA.x);
}
if (fabsFormulaABCD.fabsFormulaABCDEnabledBx)
{
tempB.x = fabs(z.x - fabsFormulaABCD.fabsFormulaABCDB.x);
}
z.x = tempA.x - tempB.x + (z.x * fabsFormulaABCD.fabsFormulaABCDC.x + fabsFormulaABCD.fabsFormulaABCDD.x);
if (fabsFormulaABCD.fabsFormulaABCDEnabledAy)
{
tempA.y = fabs(z.y + fabsFormulaABCD.fabsFormulaABCDA.y);
}
if (fabsFormulaABCD.fabsFormulaABCDEnabledBy)
{
tempB.y = fabs(z.y - fabsFormulaABCD.fabsFormulaABCDB.y);
}
z.y = tempA.y - tempB.y + (z.y * fabsFormulaABCD.fabsFormulaABCDC.y + fabsFormulaABCD.fabsFormulaABCDD.y);
if (fabsFormulaABCD.fabsFormulaABCDEnabledAz)
{
tempA.z = fabs(z.z + fabsFormulaABCD.fabsFormulaABCDA.z);
}
if (fabsFormulaABCD.fabsFormulaABCDEnabledBz)
{
tempB.z = fabs(z.z - fabsFormulaABCD.fabsFormulaABCDB.z);
}
z.z = tempA.z - tempB.z + (z.z * fabsFormulaABCD.fabsFormulaABCDC.z + fabsFormulaABCD.fabsFormulaABCDD.z);



Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on October 30, 2015, 06:30:49 AM
eeeek!   :D  Did some frags (Fragmentarium code clean ups) today.. brain is tired.  Keep up the good work. 


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on November 01, 2015, 04:39:31 AM
Set up the Benesi_Transforms UI with a magFoward at the beginning with a magBack half way down and lots of transforms in between. Was interesting when I used the UI  to recreate T1 out of five transforms, as there was not much increase in render time.

Checked out your .frag, looks good, with a lot of parameters to tweak O0. I will update the Benesi_Transforms UI by moving scale functions to the middle.
I have got 38 transforms in that UI now, including Menger, Mbulbs, & Mbox,  ugh, I need to do some pruning.

And I must see if I can get the DE calc working ( generally outside my ability.)

Dropped the nine spot magTransform into T2s spot for now. Defaults:    Scale =  3.0's  and offset = 1.0s.

It is not as much fun  as T1.

Code:
    CVector3 temp = z;
    CVector3 tempV1;
    CVector3 newZ;
    tempV1.x = z.x * 0.81649658092772603273242802490196 - z.z * 0.57735026918962576450914878050196;
    newZ.z = z.x * 0.57735026918962576450914878050196  +  z.z * 0.81649658092772603273242802490196;
    newZ.x = (tempV1.x  - z.y) * 0.70710678118654752440084436210485;
    newZ.y = (tempV1.x  + z.y) * 0.70710678118654752440084436210485;

    newZ *= benesiMagTransformTwo.scale;
    newZ = (fabs( newZ + benesiMagTransformTwo.offset) -  fabs( newZ - benesiMagTransformTwo.offset )  -   newZ) ;

    tempV1.x = (newZ.y + newZ.x) * 0.70710678118654752440084436210485;
    newZ.y =   (newZ.y - newZ.x) * 0.70710678118654752440084436210485;
    newZ.x = newZ.z * 0.57735026918962576450914878050196 + tempV1.x * 0.81649658092772603273242802490196;
    newZ.z = newZ.z * 0.81649658092772603273242802490196 - tempV1.x * 0.57735026918962576450914878050196 ;

    z = newZ;



Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 01, 2015, 06:17:09 AM
Set up the Benesi_Transforms UI with a magFoward at the beginning with a magBack half way down and lots of transforms in between. Was interesting when I used the UI  to recreate T1 out of five transforms, as there was not much increase in render time.
  Cool.  The rotations don't use trig functions, since we use precalculated square roots and the like... and the z^2 pine tree is all algebra too.  Makes it fast. 

And I must see if I can get the DE calc working ( generally outside my ability.)
  DE is pretty easy for this one. Keep a running derivative, multiply by the transforms scale.. if you use a non-vector scale!  To do the vector scale like you're doing, you're going to need to do some fancy footwork...


  T1 really is a good base to go from.. then throw another one in there every once in a while.  I'm liking t4 the most now, but might switch back to T2... should add that to the .frag.  Still learning the frag stuff...


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on November 01, 2015, 11:23:23 AM
I have been just having fun with the magTransforms on there own, but  attached is random examples  with Mbox, Mbulb and Menger_Sponge.

A bonus is using magForward & magBack  to orientate the fractal to vertical symmetry.

DE calcs are more than halving render times ;D O0.

Well when making a basic scale transform I came across this fancy footwork problem. And  considered  Laplace & Lagrange but in the end decided on summing the components and dividing by three. ;D

Cheers


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 01, 2015, 05:35:26 PM
lol.. the one on the right looks quite amusing... although I am easily amused at times.  :D 
Well when making a basic scale transform I came across this fancy footwork problem. And  considered  Laplace & Lagrange but in the end decided on summing the components and dividing by three. ;D
I was thinking the length of z divided by three, tested it, didn't work... didn't do your thing.  nice that that works.  Can add it to other things...


Title: Re: A few formulas (For Luca... :D)
Post by: ericr on November 02, 2015, 10:10:48 PM
Where are "magTransforms on there own, but  attached is random examples  with Mbox, Mbulb and Menger_Sponge." for mandelbulb3d

ericr

 


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on November 04, 2015, 04:32:39 AM
@ M.Benesi  summing  fabs(scale. x y & z) /3 will  work when scale.x, scale.y & scale.z are the  similar, I have yet to retest when they are dissimilar.

Added six variables   for  pow( ) in T5B. Have yet to test.

 I recoded all the transforms, learning from your code that I can do   z  = CVector3 ( maths   , maths  , maths   ); ;D
Spent all of yesterday fixing the bugs I had then created, sometimes I wish I was born an android, it is that human factor that causes me problems.LOL

And  now I should retro-fit rotations. 


 So I currently  now have all these transforms/formulas working in Mandelbulber ;D


 
Code:
void benesiMagForwardTransformOneTransform3D(const sTransformBenesiMagForwardTransformOne &benesiMagForwardTransformOne, CVector3 &z, int i);
void benesiMagBackTransformOneTransform3D(const sTransformBenesiMagBackTransformOne &benesiMagBackTransformOne, CVector3 &z, int i);

void benesiMagTransformOneTransform3D(const sTransformBenesiMagTransformOne &benesiMagTransformOne, CVector3 &z, int i, sExtendedAux &aux);
void benesiMagTransformOnePlusMinusTransform3D(const sTransformBenesiMagTransformOnePlusMinus &benesiMagTransformOnePlusMinus, CVector3 &z, int i, sExtendedAux &aux);
void benesiMagTransformTwoTransform3D(const sTransformBenesiMagTransformTwo &benesiMagTransformTwo, CVector3 &z, int i, sExtendedAux &aux);
void benesiMagTransformThreeTransform3D(const sTransformBenesiMagTransformThree &benesiMagTransformThree, CVector3 &z, int i, sExtendedAux &aux);
void benesiMagTransformFourTransform3D(const sTransformBenesiMagTransformFour &benesiMagTransformFour, CVector3 &z, int i, sExtendedAux &aux);
void benesiMagTransformFiveBTransform3D(const sTransformBenesiMagTransformFiveB &benesiMagTransformFiveB, CVector3 &z, int i, sExtendedAux &aux);

void benesiFastPwr2PineTreeTransform3D(const sTransformBenesiFastPwr2PineTree &benesiFastPwr2PineTree, CVector3 &z, CVector3 &c, int i, sExtendedAux &aux);




Title: Re: Help?
Post by: M Benesi on November 04, 2015, 06:39:45 AM
  Nice coloring...  Since this is the help thread....


  Update.  Having a bit of problems with the coding the assembly portions.  I probably did something silly.  Not sure about the jmps and conditionals, since I'm not used to assembly.

  Anyway, posting the code in this thread for Luca (or anyone who wants to debug it) to look at.  I'll hack at it more tomorrow. 

  I might be dividing in the wrong order.. (fdiv or fdivr???) or.. maybe I added a command after the jump command... haha.. I don't know.  Tired.


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 04, 2015, 07:45:50 AM
Awesome... I'm adding the cube to sphere and sphere to cube to M3D.   


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 04, 2015, 11:55:17 AM
Finally had time to look at your works! ;)

1) The transforms look OK but the DEoption must be different. That should be the reason why the images look bad currently.
2) Some of your formulas are a mystery to me; why they look like a quaternion? (No visible fractal detail)
Why redo IQbulb?
Why IQpinetree looks like a tricorn? Probably sign mistake/flipped Cx and Cy?

Some work is needed. And transforms need a _ prefix before too. :dink:

PS Have you got a non-trigonometric expansion for IQ formula (even just for power 2)? Would be greatly appreciated!!! ^-^


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 04, 2015, 06:19:10 PM
Here I simplified a bit spheric (less temporary stuff & grouped some multiplications) + I will rename it with a _ prefix, added proper DE option (works perfect) :dink:
The only way to see which is good (div or divr?) is to test it directly with ollydbg; put two numbers in the stack and see which works each time or you will pick the wrong one ;D

Code:
[OPTIONS]
.Version = 2
.DEoption = -1
.Double Scale = 0.81649658092773
[CODE]
558BEC81EC300000005356578B75088B7E308BD8D9D0DD02D8C8DD55F8DD01D8
C8DD55F0DEF9D9E8D8D9DFE080E4417E04D9E8DEF1D9E8DEC1D9FADD5DE890DD
45F8DC45F0DD03D8C8DEF9D9E8D8D9DFE080E4417E04D9E8DEF1D9E8DEC1D9FA
DC4FF0D9C0DC4DE8DD5DE8DD5DF090DD03DC4DF0DD02DC4DE8DD01DC4DE8DD19
DD1ADD1BD9D08BC35F5E5B89EC5DC20800
[END]


Description:

Warps a cube to a sphere; transform made by M.Benesi, optimized by
Luca.

/ spheric  code
 rCyz= (z.y*z.y)/(z.z*z.z);
 rCxyz= (z.y*z.y+z.z*z.z)/(z.x*z.x);
if (rCyz<1.) {rCyz=sqrt(rCyz+1.);} else {rCyz=sqrt(1./rCyz+1.);}
if (rCxyz<1.) {rCxyz=sqrt(rCxyz+1.);} else {rCxyz=sqrt(1./rCxyz+1.);}

z.yz*=rCyz;  
z*=rCxyz/sr32;
[/code]


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 05, 2015, 05:56:36 AM
You're awesome Luca.  Thanks!

  I'm going to try to flip that code for the unSpheric option after I finish this sphere to tetrahedron transform I'm working on.  For the cool "squares" you do Transform 1 (not pine tree!), unspheric, pine tree, spheric, on whatever iteration you want the cubes to appear.

  I'm working on a sphere to tetrahedron transform... and will probably make a tetrahedron to sphere as well.  With those, we will be able to blend Sierpinski and a Menger, with other stuff... :D




Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 05, 2015, 07:58:07 AM
Here is the "unSpherical" .m3f


  Do a pine tree or 2, T1, this, Pinetree x pixel, spherical, repeat...  for a few squarey sections.  :D



Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 05, 2015, 08:27:46 AM
 :beer:
I am curious: difference between spheric/unspheric? :dink: edit! Got it just that the sqrt(...) becomes 1/sqrt(...) ;)
Editedit: Nope... I will keep your version as mine fails! :D A form of allergy perhaps? :sad1:
Going to update "my" formula file now!
Pls reply to my questions above too O0


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 05, 2015, 11:03:55 AM
Finally had time to look at your works! ;)
I thought you were talking about Mclarekin.. sorry.  lol.. This thread is all over the place.  

1) The transforms look OK but the DEoption must be different. That should be the reason why the images look bad currently.
 Ok, I probably need a few pointers. ;)  maybe I should re-read stuff that you've told me..but I get caught up in stuff and miss it.  Sooo....  I might not set the DEoption things correctly.

  I did make a DE version for Fragmentarium (just do scale of Transforms, then standard .5*log(r)*r/dr (dr*scale for the transform iterations, *power for the pine tree section, etc...).

2) Some of your formulas are a mystery to me; why they look like a quaternion? (No visible fractal detail)
 Ok.  The "no YZ" ones don't have the y and z pixel component added in, which is why they look a bit like a spun Mandy.  What I need to do is change them, so they have pixel multipliers in the formula.  Then all of the extra formulas, like pine treeX  (which is only x pixel!) and PineTree1noYZ (no y z... only x, but it HAS the transform with it.  You need only pine tree, without transform 1, for certain things like the following:
(https://lh3.googleusercontent.com/-5wAakP__9iA/VjsfkwY5CkI/AAAAAAAADeQ/vGfCxK58YqM/s480-Ic42/square%252520big2.jpg) (https://lh3.googleusercontent.com/-5wAakP__9iA/VjsfkwY5CkI/AAAAAAAADeQ/vGfCxK58YqM/s1024-Ic42/square%252520big2.jpg)
Code:
Mandelbulb3Dv18{
g.....S....O/...w....2....kFvS./.....980zxzzzr1EIqupJ0QfnwHS4trZ.ruAzAZrFKNa3U.E
................................OaNaNaNadz1........A./..................y.2...wD
...Uz6....k2..../MU0/.....ke....2/....E3.....QzIXLua2PrD/..........m/dkpXm1....U
z.....kD12../..........wz.................................U0.....y1...sD...../..
.z1...sDECayXi7lax1..........WjJy0vma8djv8jrnNkXyq9YXdzcPGgNzEEnhwuma8dj2oQ9jigd
GuHyKt9g9PeYyYmQF6ua2PqDU.....2J..............sD.6....sD..G.....................
.............oAnAt1...sD....zw1.........................................A....k1.
.....Ksulz1.......kz.wzzz1.U..6.P....U5...EB....m....c3....F....6/...I1.....SF52
...U.qFG9yzb2zzzRYoWzz7lz16.pc..zXCc..kvrEtMc7xD6ocyFE0ujz1..........2.28.kFrA0.
.Ub96aAIVz9.1se7Umvxz0........../EU0.wzzz1...........s/...................E.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1...................................2CcN/UvNPcveeWCNq0.yRiibHJJUk1f..XR
SvBmx3CcN/UvNPcvQsLsUa3.ibhVi1bTV1OK.sSq4uCly3CcN/UvNPcvMwLsUa3.ibhVinqTV1OK.sSq
4uCkz3CcN/UvNPcv..EsUa3feeWCNqGQIJ36wk8EwyLsUa3f................................
E....ME/F3U.....I....6....UEZtKNnZ4Jm3aPnNqPmpKA................................
...................../.........E................................................
................................................................................
.....................2.....3..../....6INiJqQdlIRX3KJiB3QcJaQdB4.................
..............................zD................................................
................................................................................
................................/....E/.........0JaPZBLOEZaPZV3.EZ4SZl4.........
........................................U.2.....................................
................................................................................
..........................................E.....I....2....UEZtKNnZqIkVKNmZqM.A4.
...................................................wz...........................
................................................................................
.....................................................A.....3....0....6INiJqQd/JO
iJKAixKKO/.....................................................E..........2.....
................................................................................
................................................................/....E/...U.....
0JaPZBLOI7LMiBbNj7LPo.....................................................2.....
...wz...........................................................................
............................................................................}
{Titel: square}


 
Why redo IQbulb?
Why IQpinetree looks like a tricorn? Probably sign mistake/flipped Cx and Cy?
Accident.  I used IQ for a template for pinetree or something, and I made a mistake, and it was an old version of the bulb (the flat one, shaped like a 2d Mandelbrot).  It might be unnecessary- I don't use it, although it would be good to mix it in if we had one or 2 more formula tabs to play with... then it would add more details.

Some work is needed. And transforms need a _ prefix before too. :dink:
 K...  I saw that... I just didn't get around to changing them before I got them up.  A bit excited, I suppose.  Apologies.  

PS Have you got a non-trigonometric expansion for IQ formula (even just for power 2)? Would be greatly appreciated!!! ^-^

  K...  I will do tomorrow, time for sleep almost!  Original IQ, or one of my mistakes?  I think IQ pinetree was to make a non-z^2 pine tree for higher powers.... to mix with transforms and stuff.  


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 05, 2015, 11:15:16 AM
Oh and I have found this old thread - a cousin of your fractal? The formula is very different though ;D (edit not really - almost identical hehe ;) )

http://www.fractalforums.com/theory/the-christmas-tree-3d-mandelbrot-set/

 :beer:

Also; I think "_FoldingTetra3D" can be ok as a base for your tetrahedral project... look at it :)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 05, 2015, 06:21:44 PM
THATS WHAT HE CALLED IT!!    I thought he called it pine tree....  that's why I kept calling it pine tree... it does look like one a bit.  

  Christmas tree, not pine tree... hahaha...  

  I did switch the y and z coordinates for symmetry (it is slightly more symmetric with y and z switched)....

  I will check ________Folding_tetra_3d... and rename formulas (you can if you have mod editing power) with _ for transforms.  Might need to name transforms something other than T_1 through T_n...


"Note that this code does NOT affect the Menger-type formulas."   For the tetra.  It does affect them if you do it in between unsphere and sphere transforms, but it's not the type of thing I was going for.

  Ohh, and the scale factor for the sphere and unsphere?  Should default to 1 in the formulas to be correct- I thought the sphere was the wrong size, but it wasn't- and it really shows up when you mess with the tetra formula!  That's a quick change in the options!


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 06, 2015, 12:31:24 AM
Tetra transform is almost same as Menger fold but weaker (reason why Menger prevails ;) )


Title: Re: Help?
Post by: M Benesi on November 07, 2015, 06:11:11 PM
Luca-
  Should I use the CL register for loops if I save ECX somewhere, or should I use AL instead since ECX is used for z? 
  Would this code snippet (assuming I have to use AL, and use defined Option work?

Code:
MOV	AL, INTEGER PTR DS:[EDI-10]   // assuming it's the bottom (lowest?? in OPTIONS definition) user defined option, is INTEGER a class??? or is it QWORD still??
//  OR should I point towards QWORD, and EDI shifted a bit to point at Integer values???

L1:
<LOOP-BODY>
DEC AL
JNZ L1


Title: Re: Help?
Post by: DarkBeam on November 07, 2015, 07:33:08 PM
Hmm no... never do that use AL or AH instead
Or use a temp like that:
Dec dword ptr:[ebp...]
Jg (begin of cycle)


Title: Re: Help?
Post by: M Benesi on November 07, 2015, 09:28:59 PM
  UPDATE  CUBE TYPE WAS WRONG.. WILL COMPLETE UPDATE LATER!!! SORRY FOR THE SHODDY WORK!!!


 Thanks!   Also... would the code that I posted work?  I guess I have to try.  :D


  Here Luca..   I put pixel multipliers in these, so that we don't have to use an additional formula to remove pixel components.

  The Square Type does what it says in the description: T1, unSpheric (sphere to cube), Pine Tree, Spheric so you don't have to use a bunch of formula tabs.  Use it alternating with the other formulas for cool stuff.

  If you do a few T1s first, square type, a couple of Pine Tree 1, loop it....   it really squares it up.  

  So you can take out the "no yz" versions of Pine1, Pine2, and PineX and PineXYZ.  


Title: Re: Help?
Post by: M Benesi on November 08, 2015, 12:00:57 AM
Also, worked on mag vs. xyz, which can be used as a transform with Pine Tree.  It's the fast, algebraic version.  Slower than Transform 1 (lots more math!!), not as smooth, but... it's slightly interesting by itself.  Might as well have it around:

(https://lh3.googleusercontent.com/-aYWkx2_IvdE/Vj6CCnP9GCI/AAAAAAAADhc/2pwtIlRCnhY/s640-Ic42/magxyzswithsquares.jpg) (https://lh3.googleusercontent.com/-aYWkx2_IvdE/Vj6CCnP9GCI/AAAAAAAADhc/2pwtIlRCnhY/s1024-Ic42/magxyzswithsquares.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 13, 2015, 04:55:29 AM
I added an option to the T1 with Pine Tree, so that you could do multiple T1s in one formula.  It allows you to do some of the things I've been doing recently.  


  Next project is to work on the polygonator and non-polygonator- extend the spheric functions to allow a little bit more stuff.  Still have not figured out the correct regular Tetrahedron- I might have done it.. but I can't tell.

  I'm probably going to have to ask Knighty for help, after I clean up the code a bit.  It might sound silly, but I really want to combine a Sierpinski tetrahedron with a Menger cube... so need cube to sphere (we have that), sphere to tetra (we have that, but the tetrahedron is not regular!!!), tetra to sphere (I think I can do that), then sphere to cube.  


  Also, made a 4d hyperspheric, 4d unhyperspheric, although I think the math is incorrect so will hold off on posting til I check them- might be my assembly, maybe I did the incorrect order of operations, or maybe it just doesn't really work that well.

  4d Transform 1 is also included (it works), with an optional version that preserves the original magnitude of x,y, and z, while still altering details a bit.  I don't think either does a lot, but it makes the extension of Tn (T1,T2,T3...) to higher dimensions a little easier to understand, since they all use magic angle rotations.  It does change the fractals a bit, and maybe mixing it with other 4d fractals will be interesting.  

 @Luca-  I'm not sure if I did the division correctly at the end of the 4d T1 with xyz clamp.  I saved the original magnitude in EBP-20, then need to divide the stack st(0) by it at the end, so do I use DC75E0 or DC7DE0?

  I would think DC7D, but I don't know if the reference (Art of Assembly) I'm using is correct (or if my interpretation of it is!), because I had to reverse a whole bunch of divisions in another formula to make it work.... I can't tell by looking at the fractal.

  Don't know how to run the script in Ollydebug to check the math, which would make it so much easier, if you have any tips for me.  Thanks for all you've done so far. 

4dT1:
(https://lh3.googleusercontent.com/-Agsjwjzjjqc/VkRLYUm31HI/AAAAAAAADqM/9mPMQpvtZ1g/s640-Ic42/4DT1%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg)
3dT1:
(https://lh3.googleusercontent.com/-yzuED_UPidw/VkRVCc_mYaI/AAAAAAAADrE/ELs0rXtn3FA/s640-Ic42/3DT1%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520big.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 13, 2015, 07:17:39 AM
That clamped version was wrong... I think.  Here are comparison shots between the exact same fractal with the various transform 1s.

Click to enlarge so you can see the differences a bit better.
4d t1 clamp xyz5 (not the above formula!) on left,  normal 4d T1 on right:

(https://lh3.googleusercontent.com/-gmg8bmj1Za4/VkV4tf8QN9I/AAAAAAAADt8/1c5o6J4Yo8Q/s400-Ic42/4DT1%252520clamp%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg) (https://lh3.googleusercontent.com/-gmg8bmj1Za4/VkV4tf8QN9I/AAAAAAAADt8/1c5o6J4Yo8Q/s1280-Ic42/4DT1%252520clamp%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg) (https://lh3.googleusercontent.com/-Agsjwjzjjqc/VkRLYUm31HI/AAAAAAAADqM/9mPMQpvtZ1g/s400-Ic42/4DT1%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg) (https://lh3.googleusercontent.com/-Agsjwjzjjqc/VkRLYUm31HI/AAAAAAAADqM/9mPMQpvtZ1g/s1280-Ic42/4DT1%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg)

4d clamp The above formula!!! on left, 3d T1 version on right:

(https://lh3.googleusercontent.com/-rfwDD7gkWYU/VkV0BtnHahI/AAAAAAAADtc/gTCzEMSUPvk/s400-Ic42/4DT1%252520clamp%252520D%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg) (https://lh3.googleusercontent.com/-rfwDD7gkWYU/VkV0BtnHahI/AAAAAAAADtc/gTCzEMSUPvk/s1280-Ic42/4DT1%252520clamp%252520D%252520TEST%252520LIGHT%2525204%252520HARD%252520SHADOW%252520LARGE.jpg) (https://lh3.googleusercontent.com/-wX3yZI_rUMI/VkWKMG0t-dI/AAAAAAAADuM/IzKh1CgQYYc/s400-Ic42/3DT1%252520not%252520grainy%252520LIGHT%2525204%252520with%252520HARD%252520SHADOW%252520LARGE.jpg) (https://lh3.googleusercontent.com/-wX3yZI_rUMI/VkWKMG0t-dI/AAAAAAAADuM/IzKh1CgQYYc/s1280-Ic42/3DT1%252520not%252520grainy%252520LIGHT%2525204%252520with%252520HARD%252520SHADOW%252520LARGE.jpg)


  3d fixed.  Don't know what I did.  Binary search?  Raystep?  It had more details, and was grainy looking.  Still have the image- just, it's not a good comparison for these ones.  


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 13, 2015, 01:16:11 PM
You can not execute a full script in olly but you can test something manually modifying the floating stack then executing the code (saving - fstp -not always works! Except if you are able to modify EBX EDX ECX to some writeable memory... argh)
You then highlight where you want to run then run line by line... watch what happens. :)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 13, 2015, 07:06:44 PM
  That doesn't help- if I knew how to run code in ODB, I wouldn't be asking how to run code in ODB.  If I can't run a script, I can't run code.  ;)

  When I try to run code, it runs from the beginning of the file, not from the section I highlight.... 

  lol. Found it- have to set new origin from right click menu.  Still, can't write to EAX in twunk32, because it is system... trying hello world exe... :D
  


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 15, 2015, 11:58:58 PM
  Has rotation at specific iterations in the right place in the formula, so you don't have to do T1, rotation, pine tree (3 formula tabs).

  Going to make one with the squaring thing on specific iterations too.  I'll try how to do it every 2 iterations or something like that....

  Still have the polyhedron transforms to add to this!  Lots of work. 


  https://www.youtube.com/watch?v=ypxR2sQAnws (https://www.youtube.com/watch?v=ypxR2sQAnws)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 16, 2015, 08:08:50 AM
UPDATE:  The formula... is not correct.  lol... The cube part should not have the sphere after the pine iteration.

  Will be updated later.  Took out formula...  sorry!!

K.  Added the square to it as well.  Tomorrow I will make it so that it will "square" every 3 iterations, unless something else comes up...  After that, time to work on the polgonator and polyhedronators for this fractal, so you can play with other shapes...


  Still want a general formula for the Platonics!@#!@$  :D

(https://lh3.googleusercontent.com/-Ts7kPvniNI4/VkmAZiYmP5I/AAAAAAAADv4/I1_Yv8b3DNY/s640-Ic42/rotatingpinecube1shaded2.jpg) (https://lh3.googleusercontent.com/-Ts7kPvniNI4/VkmAZiYmP5I/AAAAAAAADv4/I1_Yv8b3DNY/s1280-Ic42/rotatingpinecube1shaded2.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 17, 2015, 04:37:25 AM
Ok.  I put the spheric, after the Pine, after the cube, after the 1, probably because I swallowed a fly.  And I don't know why I swallowed a fly.  Perhaps I'll die.

  Anyway.  Here is a rotatin'pineCube and a rotatin'pineSquare fer yins.

  Square just squares it up.  Pretty sharp.  The cube one, well, it sort of stretches it out a bit.  Kind of nice too.  I'm liking the square though.  Going to make polygonal and polyhedral formulas for it, and add them, without the regular tetrahedral transform (just the general one I did for the Menger).  

  Then maybe make a square every iter??  // scratch that.. not too pretty.  Maybe set it up so that it does it every few iterations?  Or just have a formula that always does squares and mix that with formulas that don't.  :D

Square:
 (https://lh3.googleusercontent.com/-FVmV-Fwkqz4/VkqT7TLrEZI/AAAAAAAADxE/tc39w1mV7bY/s640-Ic42/rotatin%252520pine%252520square.jpg)
  
Cube:
(https://lh3.googleusercontent.com/-lvKjtUpu0xs/VkqT6eG6RlI/AAAAAAAADw4/j7bJSVkN8kU/s640-Ic42/rotatin%252520pine%252520cube%2525201.jpg)
  


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 17, 2015, 09:27:57 AM
K.  It was hard to learn the floating point while loop in assembly, since there wasn't any good example to look at, and.. well.. ok, I was comparing the wrong way.. and to the wrong thing.  Took me hours to see the one little tiny thing, because, well, I thought I was implementing the loop the wrong way, because I couldn't find a good code example.

  So I assumed I had to find a good code example, and all along, it was more or less correct, with one wrong variable pointer. 

 Anyway, so only got the polygonal thing out today.  Going to combine it with other formulas for streamlining, but for now.  Enjoy.  If you do that kind of thing with interesting mathematical functions.   

  Use the Poly formula before pine tree, after Transform 1.  It might explode if you set it wrong!  Here is one with triangles and squares.  Click to enlarge.
(https://lh3.googleusercontent.com/-rIS_bFpzXio/VkrkruHvo6I/AAAAAAAADyY/LP51DCzFM5I/s640-Ic42/squares%252520and%252520triangles%252520editedlight%252520bigger%252520big%252520hard%252520shad.jpg) (https://lh3.googleusercontent.com/-rIS_bFpzXio/VkrkruHvo6I/AAAAAAAADyY/LP51DCzFM5I/s1280-Ic42/squares%252520and%252520triangles%252520editedlight%252520bigger%252520big%252520hard%252520shad.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: lycium on November 17, 2015, 04:32:43 PM
Random programmer comment/observation: if you'd like to "future proof" these formulae, or simply make them usable in other systems, there should also be a plain C (or Pascal, or whatever) version besides the assembly code. I think x87 code written in 2015 (!!!!!) has way too high chance of being "lost in the sands of time", and this seems like a good effort so it would be a shame.


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 17, 2015, 04:50:53 PM
Question...
What does BenesiPoly do?
Is it the same of polyfolding? I hope no... ;)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 17, 2015, 07:47:04 PM
Random programmer comment/observation: if you'd like to "future proof" these formulae, or simply make them usable in other systems, there should also be a plain C (or Pascal, or whatever) version besides the assembly code. I think x87 code written in 2015 (!!!!!) has way too high chance of being "lost in the sands of time", and this seems like a good effort so it would be a shame.
Hi!

  Well, there are .frags of the majority of this stuff.  I've also posted the math in various threads here, so it can be ported to various formats.  I think I put the math in the .m3f descriptions, for the most part.

  The code isn't even optimized yet- a few extra instructions here and there, and maybe better ways of doing stuff (not sure if fsqrt is as fast as fsqrtss in Core2?). 

  Ohh, and I think mclarekin is porting it to Mandelbulber- and that is some form of c code, I think.


Title: Re: A few formulas (For Luca... :D)
Post by: lycium on November 17, 2015, 07:54:33 PM
IMO the question of performance is meaningless when talking about x87 assembly. It is EXTREMELY slow compared to SSE/AVX, even without considering vectorisation (i.e. doing 4-wide, 8-wide or even 16-wide instructions just for the 1 result). Even then, instruction scheduling and register allocation is something best done by a compiler, which can throw combinatorial optimisation at nice clean source code; this approach is so much better, it's not really worth considering "alternatives".

I'm sure there are plenty of good explanations on the difference between x87 and modern instructions on the net, if not I can give a quick summary of the benefits here.


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 17, 2015, 08:01:43 PM
Question...
What does BenesiPoly do?
Is it the same of polyfolding? I hope no... ;)

  No  :d.  Definitely not...   :D   I'm assuming the folding one probably folds over planes, this one stretches a circle to a polygon (technically the polygon's incircle).  

Although polyfolding does interesting stuff with the T1 pine tree (put in between t1 and pine tree).  :D


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 17, 2015, 08:24:09 PM
IMO the question of performance is meaningless when talking about x87 assembly. It is EXTREMELY slow compared to SSE/AVX, even without considering vectorisation (i.e. doing 4-wide, 8-wide or even 16-wide instructions just for the 1 result). Even then, instruction scheduling and register allocation is something best done by a compiler, which can throw combinatorial optimisation at nice clean source code; this approach is so much better, it's not really worth considering "alternatives".
  So... I should write c code and compile it... instead of struggling through assembly?  :D  Which free c compiler should I jump on, gcc?

I'm sure there are plenty of good explanations on the difference between x87 and modern instructions on the net, if not I can give a quick summary of the benefits here.

  I'm looking around, but I'd appreciate your input. 


Title: Re: A few formulas (For Luca... :D)
Post by: lycium on November 17, 2015, 08:57:24 PM
A quick summary of the benefits of using a newer instruction set like SSE/AVX over x87:

* Registers are random-access, meaning you don't have all these fxchg instructions clogging up your precious instruction decode bandwidth
* Way more registers, so less register pressure/spilling
* Access to all these superfast new instructions
* x87 performance has not been a priority since Pentium 3 (P4 and newer are all about SSE throughput).


Yes, you should definitely compile some higher level code instead of using assembly language. GCC is a good choice if you can handle its pedantry, but then again, coming from asm coding that is highly unlikely to the be a problem :D


Title: Re: A few formulas (For Luca... :D)
Post by: lycium on November 17, 2015, 09:02:35 PM
Funny thing: around 2006 on this forum there was this crazy assembly language fanatic going on and on about hand optimised asm code, and it was all super slow x87 stuff.

So that's nearly 10 years of telling people not to use asm on this forum  O0


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 18, 2015, 01:19:07 AM
A quick summary of the benefits of using a newer instruction set like SSE/AVX over x87:

* Registers are random-access, meaning you don't have all these fxchg instructions clogging up your precious instruction decode bandwidth
* Way more registers, so less register pressure/spilling
* Access to all these superfast new instructions
* x87 performance has not been a priority since Pentium 3 (P4 and newer are all about SSE throughput).
  Out of these... the only thing that would benefit the majority of the things I do, up til now, is fast "new" instructions.  I'm basically doing some very simple, streamlined, linear math operations (for M3D), so I don't think I can (I could be wrong... that happens all the time) take advantage of the "vectorization" of parallel instructions.  M3D passes stuff to the code I write, then stuff is passed back to M3D- so there can't be 2 things running at once, unless I wrote some super fancy code that hacked M3D... which is way too much for now.

  What would be really awesome is an x87 to SSE recompiler, that takes x87 code and optimizes it by passing what it can to SSE.  That would be something worth working on.   

Yes, you should definitely compile some higher level code instead of using assembly language. GCC is a good choice if you can handle its pedantry, but then again, coming from asm coding that is highly unlikely to the be a problem :D

  That might be a bit easier than what I'm doing: using a debugger, typing code in hex... etc.  ;)   I'm supposed to grab GCC anyway... so... it's on the list.


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 18, 2015, 01:22:10 AM
Polyhedral and polygonal transforms.  

  If you're using them with a cube, like the Menger, you need to use the Spheric transform with them.  If you're using them with T1 and the Pine Tree, you just use one or the other (I like the polygonal! nice and neat!) before the Pine Tree portion.
Hexagon, 6x6 polyhedron transform
 (https://lh3.googleusercontent.com/-7rOwAeEzYo4/Vku6L-IGepI/AAAAAAAADys/uukRowmUj5I/s400-Ic42/polygon%2525206.jpg) (https://lh3.googleusercontent.com/-7rOwAeEzYo4/Vku6L-IGepI/AAAAAAAADys/uukRowmUj5I/s960-Ic42/polygon%2525206.jpg) (https://lh3.googleusercontent.com/-B2lTuvdDqHs/Vku6M7WIclI/AAAAAAAADy0/L1kOV3QPjnY/s400-Ic42/polyhedron%2525206%2525206.jpg) (https://lh3.googleusercontent.com/-B2lTuvdDqHs/Vku6M7WIclI/AAAAAAAADy0/L1kOV3QPjnY/s960-Ic42/polyhedron%2525206%2525206.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 18, 2015, 04:05:51 AM
Ok, I made hedron to sphere transforms for the polys these formulas generate- so you can switch back and forth, which is.. maybe useful for certain applications.  Like this Menger:

(https://lh3.googleusercontent.com/-RM-wSK9lW8I/VkvqSD10IlI/AAAAAAAADzM/Hd-r0Cn79ks/s400-Ic42/cool%252520menger.jpg) (https://lh3.googleusercontent.com/-RM-wSK9lW8I/VkvqSD10IlI/AAAAAAAADzM/Hd-r0Cn79ks/s1280-Ic42/cool%252520menger.jpg) (https://lh3.googleusercontent.com/-3JYI9pHktjs/Vkv5zhtxw7I/AAAAAAAADzg/doiRSQogrn0/s400-Ic42/cm%25252038%25252064.jpg) (https://lh3.googleusercontent.com/-3JYI9pHktjs/Vkv5zhtxw7I/AAAAAAAADzg/doiRSQogrn0/s800-Ic42/cm%25252038%25252064.jpg)

Code:
Mandelbulb3Dv18{
g.....s/...c3...w....2....UI8bZW0Fw..vflouuR5q1Enkzd96a2YwXP7ms3oA8xzKslPr8Q.WzD
........................................kz1........Y.VC0................y.2...wD
...Uz6....k4/.../s/0/.....Up....l/....E3.....omEQgisq6pD/s/........m0dkpXm1....U
./....kD12..0..........wz.................................U0.....y1...sD...../..
.z1...sDolFZd9iBmx1..........KzJxr2fLrdjgAZeBnNCHuHP4fJZymxOzslPySyorRqDPaV0iHmo
KuHDcNPuHTrNzayP2AdjQjqDU.....oA3...DD........sD.6....sD..G.....................
.............oAnAt1...sD....z...........................................P....k1.
.....Ksulz1.......kz.wzzz1.U..6.P....U5...EB....m....c3....F....6/...I1.....SF52
...U.qFG9yzb2zzz....zrm4..6.3c..zXCc...UCW0tRhyD66HNL1YPWz1..........E.UGwTl140.
.QHoLim.bz1.i72fW/hkz0EQ7YQrodyj2EkFzjzbB/..LHY2t2Apzu/kX/pMbQyD.6jPr72F9zP.2c..
zzzz.............0...................2./8.kzzzD............8....................
/EU0.wzzz1...................................2CcN/UvNPcveeWCNq0.yRiibHJJUk1f..XR
SvBmx3CcN/UvNPcvQsLsUa3.ibhVi1bTV1OK.sSq4uCly3CcN/UvNPcvMwLsUa3.ibhVinqTV1OK.sSq
4uCkz3CcN/UvNPcv..EsUa3feeWCNqGQIJ36wk8EwyLsUa3f................................
E....Ek.l2E.....I....Q....EHZtqNZ7LG4B3.rJaQ..............................U/4M..
...................0./........zD........kz1........sz...........................
................................................................................
.....................2.....3....0....wZEZtKNnZ4IjlKScJ4Nm34P....................
.............................U.E........M.2.....................................
................................................................................
................................/....E/...U.....T7INiJqQd/pPgZ5OZFaQVl4JjB3QcJaQ
Z/......................................E.2........2./..........................
................................................................................
..........................................U.....I....Q....EHZtqNZ7LG4B3.........
..........................U/4M.....................0./........zD........kz1.....
...sz...........................................................................
........................................................}
{Titel: cool menger 2}


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on November 18, 2015, 05:51:22 AM
Looking great.   O0 O0 O0

BTW I think you should write all formulas in C++ ;D ;D ;D
because I am too slow and you write new formulas too fast ;D

( and I much prefer exploring than coding).


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 19, 2015, 01:42:58 AM
 You might have a little break mclarekin.  I'm stuck on the tetrahedral transform- I have to align the tetrahedron with the transform and scale the transform correctly, and the Sierpinski already looks good combined with the Menger sphere.  The whole point of that transform was to combine the 2 of them... and they already combine quite wonderfully.  

  I do think I'll try some stretching and bending transforms... but I think they are already written!  

  cough.. but... I did change the rotatin'pine'square to a rotatin'pinepolygon... and probably will change the rotatin'pinecube to the more general polyhedron formula.. despite really liking the polygons. 


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 20, 2015, 05:59:54 AM
Since I told mclarekin they'd get a break, I won't post the formula for these things until tomorrow.  I've got to clean and complete the code... parts of the code aren't finished, and I want to add something to it.  Basically, the code adds or subtracts from the x coordinate of the fractal (most of the were done on the 3rd iteration), so you can stretch and warp it using certain parameters.  

  (https://lh3.googleusercontent.com/-FVfwytNQtTU/Vk6Bj1gsZnI/AAAAAAAAD0Y/i60AKfiD4N0/s400-Ic42/FLOWERS%252520WIRTH%252520RONG%252520%252520VERSION%2525202.jpg)  (https://lh3.googleusercontent.com/-FVfwytNQtTU/Vk6Bj1gsZnI/AAAAAAAAD0Y/i60AKfiD4N0/s960-Ic42/FLOWERS%252520WIRTH%252520RONG%252520%252520VERSION%2525202.jpg)(https://lh3.googleusercontent.com/-lynR89PWYDo/Vk6BgNicS-I/AAAAAAAAD0Q/X4ZIuKLkLDw/s400-Ic42/FLOWERS%252520WITH%252520WRONG%252520VERSION.jpg) (https://lh3.googleusercontent.com/-tpvM2jau0wo/Vk6BfwmLJbI/AAAAAAAAD0M/t4wCJRGNhdM/s400-Ic42/TRYING%252520WITH%252520SKEW%252520MAX%252520VERSIONS.jpg) (https://lh3.googleusercontent.com/-tpvM2jau0wo/Vk6BfwmLJbI/AAAAAAAAD0M/t4wCJRGNhdM/s640-Ic42/TRYING%252520WITH%252520SKEW%252520MAX%252520VERSIONS.jpg) (https://lh3.googleusercontent.com/-_1GiXNwYQsU/Vk6BnZfKIHI/AAAAAAAAD0g/cngDDFz4Rg4/s400-Ic42/spiders%252520in%252520the%252520garden.jpg) (https://lh3.googleusercontent.com/-_1GiXNwYQsU/Vk6BnZfKIHI/AAAAAAAAD0g/cngDDFz4Rg4/s960-Ic42/spiders%252520in%252520the%252520garden.jpg) (https://lh3.googleusercontent.com/-_XEyTvhjFB0/Vk6j6Tu6V1I/AAAAAAAAD04/ZNqgsxybHW8/s400-Ic42/xmas%252520ree%2525204.jpg) (https://lh3.googleusercontent.com/-wLegVbUN2Lg/Vk6j65thUaI/AAAAAAAAD1A/pxIdMUsz_Cc/s400-Ic42/xmas%252520ree%2525205.jpg) (https://lh3.googleusercontent.com/-0Y2OWtT-DKk/Vk6j6sRVyRI/AAAAAAAAD08/UkVUMsG9af8/s400-Ic42/xmas%252520ree%25252052.jpg) (https://lh3.googleusercontent.com/-5AJ_hrNxn3k/Vk6j7kzPLQI/AAAAAAAAD1M/kizeHsBZKb4/s400-Ic42/xmas%252520ree%2525206.jpg)  (https://lh3.googleusercontent.com/-5AJ_hrNxn3k/Vk6j7kzPLQI/AAAAAAAAD1M/kizeHsBZKb4/s960-Ic42/xmas%252520ree%2525206.jpg) (https://lh3.googleusercontent.com/-8Yp-G_mpt5w/Vk6j8LwCE2I/AAAAAAAAD1U/NEcF7v6_180/s400-Ic42/xmas%252520tree%2525202.jpg) (https://lh3.googleusercontent.com/-8Yp-G_mpt5w/Vk6j8LwCE2I/AAAAAAAAD1U/NEcF7v6_180/s960-Ic42/xmas%252520tree%2525202.jpg) (https://lh3.googleusercontent.com/-VFWkXar1z6E/Vk6j8qU5T6I/AAAAAAAAD1Y/GII-tgY0Irc/s480-Ic42/xmas%252520tree%2525203.jpg) (https://lh3.googleusercontent.com/-VFWkXar1z6E/Vk6j8qU5T6I/AAAAAAAAD1Y/GII-tgY0Irc/s960-Ic42/xmas%252520tree%2525203.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 20, 2015, 10:24:15 AM
Those new variations are wonderful but please use shorter names - are you inspired by Mandelwerk? :D
(Example instead of amazing surface I used AmazingSurf and it is already long ;) )


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 20, 2015, 09:11:21 PM
Those new variations are wonderful but please use shorter names - are you inspired by Mandelwerk? :D
 Isn't that the name Yohan uses for his fractal artwerk?  Since that it the case, I think that would be up to Yohan, if he'd like the name he uses associated with the formulas that we're (the community) producing.  

  Mandelwerk voor toekomstige Mandelspelen???  Google translate... ;)
(Example instead of amazing surface I used AmazingSurf and it is already long ;) )

  Ahh... I see.  They don't fit in the formula selection window, so you can't tell which is which!!  Don't include them with the officially released formulas until we get everything finalized (at least in the 1.0 stage of development!  These are all betas!).

  I'm thinking we can rename the formulas like the following:

    BT1withPine1  
    BT1withPine1+        //this will have the yz-plane rotation and polygon transform, will take a bit longer to calculate
    BT1withPine1++      //this will have generalized rotations and polygon transform, will take even longer to calculate
    BT1withPine1+++    //this will have rotations, polygon transforms, and skews... and will take even longer to calculate!
    BT1withPine1++++  //this will have optional T2 through T5 in addition to the other options... even slower!!

  Then  BT1withPine1.1 when it's updated...  sound better?  

  For the transforms:
  _BTransform1v1
  _BTransform14dv1
  _BTransform14dv1Clamped   //will this fit???
  _BTransform2v1

 
  _PolygonToCircle   and _CircleToPolygon need to be spelled out...  because that is what they do!!!!  I need to change them to be around arbitrary axes...  but that's in the future.
  Maybe change the second name to  "_PolygonFromCircle", so that they are together in the menu!

 _PolyhedronToSphere and _PolyhedronFromSphere (instead of _SphereToPolyhedron) need to be spelled out as well.



  There are bugs in the formulas too!!!  The rotatin'pinepolys have y and z switched in the wrong place, so I need to fix that for symmetry.  Lots of stuff to be done before they are complete.  


Title: Re: A few formulas (For Luca... :D)
Post by: DarkBeam on November 21, 2015, 12:12:10 PM
No hurry at all  :beer: do it good ^-^


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 21, 2015, 05:11:13 PM
I suppose a math class in which you're tricked into thinking you're creating new formulas for artists is a nice one to be in.  I'll keep working on stuff, because I'm uninformed.  ;)


Title: Re: A few formulas (For Luca... :D)
Post by: 3dickulus on November 21, 2015, 08:36:58 PM
 :rotfl: I get the same feeling when dealing with questions/problems re:Fragmentarium


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 22, 2015, 02:13:14 AM
Ehh.. I meant that I have the feeling I'm being taught math in an interesting way... learning by creation of art formulas.  ;)

  Speaking of... translated the stellation formula to M3D, from the rough frag. 

   You'll need the polyhedra to sphere transform for this to work.  It's in this thread.. I think.  And it might be spelled differently...

(https://lh3.googleusercontent.com/-_Bw61PBt6EI/VlEV3pGRslI/AAAAAAAAD2g/HWGE3MukoIw/s400-Ic42/stella%252520workin.jpg)

  Keep the angles low... ;)   I might have left them at 2 in the formula set up.. which is way too high.  Actually...  included some skewing formulas too.  Not final release. 


Title: Re: A few formulas (For Luca... :D)
Post by: 3dickulus on November 22, 2015, 09:52:06 AM
Every time I'm asked a question or presented with a problem I end up doing some research and inevitably learning something new in the process, education by proxy via "the fractal collective".

I haven't had a chance to test the frag version, this (above) is what it should look like?


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 22, 2015, 09:10:36 PM
Pretty much.

  I didn't notice it blending to well with the Menger- stellating between iterations doesn't seem as nice as the plane old polyhedral transform. 

  Also, the stellation formula isn't perfect- it doesn't create regular polyhedrons (other than the cube) or regular stellated polyhedrons.  I still haven't done the work to create the regular polygons and/or stellations.

   Stellation does seem to fit quite well with the T1 Pine Tree, because that formula has the hexagonal symmetry, so setting sides to 6 and stellating really fits the formula well.  But that's about it, from what I've seen. 

  Lots of starfish:
(https://lh3.googleusercontent.com/-okXVcS0VcnU/VlFVyhQFASI/AAAAAAAAD3M/Xy2IEx7oHiE/s640-Ic42/stella%252520stock%2525204.jpg)


Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on November 23, 2015, 06:03:23 AM
  All right Luca, I think I have the formulas temporarily organized.

  Made an archive for you and Andreas to look over, make sure the names are short enough, etc.  I'll be changing a few formulas, and updating the archive later, but this is the current formula set.


  I think I'll make a Stellated Polygon T1 Pine Tree with rotation, and a Stellated Polyhedron T1 Pine Tree with Rotations.. and maybe skews..  That is something I need to think about.  Might be neat.  

  Starflowers, 6 petal forget me nots.... click to enbiggen a bit.
(https://lh3.googleusercontent.com/-lk60b5_iZ7g/VlKdL6tum7I/AAAAAAAAD4k/_Jg4IQFBi3M/s400-Ic42/stella%252520churros%252520thistle%2525202.jpg) (https://lh3.googleusercontent.com/-lk60b5_iZ7g/VlKdL6tum7I/AAAAAAAAD4k/_Jg4IQFBi3M/s800-Ic42/stella%252520churros%252520thistle%2525202.jpg) (https://lh3.googleusercontent.com/-FxrXC5-o2E4/VlKpkAXE1lI/AAAAAAAAD40/D5oyiPTs4I8/s400-Ic42/StellaTemplate1.jpg) (https://lh3.googleusercontent.com/-FxrXC5-o2E4/VlKpkAXE1lI/AAAAAAAAD40/D5oyiPTs4I8/s960-Ic42/StellaTemplate1.jpg)


UPDATE:  changed .DEoption in the transforms so they show up under the Ads tab.  Still a work in progress.  If you used the older versions of these transforms (before this post!) and saved them to parameters, you need to manually copy the parameters between the old style formula names and the new style (with the old formulas still in your M3Formulas directory!), because your parameters files will not work with these new names (formula names are different- took my name off the front to shorten them, so that you can tell which ones you're using in the formula tab thing in M3D.  Luca is right- too long of names makes them harder to use...).

   So.. attached is the correct DEoptions version.  The names should stay the same, if they have a V# after them, that means I'm planning on releasing new versions that will probably not be compatible with previous versions parameters files.  

  So _BSkewXmaxV1.m3f   will become  _BSkewXmaxV2.m3f  when I change it- it will still have much of the old functionality, but it will have various other things added to it as well.

  whoooppss.. ok, removing both files, and replacing with the correct one at 12:22 PM UTC-8.


Title: Re: A few formulas (For Luca... :D)
Post by: mclarekin on January 05, 2016, 11:16:31 PM
28 October 2015, M.Benesi wrote:

Quote
Try doing a y-z switch after T1, and see what you get for the same values above... might be interesting. 

Finally added a Zvector axis swap transform in Mandelbulber, covering the six possibilities.  So  I tested  all of the T series Mag transforms on their own (no Pinetree)  against the 6 axis swaps. T1 is the coolest,  T2 pretty good as well.

(BTW also finally added internal rotations in the T series Mag formulas)



Title: Re: A few formulas (For Luca... :D)
Post by: M Benesi on January 06, 2016, 09:39:45 AM
  T1 y-z switched reminds me of granite.  Good work on getting all those formulas ported.