Logo by simon.snake - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Check out the originating "3d Mandelbulb" thread here
 
*
Welcome, Guest. Please login or register. March 28, 2024, 09:54:34 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: fruity (inflection mapping)  (Read 2526 times)
Description: inflection mapping in Fragmentarium
0 Members and 1 Guest are viewing this topic.
claude
Fractal Bachius
*
Posts: 563



WWW
« on: February 02, 2017, 01:37:04 AM »

Inflection mapping in Fragmentarium with complex dual-numbers for automatic differentiation for distance estimate:

Code:
#include "Progressive2D.frag"

vec2 cMul(vec2 a, vec2 b)
{
  return vec2(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}

vec2 cSqr(vec2 a)
{
  return cMul(a, a);
}

vec4 cMul(vec4 a, vec4 b)
{
  return vec4(cMul(a.xy, b.xy), cMul(a.xy, b.zw) + cMul(a.zw, b.xy));
}

vec4 cSqr(vec4 a)
{
  return cMul(a, a);
}

const vec2 cs[8] = vec2[8]
  ( vec2(-1.5, 0.0)
  , vec2(-2.0, 0.0)
  , vec2(-1.5, 0.0)
  , vec2(-2.0, 0.0)
  , vec2(-1.5, 0.0)
  , vec2(-2.0, 0.0)
  , vec2(-1.5, 0.0)
  , vec2(-2.0, 0.0)
  );

vec3 color(vec2 c0)
{
  float px = length(vec4(dFdx(c0), dFdy(c0)));
  vec4 c = vec4(c0, px, 0.0);
  for (int i = 8-1; i >= 0; --i)
  {
    vec4 f = vec4(cs[i], 0.0, 0.0);
    vec4 d = c - f;
    c = f + cSqr(d);
  }
  int n = 0;
  vec4 z = vec4(0.0, 0.0, 0.0, 0.0);
  for (n = 0; n < 1000; ++n)
  {
    if (dot(z.xy, z.xy) >= 65536.0)
      break;
    z = cSqr(z) + c;
  }
  if (dot(z.xy, z.xy) < 65536.0)
    return vec3(1.0, 0.0, 0.0);
  float r = length(z.xy);
  float dr = length(z.zw);
  float de = 2.0 * r * log(r) / dr;
  float g = tanh(clamp(de, 0.0, 4.0));
  if (isnan(de) || isinf(de) || isnan(g) || isinf(g))
    g = 1.0;
  return vec3(g);
}

* inflection-1.frag (1.46 KB - downloaded 83 times.)

* inflection-1.jpg (239.42 KB, 1024x704 - viewed 130 times.)
Logged
Kalles Fraktaler
Fractal Senior
******
Posts: 1458



kallesfraktaler
WWW
« Reply #1 on: February 02, 2017, 09:35:26 AM »

 Repeating Zooming Self-Silimilar Thumb Up, by Craig
Logged

Want to create DEEP Mandelbrot fractals 100 times faster than the commercial programs, for FREE? One hour or one minute? Three months or one day? Try Kalles Fraktaler http://www.chillheimer.de/kallesfraktaler
http://www.facebook.com/kallesfraktaler
Pages: [1]   Go Down
  Print  
 
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.251 seconds with 24 queries. (Pretty URLs adds 0.012s, 2q)