Newsgroups: sci.fractals,bit.listserv.frac-l Path: unixg.ubc.ca!nntp.cs.ubc.ca!cyber2.cyberstore.ca!vanbc.wimsey.com!deep.rsoft.bc.ca!sol.ctr.columbia.edu!usc!elroy.jpl.nasa.gov!newncar!noao!CS.Arizona.EDU!zippy.Telcom.Arizona.EDU!mvb.saic.com!ast.saic.com!jupiter!hilljr From: hilljr@jupiter.saic.com (Jay R. Hill) Subject: Re: A warning to DEEPZOOMers Message-ID: <1994Jan11.212307.19702@ast.saic.com> Followup-To: sci.fractals Keywords: Mandelbrot Set color Lines: 109 Sender: news@ast.saic.com Organization: SAIC References: <1994Jan6.003042.5039@ast.saic.com> Date: Tue, 11 Jan 1994 21:23:07 GMT Xref: unixg.ubc.ca sci.fractals:2734 bit.listserv.frac-l:2479 In article <1994Jan6.003042.5039@ast.saic.com>, hilljr@jupiter.saic.com (Jay R. Hill) writes: |> Version 0.13 is now ready ... There are now 133 potential Mandelmaniacs who have gotten their lastest fix (at my ftp site or by email). |> Several folk have expressed interest in this project. If the |> interest is still there, I may post the source to DEEPZOOM in |> segments (with discussion of technique). DEEPZOOM - I Mandelbrot Set Coloring Method. One of the most enjoyable things about displaying the Mandelbrot Set is actually being able to see all the intricate detail after a lengthy calculation. This depends on a good choice of palette and color algorithm. A good palette is one which has no adjacent colors differing by such a small amount that we can't tell them apart. My favorite palettes have no sudden jumps, but instead return smoothly to the original color. These provide a continuous sequence of colors in the display even if the range of banding is great enough to require more than one pass through the pelette. Pelettes are defined in the RGB coordinate frame, where intensity of Red, Green and Blue are specified by values between 0 and 63. This is an unnatural system for us, so more useful coordinate systems were invented such as HSV (Hue, Saturation, Value). Hue is expressed as an angle in the color wheel. Saturation specifies the amount of white or gray in the color. In DEEPZOOM, I use full saturation since I want as much color separation as I can get. Value is a scaling of the intensity ranging from black to full intensity. In my early experiments, I used maximum Saturation and let the Hue range in equal angles around the color wheel. This resulted in many adjacent colors being indistinguishable near Blue, Green and Red. This color wheel had too few spokes near Cyan, Yellow, and Magenta. Consider the sequence of colors from Green to Yellow. Colors formed by ramping Red linearly from 0 to 63 have too little Red in the steps near Green to be noticable. Larger steps near Green are needed with smaller steps near Yellow. So I tried using a square root (of component/63) scale. This made larger steps when the contribution was small. This scheme is the one I presently use in DEEPZOOM. Here is my C++ code for the palette specification. The global variable 'scales' is the intensity scale factor equivalent to Saturation. The special_scale function is simply a square root which can be changed easily. I use 108 color values to go around the color wheel, starting with number 20. I use XOR to paint the cursor. The colors XOR with 255 are chosen from the opposite side of the color wheel so the cursor is clearly visible. #define COLORSIZE 18 #define BRIGHTEST 63.9 float scale,scales; float special_scale(float c){ return(sqrt(c)); } void SetMyColor(int C, int R, int G, int B){ float red, green, blue, biggest, x; red=special_scale(R/(float)COLORSIZE); biggest=red; green=special_scale(G/(float)COLORSIZE); if(green>biggest)biggest=green; blue=special_scale(B/(float)COLORSIZE); if(blue>biggest)biggest=blue; // I like my colors bright x = scale*BRIGHTEST/biggest; red *= x; green *= x; blue *= x; setrgbpalette(C, (int)red, (int)green, (int)blue); } void MyPalette(void){ int C=20,R,G,B; scale=scales; // Colors for escapers for(R=G=0,B=COLORSIZE; G0; --B,++C) SetMyColor(C,R,G,B);//C-G for(R=B=0,G=COLORSIZE; R0; --G,++C) SetMyColor(C,R,G,B);//Y-R for(G=B=0,R=COLORSIZE; B0; --R,++C) SetMyColor(C,R,G,B);//M-B // and now for the XOR colors (for the cursor and interior) C=255^20; scale=1.0; for(B=0,R=G=COLORSIZE; G>0; --G,--C) SetMyColor(C,R,G,B);//Y-R for(G=B=0,R=COLORSIZE; B0; --R,--C) SetMyColor(C,R,G,B);//M-B for(R=G=0,B=COLORSIZE; G0; --B,--C) SetMyColor(C,R,G,B);//C-G for(R=B=0,G=COLORSIZE; R