Logo by Cyclops - 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: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. April 26, 2024, 11:17:22 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: Mandelbulb directional distance  (Read 4666 times)
0 Members and 1 Guest are viewing this topic.
TruthSerum
Guest
« on: July 05, 2014, 04:57:45 PM »

I've been using this algorithm to improve the results of the DE step search.

Code:
    bool yams(const Vector& a, const Vector& b, Real* x, Real* e) {
      if (m(a)) {
        return false; /* ray starts inside the Mandelbulb */
      }
      /* locate the surface with DE steps */
      Real min = 0;
      Real max = 0;
      bool found = false;
      for (int i = 0; i < 128; ++i) {
        Real next = min + md(a.add(b.mul(min))) * 0.1;
        if (m(a.add(b.mul(next)))) {
          max = next;
          found = true;
          break;
        }
        min = next;
      }
      if (!found) { /* unable to locate surface */
        *x = min;
        *e = 0;
        return true;
      }
      /* solution refinement */
      for (int i = 0; i < 128; ++i) {
        Real mid = (min + max) * 0.5;
        if (m(a.add(b.mul(mid)))) {
          max = mid;
        } else {
          min = mid;
        }
      }
      *x = min;
      *e = max - min;
      return true;
    }

After the surface is found using DE steps, it then refines the solution by bisection/binary search to "back up" to where the ray hits the surface.

It depends on having the boolean version of the Mandelbulb surface functioin, m(), available.

The function md() is the common log|arg| * |arg| / |de| distance metric.

It returns false if the ray does not hit the surface, and true otherwise.

If the intersection is found, then the variable 'x' contains the distance along the line a + b * x to the intersection, and e contains the error with the intention that

m(a + b * x) == false

and

m(a + b * (x+e)) == true

where e is as small as possible.

Let me know what you think smiley



And here are some graphs from my analysis:





The white line shows the distance function |arg| as the ray approaches the surface.
The green lines mark the areas of the x-axis that are contained inside the surface.
The blue line marks the solution.
« Last Edit: July 05, 2014, 05:47:54 PM by TruthSerum » Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #1 on: July 06, 2014, 02:27:31 AM »

Using a binary search to refine the surface intersection has been done in DE algorithms since before anyone started the analytical versions.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
TruthSerum
Guest
« Reply #2 on: July 06, 2014, 02:03:53 PM »

I don't know about the history of the techniques.

What is the current state of research?

Which fractal algorithms currently lack analytic solutions that are worth investigating?
« Last Edit: July 06, 2014, 04:44:11 PM by TruthSerum » Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #3 on: July 07, 2014, 12:24:30 AM »

With respect to the Mandelbulb Triplex the only ones that I'm sure aren't close to "correct" yet are ones that aren't exactly defined anyway even as plain triplex math - i.e. many of the higher functions.
For more normal maths such as Quaternions and Bicomplex (also often just referred to a hypercomplex - but basically the "squarry" ones) the analytical DE is virtually as straightforward as plain complex, however if you start playing with conditionals and the like it will break down - especially in cases of breaks in iteration smoothness i.e. where a fractal jumps from say 10 iterations to 12 on neighbouring locations even in the infinite limit - essentially fractal discontinuities,
The fractal type I would love to nail with respect to accurate analytical DE would be full escape-time IFS with affine transforms that include rotations/skews/shears as well as scaling and translation and with varied scaling across the 3 or more dimensions - at the moment to make this accurate requires very high bailouts for objects such as a 3D Barnsley fern making rendering slow - the more varied the scaling *from one axis/dimension* to another in any of the transforms the more inaccurate the DE becomes, a way round this without huge calculation overhead would be very helpful - especially now folks are mixing all types of fractal together.

With respect to the binary search - I only find it necessary when deliberately not rendering fractals to the full screen resolution i.e. when the DE "solid" threshold is greater than half a screen pixel, in such cases without the binary search there will be noticeable "stepping" in the illumination due to inaccuracy of surface normal calculation, using the binary search eliminates this but often if rendering to best resolution for the display size the DE threshold distance can simply be reduced to the point where the stepping from surface normal accuracy vanishes anyway.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Convergent Distance Estimation Programming David Makin 9 9989 Last post November 28, 2008, 10:27:01 PM
by gamma
Convergent Distance Estimation Mathematics David Makin 4 13290 Last post April 08, 2009, 10:07:14 PM
by David Makin
(bi directional) path tracing a mandelbulb Programming « 1 2 3 » ker2x 35 22012 Last post August 21, 2011, 11:06:46 AM
by Syntopia
distance is irrelevant Mandelbulber Gallery taurus 1 1869 Last post February 27, 2012, 09:43:58 PM
by Xazo-Tak
What is a distance field ? Programming Chanur 6 4710 Last post August 21, 2012, 10:54:12 AM
by Syntopia

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.139 seconds with 24 queries. (Pretty URLs adds 0.009s, 2q)