Attached is my latest attempt at writing the frag, using Sabine62's code.
I note I was using a step multiplier of 0.1 in MBulberV2 c++ (for this fractal. I seldom go below that for fractals, but I have noticed that 0.1 is essential for some difficult fractals)
Reviewing Sabine62 code, based on how my openCL code is behaving.
I have studied a lot of fractal code here at the forum, that is the extent of my programming knowledge. I would have to follow a tutorial to make "hello world".
So I am limited to how much I can help.
Sabine62s Initial Conditions:
uniform float scaleM; slider[-2,0,2]
uniform vec4 scaleC; slider[(-5,-5,-5,-5),(0,0,0,0),(5,5,5,5)]
uniform vec4 offsetM; slider[(-5,-5,-5,-5),(0,0,0,0),(5,5,5,5)]
uniform float w; slider[0,1,5]
uniform int MI; slider[0,10,250]
uniform float bailout; slider[0,16,1024]
ScaleM not sure if negative scale is usable. BTW if using a negative scale, then return sqrt(r)/ abs(DE) is required, I think.
ScaleM default should be 2.0, so I would try (0.0, 2.0, 4.0)
vect4 -5 & 5 are guesses, for offsetM I was working with 0.1 and 0.2 size parameters when I tested it yesterday.
float w I have at default 0.0 , (-5, 0, 5) would be my initial guess forann initial range.
in this case w enter the loop as 0.0, then it gets given a non-zero value as it runs though the iterations. So to get the "default" image this must be set at 0.0.
MI both in c++ and openCL is set a default of 250 with no problems. This suggests that the fractal function is not terminating on Maxiter (this is normal for most std fractals). ( my guess at 50 was because I saw I had suggested 10 in my earlier frag post (standard menger sponges usually terminate in less than 10 iterations) and I thought i I better increase it just in case). In fact I just had a look in MandelbulberV2 c++, and the first image I posted had an average of 4.8 and maximum of 8 iterations.
Bailout. I am running with 1024 in OpenCL (i hard code this value into openCL versions, but a slider would be nice, but MandelbulberV1.21 has only 15 empty parameter input boxes so I have to choose my parameters wisely.) BUT in MbulberV2 c++ i have a bailout set at only 10 and it is working OK. NOTE I still need to test out this formula for normal working ranges for the parameters.
I cannot quite remember but there might be a third criteria for stopping termination based on z' - z < small number. So stops when when iterating is not significantly changing the value of z.
The first few pages of this try to explain how bailout, maxiter and DE work in Mandelbulber:
http://cdn.mandelbulber.org/doc/Mandelbulber_Manual_v091.pdf (translated from some form of archaic Polish language)
Added float Dd, for the DE inside the loop as I have set this up with the common type of linear DE calc
Added in a float offsetD for manipulating the DE calc. return (r - offsetD)/ abs(DE). Normally this should be set at 0.0 and increased to improve DE and will lose detail. If the DE is already good then apply ing a small negative number can give more details it seems??).
The final part of the loop I have changed to
................
z.z= scaleM *z.z;
Dd *= scaleM; // for DE calc
r2=z.x*z.x+z.y*z.y+z.z*z.z + z.w * z.w; // bailout criteia, and I added in the z.w part to see if it necessary
}
float r = sqrt(r2);
return (r - offsetD) / fabs(Dd); // offsetD has a default of 0.0 which is the std case. The offsetD results are similar or maybe the same as adjusting Detail Level( Quality)
// float Iter = i; // this DE works also in openCL so it might be something to with "i" in Fragmentarium
//return sqrt(r)*pow(scaleM,-Iter);
?? ooops I need to remove this from my frag
} urn sqrt(r)*pow(scaleM,-Iter);
//return r;
}