Smooth spectrum for Mandelbrot Set rendering

后端 未结 7 1991
梦毁少年i
梦毁少年i 2020-11-28 04:40

I\'m currently writing a program to generate really enormous (65536x65536 pixels and above) Mandelbrot images, and I\'d like to devise a spectrum and coloring scheme that do

7条回答
  •  一向
    一向 (楼主)
    2020-11-28 05:24

    This is the smooth color algorithm:

    Lets say you start with the complex number z0 and iterate n times until it escapes. Let the end point be zn.

    A smooth value would be

    nsmooth := n + 1 - Math.log(Math.log(zn.abs()))/Math.log(2)
    

    This only works for mandelbrot, if you want to compute a smooth function for julia sets, then use

    Complex z = new Complex(x,y);
    double smoothcolor = Math.exp(-z.abs());
    
    for(i=0;i

    Then smoothcolor is in the interval (0,max_iter).

    Divide smoothcolor with max_iter to get a value between 0 and 1.

    To get a smooth color from the value:

    This can be called, for example (in Java):

    Color.HSBtoRGB(0.95f + 10 * smoothcolor ,0.6f,1.0f);
    

    since the first value in HSB color parameters is used to define the color from the color circle.

提交回复
热议问题