home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / uray / spec / microray.txt < prev   
Text File  |  1994-06-01  |  9KB  |  229 lines

  1. /************************************************************************
  2.  *                                    *
  3.  *            Copyright (c) 1988, David B. Wecker            *
  4.  *                All Rights Reserved                *
  5.  *                                    *
  6.  * This file is part of DBW_uRAY                    *
  7.  *                                    *
  8.  * DBW_uRAY is distributed in the hope that it will be useful, but    *
  9.  * WITHOUT ANY WARRANTY. No author or distributor accepts        *
  10.  * responsibility to anyone for the consequences of using it or for    *
  11.  * whether it serves any particular purpose or works at all, unless    *
  12.  * he says so in writing. Refer to the DBW_uRAY General Public        *
  13.  * License for full details.                        *
  14.  *                                    *
  15.  * Everyone is granted permission to copy, modify and redistribute    *
  16.  * DBW_uRAY, but only under the conditions described in the        *
  17.  * DBW_uRAY General Public License. A copy of this license is        *
  18.  * supposed to have been given to you along with DBW_uRAY so you    *
  19.  * can know your rights and responsibilities. It should be in a file    *
  20.  * named LICENSE. Among other things, the copyright notice and this    *
  21.  * notice must be preserved on all copies.                *
  22.  ************************************************************************
  23.  *                                    *
  24.  * Authors:                                *
  25.  *    DBW - David B. Wecker                        *
  26.  *                                    *
  27.  * Versions:                                *
  28.  *    V1.0 881023 DBW    - First released version            *
  29.  *    V1.1 881110 DBW - Fixed scan coherence code            *
  30.  *    V1.2 881125 DBW - Removed ALL scan coherence code (useless)    *
  31.  *              added "fat" extent boxes            *
  32.  *    V1.3 881203 DBW - Fixed single precision TOLerances        *
  33.  *                                    *
  34.  ************************************************************************/
  35.  
  36. DBW_uRAY (micro raytracer) is a small raytracer developed for my own test
  37. purposes and made available to anyone who wishes to play with ray tracing
  38. algorithms. It runs on several different machines in many different
  39. configurations. It has been tested on:
  40.  
  41.     Amiga 68000/68010/68020 with/without 68881 (using Manx 3.6 compiler)
  42.     Vax   Ultrix and VMS
  43.  
  44. Its features are:
  45.  
  46.     -    VERY good ray tracing algorithm
  47.     -    Automatic oct-tree extent generation for FAST ray tracing
  48.     -    Simple input file format
  49.     -    SMALL easy to read code
  50.     -    very portable
  51.     -    built in advanced features like waves and textures
  52.     -    generates .ILBM files directly
  53.     -    generates .TMP files (compatable with DBW_RENDER v2.0)
  54.     -    easy to extend
  55.     -    progammable aspect ratio and angle of view
  56.     -    single or double precision floating point
  57.     -    automatic (no overhead) sky and ground generation
  58.     -    dithered .ILBM file for much more accurate color reproduction
  59.     -    can generate 24 bit .TMP files ( 16 million colors )
  60.     -    can generate pictures upto 1024 x 1024
  61.  
  62. =================
  63. INPUT FILE FORMAT
  64. =================
  65.  
  66. See URAY.DAT for a sample input file. The options are:
  67.  
  68.     DEPTH   - Maximum recursion depth
  69.     COLS    - columns in the picture
  70.     ROWS    - rows in the picture
  71.     START   - row to start raytracing at
  72.     END        - row to end with
  73.     BPP        - Bits/Pixel in the .tmp file (24,12 or 0 (== no .tmp file wanted))
  74.     AOV        - angle of view (in degrees) <<<<YOUR EYE IS ALWAYS AT 0,0,0>>>>   
  75.     ASPECT  - aspect ratio (For Amiga use .544)
  76.     NEAR    - ambient (background color for "sky" near the eye)
  77.     FAR        - ambient (background color for "sky" far from the eye (horizon))
  78.     GROUND  - ambient (background color below the horizon (y < 0))
  79.     BASE    - minimum diffuse lighting for any object (blackness of shadows)
  80.  
  81. The background is made up of three colors:
  82.  
  83.     NEAR    - the sky overhead
  84.     FAR        - the sky at the horizon
  85.     GROUND  - the ground color
  86.  
  87. Wave sources are listed with a "WAVES" statement. Parameters are:
  88.  
  89.     WAVES n    - n is the number of lines that follow. Each line has 6 numbers:
  90.     x y z    - center of the wave
  91.     amp    - initial amplitude of the wave
  92.     phase    - initial phase shift
  93.     length    - wavelength
  94.     damp    - damping from wave to wave
  95.  
  96. Attributes are listed with an "ATTRIBUTES" statement. Parameters are:
  97.  
  98.     ATTRIBUTES n    - n is the number of lines containing:
  99.     r g b    - base diffuse color
  100.     Kd    - amount of diffuse coloring
  101.     Ks    - specular factor (reflection)
  102.     Kt    - transmission factor (transparency)
  103.     Ir    - index of refraction (for Kt) 1.0 = none
  104.     Kl    - self lighting factor (light source)
  105.     dist    - inverse square law distance (0 = no inv sq law)
  106.     Kf    - fuzz factor (0 = none 1 = max)
  107.     Wave    - wave number (starts at 0) or -1 = no waves -2 = all waves
  108.     tex    - texture:
  109.         0            - none
  110.         1 r g b x y z   - checker in color (r g b) at scale (x y z)
  111.         2 r g b        - random mottled (alternate color = r g b)
  112.         3 r g b a b c   - X axis blend (alt = r g b, X range= a - b - c)
  113.         4 r g b a b c   - Y axis blend (alt = r g b, Y range= a - b - c)
  114.         5 r g b a b c   - Z axis blend (alt = r g b, Z range= a - b - c)
  115.  
  116. Note: When refering to waves or attributes the first one defined is number 0
  117.       the next is number 1 and so forth.
  118.  
  119. Finally objects:
  120.  
  121.     SPHERE a x y z r        - Do a sphere with attribute a (>= 0)
  122.                   Center at (x y z) with radius r
  123.     QUAD a x y z i j k l m n    - Do a rectangle with attribute a (>= 0)
  124.                   Corners at (x y z), (x+i y+j z+k), and
  125.                     (x+l y+m z+n)
  126.     TRIANGLE a x y z i j k l m n- Do a triangle with attribute a (>= 0)
  127.                   Corners at (x y z), (x+i y+j z+k), and
  128.                     (x+l y+m z+n)
  129.     RING a x y z i j k l m n b c- Do a ring with attribute a (>= 0)
  130.                   Corners at (x y z), (x+i y+j z+k), and
  131.                     (x+l y+m z+n) inner radius b and outer
  132.                     radius c
  133.  
  134. ===================
  135. RUNNING THE PROGRAM
  136. ===================
  137.  
  138. If you have an input file called input.dat then just type:
  139.  
  140.     uray input
  141.  
  142. and the program will run giving output like the following:
  143.  
  144.     uRAY v1.2 881125 (C) 1988 D. Wecker - all rights reserved
  145.     Creating objects
  146.  
  147.     Input file name:          input
  148.     Maximum recursion depth:     20
  149.     Dimensions:                 200 rows (0,200)  160 columns
  150.     Bits/Pixel:                  24
  151.     Angle of view:               60 degrees
  152.     Aspect ratio:             0.544
  153.     Number of attributes:         6
  154.     Number of waves:              1
  155.  
  156.     Creating object extents
  157.     Creating extent tree
  158.     Using 2 extents for 2 objects
  159.  
  160.  
  161.     Extent setup time:         0.17
  162.  
  163.     Row    0: ..................................................
  164.     Row   50: ..................................................
  165.     Row  100: ..................................................
  166.     Row  150: .................................................
  167.  
  168.  
  169.     Total  run   time:       115.40
  170.  
  171.     False hits: Extents =      60215, Nodes =       5077
  172.     Good  hits: Extents =       6829, Nodes =       1752
  173.     Total hits: Extents =      67044, Nodes =       6829
  174.  
  175. To display the file on the Amiga, just say:
  176.  
  177.     display input
  178.  
  179. Type a <CR> to exit the display.
  180.  
  181. =====
  182. FILES
  183. =====
  184.  
  185.     README        - This file
  186.     LICENSE        - License agreement
  187.     Makefile        - rebuild control (see later section)
  188.     Make.version    - retitle source files
  189.  
  190.     display.c        - ILBM display program for the Amiga
  191.  
  192.     extent.c        - automatic oct-tree extent generator
  193.     intersect.c        - ray intersection calculations
  194.     output.c        - output file generation (.ILBM and .TMP)
  195.     random.c        - random number generator
  196.     rkm.c        - RKM compression routines (for .ILBM files)
  197.     support.c        - file input and support routines
  198.     texture.c        - texture calculations
  199.     trace.c        - actual ray tracing code
  200.     uray.c        - main module
  201.     uray.h        - global definitions
  202.     uray.dat        - sample input file
  203.  
  204.     uray_ux        - compiled Ultrix version
  205.     uray_vm        - compiled VMS version
  206.     uray_sp        - compiled Amiga single precision version
  207.     uray_dp        - compiled Amiga double precision version
  208.     uray_cp        - compiled Amiga co-processor (68881) version
  209.     uray_2s        - compiled Amiga 68020/single precision version
  210.     uray_2d        - compiled Amiga 68020/double precision version
  211.     uray_2c        - compiled Amiga 68020/68881 (coprocessor) version
  212.     display        - compiled Amiga display program
  213.  
  214. Rename the "uray_??" file that you wish to use to "uray".
  215.  
  216. ========
  217. MAKEFILE
  218. ========
  219.  
  220. For the Amiga, uncomment the appropriate definitins of FFLG, DBL and MLIB for
  221. the type of processor/coprocessor and precision you want. Also uncomment the
  222. "Standard flags" for the type of machine that you're on. Then:
  223.  
  224.     make uray display
  225.  
  226. will re-make the ray-tracer and the display programs. See the Makefile for
  227. further details.
  228.  
  229.