home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Homebrewer's Handbook / vr.iso / rend386 / doc / colors.doc next >
Text File  |  1996-03-19  |  3KB  |  62 lines

  1.                            Use of Colors in REND386
  2.                           Version 1.00 -- April 1992
  3.                                  Bernie Roehl
  4.  
  5. The REND386 package associates a 16-bit color value with each polygon in the
  6. rendering database.  They are represented in .plg files as hex numbers.
  7.  
  8. In 256-color mode, this 16-bit value is interpreted as follows:
  9.  
  10.          H R SS CCCC BBBBBBBB
  11.  
  12. The H bit is used internally to mark a polygon as "highlighted"; in the current
  13. implementation, highlighted polygons are outlined along their edges.
  14.  
  15. Externally (i.e. in a .plg file) this same bit is used to indicate that the
  16. color is to be "mapped"; that is, the bottom 15 bits are to be used as an
  17. index into a color map to get the actual value to be used.
  18.  
  19. The R bit is reserved for future expansion, and should be set to zero.
  20.  
  21. The SS bits specify one of four possible surface types, as follows:
  22.  
  23.      00 -- this polygon should be drawn in a fixed color, with no special
  24.            effects.  If the CCCC bits are zero, then the BBBBBBBB bits
  25.            directly specify one of the 256 available colors; if the CCCC
  26.            bits are non-zero, then they specify one of sixteen "base" colors
  27.            and the top four bits of BBBBBBBB specify which shade of that color
  28.            to use.
  29.  
  30.      01 -- this polygon should be drawn with a constant shading that is
  31.            determined by the angle at which light is striking it; thus, as
  32.            the polygon moves around, its apparent brightness will change.
  33.            The CCCC bits specify one of sixteen "base" colors, and the bottom
  34.            8 bits BBBBBBBB represent the "brightness" of the color.  This
  35.            brightness value is multiplied by the cosine of the angle between
  36.            the polygon's normal vector and the vector from the polygon to the
  37.            light source; the result is used to specify an offset into the
  38.            given color's array of shades.
  39.            Note that if the CCCC value is 0, the color will always be black.
  40.  
  41.      10 -- this polygon should be treated as being "metallic"; the CCCC bits
  42.            (which should be non-zero) specify one of the 16 colors, and the
  43.            top 5 bits of the BBBBBBBB value are used as an offset into a
  44.            range of shades to cycle through to give the metallic effect,
  45.            i.e. a starting offset into the color cycle.
  46.  
  47.      11 -- this polygon should be treated as being "transparent"; it is just
  48.            like surface type 10, except that alternating rows of dots are used
  49.            instead of solid colors, allowing you to "see through" the polygon.
  50.  
  51. Other surface types may be defined later; hence the importance of keeping
  52. the R bit set to zero.
  53.  
  54. The actual sequence of colors in the palette is arbitrary; the palette we're
  55. currently using has (in general) a saturated version of each color, and an
  56. unsaturated (watered-down) version.
  57.  
  58. Suggestions for possible new surfaces are welcomed, as are questions
  59. concerning this specification.  Please direct any comments to
  60. broehl@sunee.uwaterloo.ca, and I'll try to respond to them as time
  61. permits.  
  62.