I can not really help you your raymarching, but here is some random information

1) On the "side note" this is statistics from MandelbulberV2 Asurf. using default bailout r = 100 ( or rr = 100 * 100), probably larger than required

scale 2 13 fractal iterations

scale 1.1 78 fractal iterations

2) This is my most recent Fragmentarium asurf

To convert this back to a more standard Asurf replace maxRR with 1, and remove the cylindrical fold

you should use MinRR rather than sqrt(minR)

note the way the addition of constant is implemented at the end of the iteration, this creates a lot more variations at little cost.

vary scale method is more flexible with two parameters

sphere fold has been rearranged just for the purposes of grabbing some color, not normally coded this way.

generally for asurf color i use the original points p.z value to produce some vertical color gradient

You can use this kind of code for finding a game terrain then hardcode out the slider variables. It could be interesting running your code in Fragmentarium to compare render time

`// Output generated from file: C:/Users/graeme/Downloads/Fragmentarium-2.5.0-181027-winex/Fragmentarium-2.5.0-181027.winex/Examples/mclarekin/abox4.frag`

// Created: Tue Feb 26 01:53:51 2019

#info Mandelbox Distance Estimator

#define providesInit

#include "MathUtils.frag"

#include "DE-Raytracer.frag"

#group Asurf2

/*

The distance estimator below was originalled devised by Buddhi.

This is a generic abox type

with two similar varable scale functioms added .

and a iteration based color tweak. mclarekin 25-02-2019

*/

// Number of fractal iterations.

uniform int Iterations; slider[0,60,300]

uniform float Bailout; slider[0,100,1000]

uniform int ColorIterations; slider[0,16,300]

// box fold

uniform vec3 boxLimit; slider[(-5.0,-5.0,-5.0),(1.0,1.0,1.0),(5.0,5.0,5.0)]

// sphere fold, including forceCylindricalFold

uniform float minRR; slider[0,0.25,2.0]

uniform float maxRR; slider[0,1.0,2.0]

uniform vec3 offsetSph; slider[(-5.0,-5.0,-5.0),(0.0,0.0,0.0),(5.0,5.0,5.0)]

uniform bool forceCylFold; checkbox[false]

uniform int startIters; slider[0,0,100]

uniform int stopIters; slider[0,1,100]

uniform float scaleCylFold; slider[-5.0,1.0,5.0]

// scale controls

uniform float Scale; slider[-5.0,2.0,5.0]

uniform float scaleVary; slider[-2.00,0.0,2.00]

uniform float scaleOffset; slider[-5.00,0.0,5.00]

uniform bool varyMode2; checkbox[false]

// precomputed constants

uniform vec3 Rotation; slider[(-180,-180,-180),(0,0,0),(180,180,180)]

// addition constants

uniform vec3 OrigPtOffset; slider[(-10.0,-10.0,-10.0),(1.0,1.0,1.0),(10.0,10.0,10.0)]

uniform vec3 c3Julia; slider[(-100.0,-100.0,-100.0),(0.0,0.0,0.0),(100.0,100.0,100.0)]

//uniform vec3 IterColorTweak; slider[(-0.2,-0.2,-0.2),(0.0,0.0,0.0),(0.2,0.2,0.2)]

uniform vec3 sphereColorTweak; slider[(-1.0,-1.0,-0.01),(0.0,0.0,0.0),(1.0,1.0,0.01)]

mat3 rot;

void init() {

rot = rotationMatrixXYZ(Rotation);

}

// Compute the distance from `pos` to the Mandelbox.

float DE(vec3 pos) {

vec3 p3 = pos;

vec3 OrigPoint = pos * OrigPtOffset;

float Dd = 1.0;

float rr;

float radiusFactor = maxRR/minRR;

float useScale = 1.0;

float addScale = 0.0;

vec3 addColor = vec3(0.0);

for (int i=0; i<Iterations; i++) {

// box fold

// p3 = clamp(p3, -boxLimit, boxLimit) * 2.0 - p3;

p3.xy = clamp(p3.xy, -boxLimit.xy, boxLimit.xy) * 2.0 - p3.xy;

// spherical fold

rr = dot(p3,p3);

// force cylinder fold

if (forceCylFold && i >= startIters && i < stopIters)

rr -= p3.z * p3.z * scaleCylFold; // fold weight

p3 += offsetSph;

float temp1 = rr - minRR;

float temp2 = rr - maxRR;

if (temp1 < 0.0)

{

p3 *= radiusFactor;

Dd *= radiusFactor;

//addColor.x += sphereColorTweak.x;

addColor.x += sphereColorTweak.x * temp1 * float(i);

}

else if (temp2 < 0.0)

{

float tglad_factor2 = maxRR / rr;

p3 *= tglad_factor2;

Dd *= tglad_factor2;

//addColor.y += sphereColorTweak.y;

addColor.y += sphereColorTweak.y * temp2 * float(i);

}

else

{

temp1 = rr - maxRR;

addColor.z += sphereColorTweak.z * temp1 * float(i);

}

p3 -= offsetSph;

// scale

useScale = addScale + Scale;

p3 *= useScale;

Dd = Dd * abs(useScale) + 1.0;

// update addScale for next iteration

float vary = scaleVary * (abs(addScale) + scaleOffset);

if (varyMode2) addScale = vary;

else addScale += vary;

//rotation

p3 *= rot;

// add constants

p3 += OrigPoint + c3Julia;

rr = dot(p3,p3);

//orbitTrap += vec4(addColor,0.0);

if (i<ColorIterations) orbitTrap = min(orbitTrap, abs(vec4(p3,rr)));

orbitTrap += vec4(addColor,rr);

if ( rr>Bailout) break;

}

return sqrt(rr) / abs(Dd) ;

}