
 Setpal.c Utility 
 
 This document attempts to explain the setpal utility program.
 
 Setpal is used at the command prompt to create a palette that can
 be used by my demo/engine to show different effects. The various
 command line options are as follows.
 
    setpal read
    
      This reads in and displays the colors of a palette 
previously created by either <write>|<phong>.

    setpal write
    
      This creates a linear palette with the number of shades
entered when prompted by the program. The palette is taken from a PCX file,
the user enters.

    setpal phong
    
      This creates a palette based on the phong illumination
model. Ambient+Diffuse+Specular to better enhance shadings. The user
is asked to enter in the number of shades of each color and initial Ambient
level. For instance you might not want the palette to start at the color
black. If that is the case increase the Ambient level (from 0 ->200) 
appropriately. Shinnyness can also be incorporated in your palette. The
higher the number the more metallic the palette will be. I usually put
15 for Shinnyness. Finally the user is asked to enter the Specular constant.
This makes the highlight bigger (ie. more white will be shown for the 
hightlight.) I like putting the value 55 for this. This gives a nice (but
not to big highlight).

    setpal transparency
   
      This produces a transparency lookup table with X number of levels.
With my current algorithm this table with 10 levels of transparency from
(opaque to 90% transparent) is trully HUGE. 640k and as such can only be
used in a protected mode enviroment.

          
    setpal haze
    
      This produces a table that can simulate haze. The user is prompted
for the number of levels of haze and the color he wants to haze to (r,g,b).

    
    setpal voxel
    
      Finally this produces a shadow table with entered shadow percentage
(0-100%). That is used for my voxel engine. Shadowing is accomplised at its
simplest form by using 0,1 as on/off. If shadow is on then find color that
is closest to the shadow. For example. Using 256 colors the table will be
like this.
               On/Off
            0   1
colors    0
          1
	  .
	  .
	255
	
  If shadow is off, just use same color, else find shadow color. Once we
have this and a shadow mask ( see shmaskl.pcx etc. ) from a pcx file we
can find if shadow is on/off by indexing into shadow table.

    	
