to relax from coding balls i scratched simple
mandelbrot viewer
http://minddetonator.htw.pl/man5.png
http://minddetonator.htw.pl/man5.zip
(win32, no malware)
the problem is hovever colorization,
mandelbrot algorith produces something like
'pixelheight' field or how to call it and there
is not much to do with it (at least i dont want to go into it) but there stays a problem of well colorisation
the subproblems are maybe even numerous (the more to mention the better as it helps well explore the problem)
note a problem is technically just to fill up a "unsigned palette[50000];"array with a strip of well-fitted to mandelbrot colors .. most mandelbrot images i could see are in scope of less than 50k
iterations, probably most are even less than 10k
(in some deeper zooms precision of double endsand
i dont go after that only taking about this normal double-obtainable part)
what i made is generate sinwaves on r,g,b with different periods and use it
const int palette_max = 50*1000+1;
unsigned palette[palette_max];
inline unsigned rgb(int red, int green, int blue)
{
return red*256*256 + green *256 + blue;
}
void InitPalette( double pal_r_coefficient,
double pal_g_coefficient,
double pal_b_coefficient )
{
double pi = 3.14159;
for(int i=0; i<palette_max; i++)
{
int r = int(0+ 125.*(1.0+ cos(double(i) * 2.*pi / pal_r_coefficient) ));
int g = int(0+ 125.*(1.0+ cos(double(i) * 2.*pi / pal_g_coefficient) ));
int b = int(0+ 125.*(1.0+ cos(double(i) * 2.*pi / pal_b_coefficient) ));
palette[i] = rgb( r,g,b );
}
palette[0] = 0x00000000;
}
the problems :
1. randomness
such palettes sometimes gives somewhat good results,
http://minddetonator.htw.pl/hq.png
http://minddetonator.htw.pl/hq4.png
http://minddetonator.htw.pl/man.png
http://minddetonator.htw.pl/hqqq.png
some problem may be sometimes, what most practical i could obtain was to make some palette generation
with those 3 pallette rgb coefficients being random,
if user presses that key that will generate palettes enough times he will probably obtain something good
looking
but i think the nicer would be to randomise from maybe some more shallow set to have a bigger chance to obtain something looking especially well
how to do that?
2. gradient
there may be a problem (i would need research it more) that when you draw manedlbrot pieces on biggers levels of zoom, the typical 'gradient'/distance betwean near pixels on the
image will be probably bigger then those that is common on more shallow zoom levels - as palette generated in a way above has constant period of changes (say 300 ) the color smoothnes can be lost
with bigger gradients (i could rerandomize it and wait foor bigger periods but im not sure is fuch constant period palette may not fail somewhat)
3. coloristic fullnes
im afraid that a palette generated in a way of above is onlya subset of all palettes and those that are generated are not thiose most fancy fairy -looking ones, but how to generate more elaborated ones?
some ideas?