4

This is my progress with a mandelbrot fractal generation:

enter image description here

It appears with cases where the edge cases between colors are small, it has a good "blending" effect. However, as the distance between colors become larger, you can see very explicitly and evidently the separation of colors. I was wondering, how would I achieve a blending effect without using something like bicubic interpolation post-processing?

Attached is the code I have to generate the fractal:

public static void drawFractal()
{
    Complex Z;
    Complex C;

    double x;
    double y;

    // The min and max values should be between -2 and +2
    double minX = -2.0; // use -2 for the full-range fractal image
    double minY = -2.0; // use -2 for the full-range fractal image
    double maxX = 2.0; // use 2 for the full-range fractal image
    double maxY = 2.0; // use 2 for the full-range fractal image

    double xStepSize = ( maxX - minX ) / width;
    double yStepSize = ( maxY - minY ) / height;
    int maxIterations = 100;
    int maxColors = 0xFF0000;

    // for each pixel on the screen
    for( x = minX; x < maxX; x = x + xStepSize)
    {
        for ( y = minY; y < maxY; y = y + yStepSize )
        {
            C = new Complex( x, y );
            Z = new Complex( 0, 0 );
            int iter = getIterValue( Z, C, 0, maxIterations );

            int myX = (int) ( ( x - minX ) / xStepSize );
            int myY = (int) ( ( y - minY ) / yStepSize );
            if ( iter < maxIterations )
            {
                myPixel[ myY * width + myX ] = iter * ( maxColors / maxIterations ) / 50; 
            }
        }
    }
}
user2864740
  • 60,010
  • 15
  • 145
  • 220
theGreenCabbage
  • 5,197
  • 19
  • 79
  • 169

0 Answers0