MIME-Version: 1.0 Server: CERN/3.0 Date: Wednesday, 08-Jan-97 16:41:59 GMT Content-Type: text/html Content-Length: 6025 Last-Modified: Thursday, 25-Apr-96 23:08:17 GMT
Your goal will be to produce an interesting picture of at least one mirrored sphere and one clear sphere in front of a large polygonal mirror, showing interreflections and refraction effects. You can assume that all light sources are directional (points at infinity), and that you have no more than 3 light sources. You should also be able to specify the position of these. All specifications of the scene geometry should be in an ascii input file, which your program reads to produce the internal description of the situation. You then run the ray tracing program to produce an array of pixel colors of the size specified for your window, which your program outputs as a ppm (see below) file. You can then use the filter pnmtotiff to create a tiff file which can be displayed using xv so that you need not write any display software.
You will need to write routines for creating a ray from the eye through the center of each pixel in the window, computing the intersection of any ray with a sphere or a polygon, computing the normal to the sphere or the polygon at the intersection point, computing the reflected and refracted (if needed) rays from the intersection point, and computing rays from the intersection point to each light source. You should use the Phong lighting model to evaluate the local illumination for each point, so you will also need a routine to evaluate this model. Remember that ray tracers are recursive, you will need to make sure the recursion terminates at a reasonable point in the calculation.
There is no user interface requirement for this assignment. You can use a text editor to create the input file, and you will use xv to display your results.
Once you have the ray tracer working, you can expect to get some really ugly pictures at first. Plan to spend some time tweaking the parameters of your Phong model to make the images look more realistic.
The portable pixmap format is a lowest common denominator color image file format. The definition is as follows:
Here is an example of a small pixmap in this format:
P3 # feep.ppm 4 4 15 0 0 0 0 0 0 0 0 0 15 0 15 0 0 0 0 15 7 0 0 0 0 0 0 0 0 0 0 0 0 0 15 7 0 0 0 15 0 15 0 0 0 0 0 0 0 0 0
Programs that read this format should be as lenient as possible, accepting anything that looks remotely like a pixmap.
There is also a variant on the format, available by setting the RAWBITS option at compile time. This variant is different in the following ways:
Note that this raw format canonly be used for maxvals less than or equal to 255. If you use the ppm library and try to write a file with a larger maxval, it will automatically fall back on the slower but more general plain format.
SEE ALSO
giftoppm(1), gouldtoppm(1), ilbmtoppm(1), imgtoppm(1), mtvtoppm(1), pcxtoppm(1), pgmtoppm(1), pi1toppm(1), picttoppm(1), pjtoppm(1), qrttoppm(1), rawtoppm(1), rgb3toppm(1), sldtoppm(1), spctoppm(1), sputoppm(1), tgatoppm(1), ximtoppm(1), xpmtoppm(1), yuvtoppm(1), ppmtoacad(1), ppmtogif(1), ppmtoicr(1), ppmtoilbm(1), ppmtopcx(1), ppmtopgm(1), ppmtopi1(1), ppmtopict(1), ppmtopj(1), ppmtopuzz(1), ppmtorgb3(1), ppmtosixel(1), ppmtotga(1), ppmtouil(1), ppmtoxpm(1), ppmtoyuv(1), ppmdither(1), ppmforge(1), ppmhist(1), ppmmake(1), ppmpat(1), ppmquant(1), ppmquantall(1), ppmrelief(1), pnm(5), pgm(5), pbm(5)
Copyright (C) 1989, 1991 by Jef Poskanzer.