Welcome to Fractal Forums

Fractal Software => Programming => Topic started by: asimes on August 18, 2013, 06:45:23 AM




Title: Mandelbrot / Julia explorer, JavaScript / Canvas
Post by: asimes on August 18, 2013, 06:45:23 AM
A while back I made a Mandelbrot explorer for the web (it doesn't exist anymore). I recently remade some of my old projects and wrote this again, it can be found here: http://alexsimes.com/index.php?foo=visual%20programming&bar=mandelbrot%20set

It has been a while since I've been programming fractals, I'd appreciate any feedback (figured the opinions here are quite good for web feedback). It should run fastest in Chrome.


Title: Re: Mandelbrot / Julia explorer, JavaScript / Canvas
Post by: hsmyers on August 18, 2013, 12:27:22 PM
Fun! That said, at an xMin and yMin of -1.8622012645774517, -4.610046426163813e-10 and an area of 9.313225746154785e-10 image is almost completely washed out. Could you tinker with the coloring algorithm such that contrast between inner and outer is always constant? Also your text boxes need to be larger  :dink:

--hsm


Title: Re: Mandelbrot / Julia explorer, JavaScript / Canvas
Post by: asimes on August 18, 2013, 07:18:37 PM
I actually do not know what to do to make the color constant for deeper zooms. Is the general idea to keep track of the lowest and highest number of iterations and then scale the coloring to that? I'm hoping not, I'm rendering the fractal in 16 passes and assigning pixel values as soon as I am done iterating over a pixel.

This is my color logic at the moment (n is the number of iterations):
Code:
var fn = n+1.0-Math.log(Math.log(Math.sqrt(zr*zr+zi*zi)))/Math.log(2.0);
var logVal = (Math.log(fn)/Math.log(this.maxIterations)*255.0)|0;

Some notes:
- The *255.0 gets it from (0.0 to 1.0) to (0.0 to 255.0).
- The |0 is a JavaScript trick to make it an integer.


Title: Re: Mandelbrot / Julia explorer, JavaScript / Canvas
Post by: Gluecker on August 18, 2013, 09:56:25 PM
you might want to try Histogram Mapping or Rank-Order Mapping but you need to store and iterate the values then...
http://www.fractalforums.com/programming/non-parametric-color-mapping-techniques/


Title: Re: Mandelbrot / Julia explorer, JavaScript / Canvas
Post by: asimes on August 18, 2013, 10:26:21 PM
I was afraid of that, I liked the fractal being rendered in 16 steps as a fade in. It also helped keep the browser from freezing up on too long of a calculation (when a render that has mostly n == maxIterations). Maybe after it is done being rendered I'll make an "increase contrast" step based one the assigned values.