🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.fractals
Article #413

Re: A warning to DEEPZOOMers

#413
From: Jay R. Hill
Date: Tue, 11 Jan 1994 21:23
109 lines
5804 bytes
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; G<COLORSIZE; ++G,++C) SetMyColor(C,R,G,B);//B-C
  for(R=0,B=G=COLORSIZE; B>0; --B,++C)         SetMyColor(C,R,G,B);//C-G
  for(R=B=0,G=COLORSIZE; R<COLORSIZE; ++R,++C) SetMyColor(C,R,G,B);//G-Y
  for(B=0,R=G=COLORSIZE; G>0; --G,++C)         SetMyColor(C,R,G,B);//Y-R
  for(G=B=0,R=COLORSIZE; B<COLORSIZE; ++B,++C) SetMyColor(C,R,G,B);//R-M
  for(G=0,R=B=COLORSIZE; R>0; --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; B<COLORSIZE; ++B,--C) SetMyColor(C,R,G,B);//R-M
  for(G=0,R=B=COLORSIZE; R>0; --R,--C)         SetMyColor(C,R,G,B);//M-B
  for(R=G=0,B=COLORSIZE; G<COLORSIZE; ++G,--C) SetMyColor(C,R,G,B);//B-C
  for(R=0,B=G=COLORSIZE; B>0; --B,--C)         SetMyColor(C,R,G,B);//C-G
  for(R=B=0,G=COLORSIZE; R<COLORSIZE; ++R,--C) SetMyColor(C,R,G,B);//G-Y
  // and make the cursor WHITE over the filements
  setrgbpalette(255 ^ LIGHTGRAY, 63, 63, 63);
  setrgbpalette(255 ^ DARKGRAY, 63, 63, 63);
  setrgbpalette(255 ^ BLACK, 63, 63, 63);
  setrgbpalette(255 ^ WHITE, 0, 0, 0);
}

Warmly,
Jay "It's tonight honey, let's paint the town" Hill
-- 
{ hilljr@jupiter.saic.com } begin writeln(3*ln(640320)/sqrt(163):17:15) end.
void main(){double sqrt(), y=1/sqrt(2.), a=.5, m=1,z; int n=0;
for(;m*=2,z=sqrt(1-y*y),y=(1-z)/(1+z),a=a*(1+y)*(1+y)-m*y,n<4;n++);
printf("%17.15lf\n",1/a);}
Technical Details
Message-ID: <1994Jan11.212307.19702@ast.saic.com>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!newncar!noao!CS.Arizona.EDU!zippy.Telcom.Arizona.EDU!mvb.saic.com!ast.saic.com!jupiter!hilljr
References: <1994Jan6.003042.5039@ast.saic.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff06e,237ac1eabeb41786
X-Google-Attributes: gidff06e,public
X-Google-Thread: 10ed18,237ac1eabeb41786
X-Google-Attributes: gid10ed18,public
X-Google-ArrivalTime: 1994-01-11 15:21:35 PST
Newsgroups: sci.fractals,bit.listserv.frac-l
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!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