Welcome to Fractal Forums

Fractal Software => Mandelbulber Gallery => Topic started by: Buddhi on November 19, 2013, 06:23:59 PM




Title: OpenCL & hybrid formula
Post by: Buddhi on November 19, 2013, 06:23:59 PM
OpenCL & hybrid formula

(http://nocache-nocookies.digitalgott.com/gallery/15/640_19_11_13_6_23_57.jpeg)

http://www.fractalforums.com/index.php?action=gallery;sa=view;id=15179

Image rendered using Mandelbulber 1.19
This is a trial with hybrid fractal defined as a custom formula. Used "Delta DE" distance estimation and "linear DE mode"

init:
Code:
float power = consts->fractal.power;
float tgladDE = 1.0f;
float3 ones = 1.0f;
float3 foldingLimit = consts->fractal.mandelbox.foldingLimit;
float3 foldingValue = consts->fractal.mandelbox.foldingValue;
float mr2 = consts->fractal.mandelbox.minRadius * consts->fractal.mandelbox.minRadius;
float fr2 = consts->fractal.mandelbox.fixedRadius * consts->fractal.mandelbox.fixedRadius;
float scale = consts->fractal.mandelbox.scale;
colourMin = 0.0f;

iterations:
Code:

  z = fabs(z + ones) - fabs(z - ones) - z;
  float rr = dot(z,z);
  float m = 2.0f;
  if (rr < mr2) m = native_divide(2.0f, mr2);
  else if (rr < fr2) m = native_divide(2.0f,rr);
 
  z = z * m;

if(i>4)
{
  float x2 = z.x * z.x;
  float y2 = z.y * z.y;
  float z2 = z.z * z.z;
  float temp = 1.0 - z2 / (x2 + y2);
  float newx = (x2 - y2) * temp;
  float newy = 2.0 * z.x * z.y * temp;
  float newz = -2.0 * z.z * sqrt(x2 + y2);
  z.x = newx + c.x;
  z.y = newy + c.y;
  z.z = newz + c.z;
  z.z *= consts->fractal.custom[0];
}
else
{
  z += c;
}

r = distance(z, orbitTrap);

#if _orbitTrapsEnabled
if (i >= consts->fractal.fakeLightsMinIter && i <= consts->fractal.fakeLightsMaxIter) distFromOrbitTrap += (1.0f/(r*r));
#endif

//iteration terminate condition
if(r>1024.0f)
{
dist = r / fabs(tgladDE);
out.colourIndex = colourMin / i * 300.0f;
break;
}


Title: Re: OpenCL & hybrid formula
Post by: quaz0r on November 19, 2013, 11:24:41 PM
nice!