Hi
Because rendering on GPU has limitation for calculation accuracy (mostly possible to use only floats), I had to redesign a little delta-DE algorithm. Standard 4-point delta-DE needs delta lower about 1000 times than distance threshold. With single rescission floating point numbers the lowest acceptable delta is anout 1e-6. Lower value produces big numeric errors. Higher gives artifacts in areas where DE is not continuous function. With this limitation there was not possible to get images with magnification higher than 1e3.
To improve delta-DE algorithm I decided to use additional 3 points. It's better to calculate deltas in positive and negative direction and use lower value of them. Then non-continuous areas of DE are eliminated.
Below there is a code which I use actually in Mandelbulber-OpenCL
formulaOut CalculateDistance(__constant sClInConstants *consts, float3 point, sClCalcParams *calcParam)
{
float distance;
float delta = 1e-6;
float3 dr = 0.0;
formulaOut out = Fractal(consts, point, calcParam);
if (out.iters == calcParam->N)
{
distance = 0.0f;
}
else
{
float r = out.distance;
float r11 = Fractal(consts, point + (float3) { delta, 0.0, 0.0}, calcParam).distance;
float r12 = Fractal(consts, point + (float3) { -delta, 0.0, 0.0}, calcParam).distance;
dr.x = min(fabs(r11 - r), fabs(r12 - r)) / delta;
float r21 = Fractal(consts, point + (float3) { 0.0, delta, 0.0}, calcParam).distance;
float r22 = Fractal(consts, point + (float3) { 0.0, -delta, 0.0}, calcParam).distance;
dr.y = min(fabs(r21 - r), fabs(r22 - r)) / delta;
float r31 = Fractal(consts, point + (float3) { 0.0, 0.0, delta}, calcParam).distance;
float r32 = Fractal(consts, point + (float3) { 0.0, 0.0, -delta}, calcParam).distance;
dr.z = min(fabs(r31 - r), fabs(r32 - r)) / delta;
float d = length(dr);
}
out.distance = distance;
return out;
}
where Fractal().distance returns last z value from fractal formula iterations.