in src/Algorithm/fractals.c [427:458]
vec3 Mandelbulb(vec3 w)
{
w *= objectRotation;
vec3 z = w;
vec3 c = mix(w, offset, juliaFactor);
vec3 d = w;
float dr = 1.0;
float r = length(z);
float md = 10000.0;
for (int i = 0; i < int(maxIterations); i++) {
powN(power, z, r, dr);
z += c;
if (z.y > radiolariaFactor) {
z.y = mix(z.y, radiolariaFactor, radiolaria);
}
r = length(z);
if (i < colorIterations) {
md = min(md, r);
d = z;
}
if (r > bailout) break;
}
return vec3(0.5 * log(r) * r / dr, md, 0.33 * log(dot(d, d)) + 1.0);
}