home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / graphics / utility / raymovi2.lzh / RAYMOVI2 / RAYMOVI.DOK (.txt) < prev    next >
Text File  |  1988-12-21  |  11KB  |  279 lines

  1.             RAYMOVI.PRG
  2.  
  3.    RAYMOVI.PRG renders 3-dimensional scenes in a world of reflective and 
  4. refractive spheres, using ray tracing techniques. Movies formed from
  5. sequences of frames can be generated, showing reflective balls linked and 
  6. bouncing in a gravitational field. They resemble a string of bouncing pearls.
  7.  
  8.    The amount of computation required to produce one ray traced image is 
  9. enormous -- on an ST it is measured in hours. To get animated effects,
  10. images must be precomputed in (overnight) batch runs. RAYMOVI provides the 
  11. ability to save sequences of images on disk in Degas PI1 format, for later 
  12. replay by BLASTRAM.TTP (also included).
  13.  
  14.    RAYMOVI.PRG generates a low resolution approximation of each picture first,
  15. followed by refinement to successively higher resolutions. In this way, 
  16. a rough image is seen quickly for (somewhat) interactive debugging. Scenes 
  17. can be changed without recompilation of RAYMOVI.PRG -- the size, position, 
  18. velocity and optical properties of the balls in the scenes are specified 
  19. numerically in the initialization files.
  20.  
  21.    The ray tracing heart of RAYMOVI was taken from net.sources, documented
  22. Fredrich Knauss of University of California, San Diego. I've ported it to 
  23. the ST, added animation, (primitive) color, and the various other features
  24. you see here. I place RAYMOVI in the public domain, for non-comercial use only.
  25.  
  26.    RAYMOVI.PRG runs only on a color ST in low resolution. 1 Meg is required 
  27. to generate images with resolutions greater than one ray per pixel or for 
  28. replay of movies from RAM. Operation with only 512K is possible, but will 
  29. produce slightly aliased pictures (one ray per pixel) which can only be 
  30. displayed statically, slowly from floppy, or from hard disk (if you have 
  31. a disk blaster program).
  32.  
  33.    The rest of this document contains sections entitled Getting Started, 
  34. Configuration File Format, and Checkpointing. The sources are available 
  35. upon request. With enough interest I could post them.
  36.  
  37.  
  38.  
  39.             GETTING STARTED
  40.  
  41.    The screen must be set to low resolution mode before running RAYMOVI.PRG.
  42. Once started, '?' will give help. Keys 'r' reads and 'w' writes the current 
  43. screen using the current disk file, whose name is displayed in the upper 
  44. left corner of the screen. Key 'e' exits. The average number of rays shot 
  45. through each pixel is also displayed in the margin and updated as the 
  46. computation develops.
  47.  
  48.    After unpacking RAYMOVI, the first logical thing to do is to start it up 
  49. with the configuration file PEARLS.  After a few minutes, you'll see 
  50. a rough image, with the resolution increasing as you watch. You might 
  51. wait an hour or so to get complete development, but if you get bored, hit 
  52. the 'r' key. This will read the one pre-computed picture PEARL001.PI1 which 
  53. came in the "arc".
  54.  
  55.    Now put RAYMOVI aside until you are willing to dedicate a large chunk of
  56. ST time to make a movie. When you have 10-20 hours free, start RAYMOVI,
  57. again with PEARLS. (Before you start, be sure you have a few hundred K 
  58. free on the disk for the images which will be produced.) To view the movie
  59. produced, exit ('e') and start BLASTRAM.TTP, supplying the argument
  60. PEARL in the dialog box. With BLASTRAM running, type '?' for help. 
  61. Checkpointing may be used if you wish to add more frames to the movie.
  62.  
  63.  
  64.  
  65.             CHECKPOINTING
  66.  
  67.  
  68.    Since RAYMOVI.PRG runs are so long, checkpointing is important. (Actually
  69. I put it in because my sons rebooted the ST at 3:00 every day after school!). 
  70. Thus following the completion of every frame, RAYMOVI saves the current 
  71. configuration on the disk so that if the computation of the next frame 
  72. is interupted, it may be restarted.  The checkpointing information
  73. is written in a file named CHECKPT, in configuration file format. Starting
  74. RAYMOVI with CHECKPT will continue an interupted computation, redoing
  75. only any work which was in progress on the interupted frame.
  76.  
  77.  
  78.  
  79.             CONFIGURATION FILE FORMAT
  80.  
  81.  
  82.    The following section discusses the format of the configuration files,
  83. which specify initial ball positions, velocities and optical properties, 
  84. as well as lighting and viewing perspectives, picture resolution, and gravity.
  85. The configuration file name to be used is specified initially with a dialog. 
  86. The file is then read line at a time. The character in column 1 specifies the 
  87. meaning of the rest of each line. Lines may be up to 200 characters long. Lines 
  88. beginning with whitespace are comments. The following other formats are 
  89. supported:
  90.  
  91.  
  92.  
  93.      - - - 'p' Format: - - -
  94.  
  95. specifies the physical size and velocity of a ball. There are 7 properties 
  96. required for each ball, and they all must be specified on one line in the 
  97. following order: 
  98.  
  99.  (1) x coordinate of center        (2) x velocity
  100.  (3) y coordinate            (4) y velocity   
  101.  (5) z coordinate            (6) z velocity
  102.  (7) radius
  103.  
  104. Some Notes:
  105.  A) In the coordinate system used, Y is upward, X is to the right, and Z 
  106.     is depth (increasing Z moves farthur away).
  107.  B) Balls will bounce off the floor (the plane Y == 0) and an invisible 
  108.     viewing port (the plane Z==0). Be sure to start them so that the whole
  109.     extent of the ball is above the floor and farther away than the
  110.     invisible viewing port.
  111.  C) If balls start out overlapping, they will stick together.
  112.     This turned out to be a serendipitous bug in the bounce algorithm,
  113.     and produces the string of pearls from which PEARLS gets its name.
  114.  D) The current version is compiled for up to 15 balls maximum.
  115.  
  116.    The first p-format statement in the file defines the "first" ball RAYMOVI 
  117. knows about, the second the second and so on. Here are 6 balls which
  118. form an interesting scene:
  119.  
  120.    x     vx      y     vy    z      vz   radius
  121.   (1)    (2)    (3)    (4)   (5)    (6)  (7)      (see (1)-(7) above)
  122. p 195.0,-20,    130.0, 0,    250.0, 10,  30.0     these are the 4 linked balls:
  123. p 150.0, -5,     100.0, 20,   250.0, 10,  30.0         "
  124. p 105.0,  5,     70.0, 20,   250.0,-20,  30.0         "
  125. p  60.0, 20,     40.0,  0,   250.0,-20,  30.0         "
  126. p   0.0,-10,    300.0, 20,   600.0,  0, 300.0    this is the big ball
  127. p 200.0,  2,     50.0,  5,    60.0, 30,  50.0    a medium size (lone) ball
  128.  
  129.  
  130.  
  131.  
  132.      - - - 'o' Format: - - - 
  133.  
  134. specifies the optical properties of a ball. The following 8 properties 
  135. must be put on one line, and in order:
  136.  
  137.  (1) index of refraction
  138.  
  139.  (2) amount of refraction (transparent)
  140.  (3) amount of reflection (mirror)
  141.  (4) amount of diffuse light (omnidirectional)
  142.  (5) amount of ambient light (from light source)
  143.  
  144.  (6) surface color redness
  145.  (7) surface color greenness
  146.  (8) surface color blueness
  147.  
  148.  
  149. Some notes are in order to make realistic objects:
  150.  A) All parameters should be positive or zero.
  151.  B) Items (2) through (5) should sum to less than 1.0
  152.  C) Surface colors (6) through (8) modulate the effect the diffuse and ambient
  153.     reflective properties defined by (4) and (5). None should be greater than 
  154.     1.0.
  155.  C) Due to the size of the ST's color palette, surface color items (6) 
  156.     through (8) are constrained to be patterns corresponding to one of the 
  157.     following three colors:
  158.  
  159.         white:        (6) == (7) == (8) == 1.0
  160.         red:        (6) == (7) == 1.0, (8) == 0.0
  161.         blue:        (6) == 0.0, (7) == (8) == 1.0
  162.  
  163.  
  164.    The i'th 'o' Format line refers to the same ball as the i'th 'p' Format line.
  165. Here are the optical properties for the scene:
  166.  
  167.   (1)  (2)  (3)  (4)  (5)    (6) (7) (8)
  168. o 0.0, 0.0, 0.3, 0.6, 0.1,   1.0,0.0,0.0   diffuse red, somewhat reflective
  169. o 0.0, 0.0, 0.6, 0.3, 0.1,   1.0,1.0,1.0   reflective, somewhat white
  170. o 0.0, 0.0, 0.9, 0.0, 0.1,   1.0,1.0,1.0   reflective, some ambient
  171. o 0.0, 0.0, 0.0, 0.8, 0.2,   1.0,0.0,0.0   diffuse red, some ambient
  172. o 0.0, 0.0, 0.7, 0.1, 0.2,   1.0,1.0,1.0   reflective and ambient (the big one)
  173. o 1.6, 0.8, 0.0, 0.0, 0.2,   1.0,1.0,1.0   refractive
  174.  
  175.  
  176.  
  177.  
  178.      - - - 'v' Format: - - -
  179.  
  180. specifies the viewpoint of the display. x, y, and z values are required.
  181.  
  182. v 215.0,     100.0,       -550.0
  183.   |        |         z coordinate of viewpoint
  184.   |        y coordinate of viewpoint
  185.   x coordinate of viewpoint
  186.  
  187. All rays start at the viewpoint and pass through a rectangle in the Z=0
  188. plane. The rectangle is sized according to the size of the screen -- namely
  189. on a 320x200 low resolution screen, it is defined by 0.0 < X < 320.0 and
  190. 0.0 < Y < 200.0. (Actually, borders eat a few pixels on all sides.)
  191.  
  192.  
  193.      - - - 'l' Format: - - -
  194.  
  195.    specifies the location of the lightsource, and its diameter. Like before
  196. its x, y, and z coordinates, now followed by the diameter of the light.
  197.  
  198. l 150.0,     950.0,          0.0,         100.0
  199.  
  200.  
  201.      - - - 'r' Format: - - -
  202.  
  203. specifies the resolution of the picture to be produced, in Rays projected
  204. through each Pixel, followed by the color schema index, a number from 1 
  205. through 3.
  206.  
  207. r .20, 3
  208.  
  209.    The inputted value of Rays Per Pixel will be rounded up to the next 
  210. greater power of 4.0. Thus in the line above, the .20 will be rounded up 
  211. to (4.0)**(-1) = .25.
  212.  
  213.    The time to compute images varies linearly with the resolution (Rays Per
  214. Pixel) chosen. The constant of proportionality varies greatly depending on 
  215. the complication of the scene, but for the 6-ball scene here on a 520ST:
  216.  
  217.       .0625 rays per pixel      4 min
  218.       .25 rays per pixel     15 min
  219.      1.0 rays per pixel      1 hr
  220.      4.0 rays per pixel       4 hrs
  221.     16.0 rays per pixel     16 hrs
  222.  
  223. I tend to use .25 rays per pixel to experiment with positions and velocities,
  224. since one can generate a couple dozen frames overnight. Once the positions
  225. look good, a few nights of 4.0 rays per pixel produces good looking images.
  226. I can tell the difference between 16.0 and 4.0 rays per pixel (sort of) but
  227. it is hardly worth the time it takes. 0.625 is skimping, but its quick.
  228.  
  229.  
  230.    The color index specifies how the 16 colors of the low resolution monitor
  231. are divided amongst hues and saturation. Three values are accepted currently:
  232.  
  233.     1:    white            16 saturations
  234.     2:    white, red        8 saturations each
  235.     3:    white, red, blue    6 saturations each
  236.  
  237. Although the ray tracing algorithm computes arbitrary red/green/blue hues,
  238. the palate limitations of the ST prohibit their display.
  239.  
  240.  
  241.  
  242.  
  243.      - - - 'g' Format: - - -
  244.  
  245. specifies the strength of gravity, the mutual attraction between balls,
  246. and if balls bounce (in order). The following is realistic:
  247.  
  248. g 32.0, 0.3, 1
  249.  
  250. (Note: if balls do not bounce, they may occupy the same space. In that case
  251. the current the ray tracing algorithm does not properly render refractive 
  252. objects.)
  253.  
  254.      - - - 'f' Format: - - -
  255.  
  256. specifies the first 5 characters of the filename to be used to save 
  257. completed pictures. (The rest of the name is the frame sequence number,
  258. and the suffix .PI1)  Also specified are the starting and ending frame
  259. numbers to be computed (positive integers less than 999).
  260.  
  261. f pearl, 1, 20
  262.  
  263. generates 20 frames on the disk, labeled PEARLL001.PI1 through PEARL020.PI1.
  264. At 32K per frame, that will just about fill a double sided drive.
  265.  
  266.  
  267.  
  268.             --------------
  269.  
  270.    Thats it for now. Tell me of you ventures, send me interesting 
  271. configurations you find, and enjoy!
  272.  
  273.  
  274.  
  275.         Allen King    aking  bfly-vax.bbn.com  ucbvax
  276.         30 Gibson St    1-617-449-3359 evenings    
  277.         Needham Ma.    
  278.         02192
  279.