Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: laser blaster on April 14, 2013, 12:12:24 AM




Title: Optimizations for rendering the M-set on GPU?
Post by: laser blaster on April 14, 2013, 12:12:24 AM
Hey. So I was wondering if anyone knew of any ways to optimize rendering the Mandelbrot set. For example, maybe there's a way to define an early accept or reject conditional so you don't have to go through as many iterations. One Idea I came across is to compute the exterior distance estimate (probably every 5-10 iterations, for efficiency), and if the distance estimate begins to converge(i.e., the change between successive estimates is small), then you consider it external to the set, and color it according to its distance (so no iteration count coloring). This works because the exterior distance estimates of interior points never converge, they either grow to negative infinity or cycle between values (something like that). Has anyone tried this method? Does it give a sizable performance increase?

The method I mentioned can only optimize exterior points. Does anyone know of a method to optimize interior points by detecting them early? I'm mostly interested in GPU-friendly methods, so anything involving cycle detection or period counting is out of the question.


Title: Re: Optimizations for rendering the M-set on GPU?
Post by: laser blaster on April 18, 2013, 04:18:29 AM
Hmm, really? No one knows of any other optimization tricks?


Title: Re: Optimizations for rendering the M-set on GPU?
Post by: cKleinhuis on April 18, 2013, 08:46:33 AM
Hi there

You have to consider the trade offs more logik does not neccesarly makes it faster because of the added commands as the gpu method heavily optimizes the repetive things every branch makes it harder for the gpu to apply same algorithm to many pixels so the less dofference in code between pixels the faster it is
correct me if i am wrong

and what you are talking about is the orbit detection the only optimization that i am aware of is to test against zero if your z value at any iteration depth reaches the starting value - normally zero if using mandelbrot method -
You can just leaveyour iteration and consider it as inside


Title: Re: Optimizations for rendering the M-set on GPU?
Post by: laser blaster on April 18, 2013, 07:24:23 PM
Yes, you're right, more tests and more branches will slow down the code, so it might be better to keep it simple rather than introduce complex early-exit conditions. It couldn't hurt to try, though.

I'm pretty sure the optimization that I mentioned is not equivalent to orbit detection. However, I am questioning whether it would work at all. I'm thinking that the vast majority of points will reach the bailout radius before their distance estimation converges to a suitable accuracy. I actually got the idea from someone's webpage on the Mandelbrot DE formula. They mentioned that the distance estimator can be used for some sort of early exit optimization, but now I can't find the link and I don't remember exactly how it worked... I don't think my description is quite the same.


Title: Re: Optimizations for rendering the M-set on GPU?
Post by: cKleinhuis on April 18, 2013, 08:15:10 PM
The pity is that we are dealing with fractals ;) in my personal eyes each optimization has drawbacks and could just improve preview rendering like the succsesiverefinement or others lead to visual artifacts
you might try testing against zero but consider that the perfect looping orbits are very rare basically just in the middles of the circles you have such orbits. ,


Title: Re: Optimizations for rendering the M-set on GPU?
Post by: cKleinhuis on April 18, 2013, 10:58:07 PM
I think what was meant by the distance estimation
was that one you have the distance of a point in space to the set you can basically mark a sphere  all points within that sphere could be considered as outside

but this needs storing of results and you dont have that on a gpu
so some kind of buffering would be needed. . .