This is a public domain ray tracing program with the following features: * shadows * specular reflection * transparency with refraction * antialiasing * high speed It computes ray-object intersections very fast by exploiting ray coherence. For many scenes, the program can compute ray-object intersections in constant time, regardless of the number of objects. The technique is described in the paper "Ray Coherence Theorem and Constant Time Ray Tracing Algorithm", "Computer Graphics 1987, Proceedings of CG International '87" Springer-Verlag, pp. 303-314. Any suggestions or beautiful pictures generated using this program are welcome. Masataka Ohta Computer Center, Tokyo Institute of Technology, 2-12-1, O-okayama, Meguro-ku, Tokyo 152, JAPAN mohta%titcce.cc.titech.junet@relay.cs.net ========================================================== To test the program: "make test.pic" will produce a beautiful(?) image of nine spheres. "make test1000.pic" will produce an image of 1,000 spheres. Usage: ray [options] <scene file> <picture file> Options: -a: do anti-aliasing -r res set resolution to res (default 128) -t: output timing information -s: use classical slow algorithm -o: disable object ordering optimization -d: debug -b: no shading File format: scene file: (an ascii file, see test.v or "make test1000.v" for example) f <field of view> l <x coordinate of the first light source> <y coordinate of the first light source> <z coordinate of the first light source> l <x coordinate of the second light source> <y coordinate of the second light source> <z coordinate of the second light source> . . . o <shape number (integer) of the first object> <shade number (integer) of the first object> <first shape parameter of the first object> . . . <first shade parameter of the first object> . . . o <shape number (integer) of the second object> <shade number (integer) of the second object> . . . e picture file: (a binary file, make test.pic for an example) <long int xres> <long int yres> <pixel array of yres*xres*3 bytes> pixel array has the form: struct {unsigned char r, g, b;} array[yres][xres]; screen space y=0 is at the top Currently supported light source types: (should be programmable) point light source with constant intensity of (1,1,1) regardless to the distance to the light source Currently supported shapes: (may be changed by modifying shape.c) number: 0 shape: sphere number of parameters: 4 first parameter: x coordinate value of the center second parameter: y coordinate value of the center third parameter: z coordinate value of the center forth parameter: radius Currently supported shades: (may be changed by modifying shade.c) number: 0 shade: lambert with shadows number of parameters: 6 first to third parameters: RGB value of ambient 4th to 6th parameters: RGB value of diffuse number: 1 shade: phong type specular with shadows number of parameters: 10 first to third parameters: RGB value of ambient 4th to 6th parameters: RGB value of diffuse 7th to 9th parameters: RGB value of specular 10th parameter: specular width factor number: 2 shade: mirror (i.e. reflective ) with phong type specular with shadows number of parameters: 13 first to third parameters: RGB value of ambient 4th to 6th parameters: RGB value of diffuse 7th to 9th parameters: RGB value of specular 10th parameter: specular width factor 11th to 13th parameters: RGB ratio of reflection number: 3 shade: glass (i.e. reflective and refractive) with phong type specular with shadows number of parameters: 17 first to third parameters: RGB value of ambient 4th to 6th parameters: RGB value of diffuse 7th to 9th parameters: RGB value of specular 10th parameter: specular width factor 11th to 13th parameters: RGB ratio of reflection 14th to 16th parameters: RGB ratio of refraction 17th parameter: refractive index Viewing parameters: eye: fixed at (0,0,0) eye direction: fixed to (0,0,1) field of view: variable from 0 to 180 degree (with 'f' option) Resolution: set with 'r' option, defaults to 128 picture is always square Limitations: coordinate transformation should be supported light source type should be programmable more complex shapes should be supported more sophisticated syntax should be used (eg. comments, symbolic names) dynamic loading of light source, shape and shade functions should be possible
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.