home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Zone / VRZONE.ISO / mac / PC / REND386 / DEMO2 / COLORS.DOC < prev    next >
Text File  |  1992-04-13  |  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.  The
  14. values stored in a .plg file should not have the highlight bit set, since this
  15. will make a polygon appear to be selected when in fact it isn't.
  16.  
  17. The R bit is reserved for future expansion, and should be set to zero.
  18.  
  19. The SS bits specify one of four possible surface types, as follows:
  20.  
  21.      00 -- this polygon should be drawn in a fixed color, with no special
  22.            effects.  If the CCCC bits are zero, then the BBBBBBBB bits
  23.            directly specify one of the 256 available colors; if the CCCC
  24.            bits are non-zero, then they specify one of sixteen "base" colors
  25.            and the top four bits of BBBBBBBB specify which shade of that color
  26.            to use.
  27.  
  28.      01 -- this polygon should be drawn with a constant shading that is
  29.            determined by the angle at which light is striking it; thus, as
  30.            the polygon moves around, its apparent brightness will change.
  31.            The CCCC bits specify one of sixteen "base" colors, and the bottom
  32.            8 bits BBBBBBBB represent the "brightness" of the color.  This
  33.            brightness value is multiplied by the cosine of the angle between
  34.            the polygon's normal vector and the vector from the polygon to the
  35.            light source; the result is used to specify an offset into the
  36.            given color's array of shades.
  37.            Note that the CCCC value should be in the range 1 to 15 inclusive;
  38.            color 0 is special, since it contains 16 "raw"
  39.            colors (used for surface type 00) and therefore has no shading
  40.            capabilites.
  41.  
  42.      10 -- this polygon should be treated as being "metallic"; the CCCC bits
  43.            (which should be non-zero) specify one of the 16 colors, and the
  44.            top 5 bits of the BBBBBBBB value are used as an offset into a
  45.            range of shades to cycle through to give the metallic effect,
  46.            i.e. a starting offset into the color cycle.
  47.  
  48.      11 -- this polygon should be treated as being "transparent"; it is just
  49.            like surface type 10, except that alternating rows of dots are used
  50.            instead of solid colors, allowing you to "see through" the polygon.
  51.  
  52. Other surface types may be defined later; hence the importance of keeping
  53. the R bit set to zero.
  54.  
  55. The actual sequence of colors in the palette is arbitrary; the palette we're
  56. currently using has (in general) a saturated version of each color, and an
  57. unsaturated (watered-down) version.
  58.  
  59. Suggestions for possible new surfaces are welcomed, as are questions
  60. concerning this specification.  Please direct any comments to
  61. broehl@sunee.uwaterloo.ca, and I'll try to respond to them as time
  62. permits.