@ crist. This is an example of converting one of DarkBeams M3D.m3f. I have still got a lot to do to finish coding it properly ( I have also lost some symmetry in c++ version),. This is a walk_through of the steps I take when attempting to convert a .m3f to .fract
// DarkBeams MixPinski4.m3f
1) GET INFORMATION FROM FIRST SECTION
[OPTIONS]
.Version = 6
.DEscale = 0.2 DE step, fudge factor??
.ADEscale = 2 ??
.DEoption = 6 would be good to know what DE method this equates to in Fragmentarium
.RStop = 1024 bailout
.SIpower = 2 ??
.Double Scale = 2 make default settings. uniform float scaleM; slider[0.0,2.0,20.]
.Double CScale X = 1 make default settings. uniform vec4; slider[(-5.0,1.0,5.0),(-5.0,1.0,5.0),(-5.0,0.5,5.0),(-5.0,0.5,5.0)]
.Double CScale Y = 1
.Double CScale Z = 0.5
.Double CScale W = 0.5
.6SingleAngles Rotation = 0 4D six_angle rotation
558BEC53565789C38B75088B7E30DD41
08DD01DD02DD0390D9E0D8D1DFE0D0EC
7202D9C9D8D2DFE0D0EC7202D9CAD9E0
D9C9D9E0D8D2DFE0D0EC7202D9CAD9E0
D9C990D9E0D8D3DFE0D0EC7202D9CBD9
E0D9C9D9E0D8D3DFE0D0EC7202D9CBD9
E0D9C9D9CAD9E0D8D3DFE0D0EC7202D9
CBD9E0D9CA9083EF28D9C0D84FF4D9C2
D84FF0DEC1D9C3D84FECDEC1D9C4D84F
E8DEC1DD1BD9C0D84FE4D9C2D84FE0DE
C1D9C3D84FDCDEC1D9C4D84FD8DEC1DD
1AD9C0D84FD4D9C2D84FD0DEC1D9C3D8
4FCCDEC1D9C4D84FC8DEC1DD19D84FC4
D9C9D84FC0DEC1D9C9D84FBCDEC1D9C9
D84FB8DEC183C728DD47F0DCC9D9E8DE
E9DC4FD0DEE9DD5908DD01DD02DD03DD
47F0DD86E8000000D8C9DD9EE8000000
9090DCCADCC9D9C0D9E8DEE9D9C0D9C0
DC4FE8DEEDDC4FE0DEEBD8F1DC4FD8DC
ECD9CCD9E1DEECDECBDD1ADD1BDD1990
909089D85F5E5B5DC20800
2) THEN WE EVALUATE THE INFO IN DESCRIPTION (This can be
very important)
Description:
NOTE: If the formula does not render correctly together with 3D formulas check "Disable analytical DE".
A strange but intriguing fractal, that mixes Sierpinski and Menger folds. The amazing thing is that in 3D it does not work so well!
3) SET UP INITIAL CONDITIONS
uniform float scaleM; slider[0.0,2.0,20.]
uniform vec4 scaleC; slider[(-5.0,1.0,5.0),(-5.0,1.0,5.0),(-5.0,0.5,5.0),(-5.0,0.5,5.0)]
// offset useful for testing purposes, but will also keep in final UI
uniform vec4 offsetM; slider[(-5.0,0.0,5.0),(-5.0,0.0,5.0),(-5.0,0.0,5.0),(-5.0,0.0,5.0)]
// to give an intial w value
uniform float w; slider[0.0, 0.0, 5.0]
uniform int MI; slider[0.0, 10.0, 250.0] // maximum iterations
uniform float bailout; slider[0.0, 1024.0, 1024.0]
uniform float DE = 1.0; // not sure if you need this
uniform vec4 z = (pos, w); // not sure how to do this in Frag.(p.x,p.y, p.z, w)
//MixPinski4(x,y,z,w){
// r=x*x+y*y+z*z;
float DE(vec4 z)
{
float r = (z.x * z.x + z.y * z.y + z.z * z.z); // for bailout. Mandelbulber includes "+ z.w * z.w); "
// but i suspect it may not be necessary
4) THEN THE ITERATION LOOP
4a)The Sierpinski part is a cut and paste. No editing required.
for(i=0;i<MI && r<bailout;i++){
if(z.x+z.y<0.0) z.xy = -z.yx;
if(z.x+z.z<0.0) z.xz = -z.zx;
if(z.y+z.z<0.0) z.zy = -z.yz;
if(z.x+z.w<0.0) z.xw = -z.wx;
if(z.y+z.w<0.0) z.yw = -z.wy;
if(z.z+z.w<0.0) z.zw = -z.wz;
4b) z += offsetM; // I add in offset for testing
//rotate4D(x,y,z,w); 4D rotation TODO, could try using a 3D rot for now
4c) 4D Menger Sponge part, I did a Find and Replace
z.x= scaleM *z.x-scaleC.x*( scaleM -1);
z.y= scaleM *z.y-scaleC.y*( scaleM -1);
z.w= scaleM *z.w-scaleC.w*( scaleM -1);
z.z-=0.5*scaleC.z*( scaleM -1)/ scaleM ;
z.z=-abs(-z.z);
z.z+=0.5*scaleC.z*( scaleM -1)/ scaleM ;
z.z= scaleM *z.z;
// original code
/* x=scale*x-CX*(scale-1);
y=scale*y-CY*(scale-1);
w=scale*w-CW*(scale-1);
z-=0.5*CZ*(scale-1)/scale;
z=-abs(-z);
z+=0.5*CZ*(scale-1)/scale;
z=scale*z;*/
//r=x*x+y*y+z*z;
r = (z.x * z.x + z.y * z.y + z.z * z.z);
DE *= scaleM; // I added this because i do not understand the original DE, but I will eventually add the original DE to the Mandelbulber DE section and test it out
}
5) I GET CONFUSED WITH DE
//return sqrt(x*x+y*y+z*z)*scale^(-i); // original code, completely new to me
return (r - 2.0) / DE); // I used this, but I could try "return r/DE;" and maybe a generic "return (r - offsetD)/DE.
I// have a lot to learn about DE calculation.
I cannot guarantee this will make a workable .fract, but hopefully it may be OK.