home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / oort10.zip / README
Text File  |  1993-12-07  |  16KB  |  373 lines

  1.               OORT - Object Oriented Ray Tracer
  2.                    Disk Set Documentation
  3.                          Version 1.0
  4.  
  5.         OORT is copyright (C) 1994 by Nicholas Wilt.
  6.  
  7. This software product may be freely copied and distributed
  8. in unmodified form but may not be sold.  A nominal
  9. distribution fee may be charged for media and handling by
  10. freeware and shareware distributors.  The software product
  11. may not be included in whole or in part into any commercial
  12. package without the express written consent of the author.
  13.  
  14. This software product is provided as is without warranty of
  15. any kind, express or implied, including but not limited to
  16. the implied warranties of merchantability and fitness for a
  17. particular purpose.  The author assumes no liability for any
  18. alleged or actual damages arising from the use of this
  19. software.  The author is under no obligation to provide
  20. service, corrections or upgrades to this software.
  21.  
  22.  
  23.      Despite the disclaimer above, I welcome suggestions and
  24. feedback on OORT.  Please feel free to contact me at my
  25. CompuServe address (75210,2455 or 75210.2455@compuserve.com
  26. from the Internet).
  27.  
  28.      This distribution contains the source code that
  29. accompanies my book, _Object-Oriented Ray Tracing in C++_.
  30. If you are interested in ray tracing, or if you want to
  31. understand OORT in more detail, you can call John Wiley &
  32. Sons at 1-800-CALLWILEY (1-800-225-5945) to order it.
  33. Alternatively, you can find it in a local bookstore or
  34. have them order it for you (ISBN 0471 304 158, $36.95).
  35.  
  36.      The book assumes some knowledge of 3D computer
  37. graphics.  It includes lots of references so readers can
  38. pursue their own research, too.  The topics covered include
  39. the following:
  40.  
  41.      -    Vectors and matrices for computer graphics.
  42.      -    Standard Hall shading model with ambient, diffuse,
  43.           specular, reflective and transparent components.
  44.      -    Rendering various primitives (planes, rings,
  45.           polygons, spheres, bounding boxes, quadrics, CSG
  46.           and algebraic surfaces).
  47.      -    Ray tracing acceleration.  OORT implements
  48.           Goldsmith and Salmon's automatic bounding volume
  49.           hierarchy generation for speed.  It also includes
  50.           a hand-coded 80x87 assembler routine to intersect
  51.           a ray with a bounding box.
  52.      -    Texture mapping.  Procedural and solid texturing
  53.           is described.  OORT implements a bunch of inverse
  54.           mappings (sphere, cone, cylinder, quadrilateral,
  55.           circle).
  56.      -    Distribution ray tracing for antialiasing, soft
  57.           shadows, and imperfectly reflective and
  58.           translucent objects.
  59.      -    Statistical optimization to make the distribution
  60.           ray tracing go faster.
  61.      
  62.      OORT is a class library for ray tracing.  As such, it
  63. does not implement an input language or interactive user
  64. interface. Currently, images are described to the ray tracer
  65. using calls into the class library.  This is surprisingly
  66. painless; unlike C code, C++ is almost as intuitive as the
  67. input language of a ray tracer.  In addition, C++ is much
  68. more powerful than any ray tracer input language; it has
  69. loop constructs, functions and support for abstract data
  70. types.  Finally, C++ debugging tools are much more
  71. sophisticated than the debugging tools that are available
  72. for proprietary ray tracer input languages.
  73.      All these protestations are not to say that no
  74. interactive user interface for OORT is in the works.  I plan
  75. to develop an interactive user interface for OORT, and may
  76. provide parsers for other ray tracers' input languages.  But
  77. for now, if you want to make pictures using OORT, you have
  78. to develop in C++.
  79.  
  80. The directory structure is as follows:
  81. README         This file documents the disk contents.
  82. OORT\          Contains the OORT class library and
  83.                examples.
  84.   EXAMPLES\    Contains a variety of examples usages of
  85.                OORT.  Each example is in its own
  86.                subdirectory.
  87.   INCLUDE\     Contains include files for OORT.
  88.   LIB\         Library directory.  This will contain the
  89.                OORT library after it has been built.
  90.   SOURCE\      Contains implementation files for OORT.
  91.   UTILS\       Contains source code for the Utilities
  92.                library for OORT.
  93. RAW2GIF\       Contains source code and compiled
  94.                executables for RAW2GIF, a program that
  95.                converts OORT output files to the popular
  96.                GIF format.
  97. SPLICE\        Contains source code for Splice, a program
  98.                that splices together multiple .RAW files
  99.                that are portions of the same image.
  100.  
  101.      To use OORT, you must first copy it to its own
  102. subdirectory and build it.  You can use the PKUNZIP command
  103. to uncompress the contents of the distribution as follows:
  104.      pkunzip -d oort10.zip
  105. The -d parameter instructs PKUNZIP to copy subdirectories.
  106. The above command will copy the entire disk onto your hard
  107. drive, creating root directories named OORT, RAW2GIF, and
  108. SPLICE.  If you want to use RAW2GIF or SPLICE, you may want
  109. to add the appropriate directories to your path.
  110.  
  111. OORT was developed and tested using Borland C++, so all of
  112. the following descriptions apply to that development
  113. environment.
  114.  
  115. Overview
  116.  
  117.      For more information on developing with OORT, please
  118. refer to Appendixes E-G of my book, Object-Oriented Ray
  119. Tracing in C++.
  120.  
  121. To render images using OORT, you must follow these steps in
  122.      order:
  123. 1) Build the library.
  124. 2) Build the utilties library.
  125. 3) Build an OORT application that links against the library.
  126.   The EXAMPLES directory contains a number of these.)
  127. 4) Run the application.  You can provide command-line
  128.   arguments to this application to change the resolution of
  129.   the target image, turn on antialiasing, etc.  When it
  130.   completes successfully, this program will generate an
  131.   output file with the default extension .RAW.
  132. 5) Run RAW2GIF on the resulting .RAW to convert it to GIF
  133.   format.
  134. 6) Display the GIF image on your screen using a GIF viewer.
  135.  
  136.      These steps are detailed below.
  137.  
  138. 1) Build the library.
  139.  
  140.      Before using OORT, you must build the library.  Change
  141. to the OORT implementation directory by typing:
  142.      cd \oort\source
  143. If you want to run OORT under Windows, type
  144.      make -fmakefile.win
  145. If you want to run OORT under DOS, type
  146.      make -fmakefile.dos
  147.  
  148. Be sure you are executing Borland's Make utility on these
  149. makefiles.  Other Make utilities are not guaranteed to work!
  150.  
  151. The makefiles can be tweaked if the default settings are not
  152. satisfactory.  The following variables are defined in the
  153. makefile to build OORT:
  154.  
  155. INCLUDES       Gives -I command lines as needed, to
  156.                specify directories where the compiler can
  157.                find include files.  The default is
  158.                "..\include", which will work as long as
  159.                you copied the files exactly as they were
  160.                on the diskette.
  161. LIBDIR         Gives the directory to write the library
  162.                to.  The default is "..\lib".  Make sure
  163.                there is an empty directory \OORT\LIB on
  164.                your disk.
  165. WARNS          Turns off some of the more tiresome
  166.                compiler warnings, such as "possibly
  167.                incorrect assignment."
  168. MODEL          Memory model to use.  The default is large
  169.                (-ml).
  170. OPTS           Optimizations to use.  The default is "no
  171.                optimization" (-Od).  To turn on maximum
  172.                optimization, comment out the line "OPTS=-
  173.                Od" and remove the comment for the other
  174.                optimizations line, which contains the
  175.                following arguments:
  176.                
  177.                -vi       Enable inline functions
  178.                -Ox       Maximum optimization
  179.                -386      386 or better target machine
  180.                -DASM     Enable assembler
  181.                -f87      Coprocessor in target machine
  182.                
  183.                Remove "-3" if you are targeting 286 or
  184.                earlier machines.  Remove "-f87" if you
  185.                want OORT to run on machines without
  186.                coprocessors (a masochistic endeavor).
  187.  
  188. After successfully building OORT, you should have a file
  189. called OORT.LIB in the LIB directory of your OORT directory
  190. structure.
  191.  
  192. 2) Build the Utilities library.
  193.  
  194. To build the Utilities library, switch directories to
  195. \OORT\UTILS.  If you want to run OORT under Windows, type
  196.      make -fmakefile.win
  197. If you want to run OORT under DOS, type
  198.      make -fmakefile.dos
  199.  
  200. If the OORT makefile had to be edited in Step 1, then the
  201. makefile in this directory must be edited as well.  See the
  202. description of how to edit the OORT makefiles above.
  203.  
  204. After successfully building the Utilities library, you
  205. should have a file called UTILS.LIB in the LIB directory.
  206. You can now build and run examples.
  207.  
  208. 3) Build an OORT application that links against the library.
  209.  
  210. IF YOU ARE RUNNING OORT UNDER WINDOWS:
  211.  
  212. Use the Windows-hosted Borland C++ IDE to open the project
  213. (.PRJ) file for the example you would like to build (Select
  214. "Open..." from the Project menu).  To build the program,
  215. select "Make..." from the Compile menu.
  216.  
  217. After building the application, you can run it by choosing
  218. "Run" from the Run menu.  You can modify the command-line
  219. arguments to the program by selecting "Arguments..." from
  220. the Run menu.  A complete list of command-line arguments is
  221. given below.
  222.  
  223.  
  224. You can also build the example from DOS or a DOS shell by
  225. using Make. Type:
  226.  
  227.      make -fmakefile.win
  228.  
  229. Once the application is built, it can be run using the
  230. Borland C++ IDE, as described above, or it can be invoked
  231. from the "Run..." command in the File menu of the Program
  232. Manager.
  233.  
  234. See the following section for information on what command-
  235. line arguments are valid for the application.
  236.  
  237. IF YOU ARE RUNNING OORT UNDER DOS:
  238.  
  239. Use the Makefile in the example's directory to build the
  240. program. Type:
  241.      make -fmakefile.dos
  242.  
  243. Whether you are running under DOS or Windows, the result of
  244. building an example program will be a very large (~800K-1M)
  245. executable program (Most of this disk space is taken up by
  246. debugging symbols, not code.)  This executable program takes
  247. command-line parameters to determine the resolution of the
  248. image to render, which part of the image to render, whether
  249. to anti-alias the image, and other parameters.
  250.  
  251. 4) Run the application.
  252.  
  253. The command-line parameters for an OORT application is as
  254. follows.
  255.  
  256. Antialiasing options:         
  257.      -anti                    Antialias the image.
  258.      -min[n]                  Minimum number of samples to
  259.                               take for each pixel.  The
  260.                               default is 4.
  261.      -max[n]                  Maximum number of samples to
  262.                               take for each pixel.  The
  263.                               default is 16.
  264. Rendering options:            
  265.      -e[end]                  Gives ending scanline.
  266.                               Default is height.
  267.      -h[height]               Gives height of the output
  268.                               image.  Default is 200.
  269.      -s[start]                Gives starting scanline.
  270.                               Default is 0.
  271.      -w[width]                Gives width of the output
  272.                               image.  Default is 320.
  273. Miscellaneous options:        
  274.      -S[filename]             Append statistics to the
  275.                               given file.
  276.      -o[filename]             Sends image to the given
  277.                               file (default extension is
  278.                               .RAW).
  279.  
  280.  
  281. Example invocations:
  282.      csgdemo -w1024 -h768
  283.        Renders the CSGDEMO example at 1024x768 resolution.
  284.           Not specifying an output file instructs the
  285.           program to write to the default output file, which
  286.           is given as CSGDEMO.RAW.
  287.  
  288.      csgdemo -anti -min8
  289.        Invokes the CSGDEMO example.  Writes out a 320x200
  290.           image (the default size).  The image is anti-
  291.           aliased, with a minimum of 8 samples taken for
  292.           each pixel.
  293.        
  294.      csgdemo -w1024 -h768 -s0 -e256 -ocsgdemo1
  295.      csgdemo -w1024 -h768 -s256 -e512 -ocsgdemo2
  296.      csgdemo -w1024 -h768 -s512 -e768 -ocsgdemo3
  297.        These three command lines render the image at
  298.           1024x768 resolution in three segments.  They can
  299.           be invoked on separate computers to split the work
  300.           three ways.  The resulting output files,
  301.           CSGDEMO1.RAW, CSGDEMO2.RAW, and CSGDEMO3.RAW can
  302.           be spliced into a single file with the Splice
  303.           program, as follows:
  304.        
  305.               splice csgdemo1 csgdemo2 csgdemo3 -ocsgdemo
  306.        
  307.          This results in a single file CSGDEMO.RAW that can
  308.           be quantized with RAW2GIF and displayed using a
  309.           GIF viewer.
  310.  
  311. 5) Run RAW2GIF on the resulting .RAW file.
  312.  
  313.      Color quantization is the process of choosing a limited
  314. number of colors to represent a full-color image.  There are
  315. several reasons to perform color quantization on an image.
  316. One is compression: if you quantize a 24-bit image to an
  317. image with less precision, you get a corresponding decrease
  318. in size.  The primary reason to quantize an image, however,
  319. is for display.
  320.      Many computers, including most PC compatibles with VGA
  321. and SuperVGA, are limited to displaying 256 or fewer colors
  322. at once.  For such computers, images must be quantized
  323. before they can be displayed.  RAW2GIF takes an output file
  324. from the ray tracer, quantizes the image, and writes out a
  325. file using the Graphics Interchange Format (GIF).
  326.      GIF is a proprietary image file format used by
  327. CompuServe that has many advantages for our application.
  328. Many public domain or shareware programs can read and
  329. display GIF images, so displaying our output images is not a
  330. problem.  Also, GIF has built-in LZW compression and ray-
  331. traced images tend to be very compressible.  The GIF file
  332. resulting from a call to RAW2GIF is often an order of
  333. magnitude smaller than the original RAW file.
  334.      RAW2GIF uses the popular median-cut quantization
  335. algorithm as described by Heckbert in SIGGRAPH '82, p. 297.
  336. The command-line options are as follows.
  337.  
  338. Command-Line Options
  339.   -[num]    Specify the number of colors to quantize to.
  340.             This number must be a power of 2 in the range 2-
  341.             256.
  342.   -d        Perform Floyd-Steinberg dithering on the image.
  343.             Turning this option on will significantly
  344.             increase the time required to write the image,
  345.             but it may reduce objectionable artifacts in
  346.             the image due to aliasing.  Dithering can also
  347.             increase the memory requirements.
  348.   -i[file]  Specify an input file.  The default extension
  349.             is .RAW.
  350.   -o[file]  Specify an output file.  The default extension
  351.             is .GIF.
  352.  
  353. Example invocations:
  354.  
  355.      raw2gif balls
  356.           Quantizes balls.RAW to 256 colors (no dithering)
  357.           and writes the resulting image out to balls.GIF.
  358.      raw2gif -d -16 specular
  359.           Quantizes specular.RAW to 16 colors with
  360.           dithering, and writes the resulting image out to
  361.           specular.GIF.
  362.      raw2gif -ispecular. -ospheres.gif
  363.           Takes as input the file "specular" (no extension),
  364.           quantizes it to 256 colors without dithering and
  365.           writes the resulting image out to spheres.GIF.
  366.  
  367. 6) Look at the quantized image using any GIF viewer.
  368.  
  369. If you don't have one, there are dozens of public domain and
  370. shareware ones.  Check your local bulletin board or
  371. information service.  If you can't find one, email me and
  372. I'll send you a copy of a shareware GIF viewer for DOS.
  373.