Assignment 3 Report George Dounkov Student #: 990825103 Jasper Snoek Student #: 991113601 CSC418 For our project we chose to do a distributed ray tracer. The tracer includes basic primitives like surfaces, triangles, spheres and cylinders. We used an object hierarchy to implement the primitive. That is, all the different primitives are represented as classes, which are subclasses of the Primitive class. Each subclass has its own intersection algorithm, and constructor. We included a file reader method that reads in .obj files containing vertices and triangle faces (much like those from the second assignment) and renders the polygon. We didn't include a complex polygon in our pictures because they took too long to process with our ray tracer (we created a teapot but it took 14 hours). We used constructive geometry to create a halfsphere (a combination of a surface and sphere). These primitives can be transformed and the transformed objects are rendered via instancing. Phong shading with soft shadows was used in determining the color of pixels, as well as the reflection and refraction properties of the specific object. George Dounkov wrote the basic skeleton of the tracer and implemented the illumination and shading algorithms. He also implemented the triangle and cylinder primitives. Jasper Snoek polished the basic ray tracer code, implemented the instancing algorithms and the sphere, surface and halfsphere primitives. He also created and implemented the submitted scenes and movies. The main file is demo.cpp To compile our program copy all the .cpp and .h files to a directory and type make. To compile the animation code use the MakefileAnimation as your makefile instead of Makefile. To run the program type ray . We submitted 3 .obj files, test4.obj (which contains nothing and is a dummy test file), test1.obj which contains the triangles to make raytrace1.jpg and test.obj which contains a refractive prism (in case you want to test our polygons). The scenes are mostly hard coded in the main file (demo.cpp). anim.mpg We created a physical based animation with our ray tracer of a sphere surrounded by mirrors dropping on a mirror and squishing. A perl script (makeAnim.pl) was used to run the ray tracer multiple times and an algorithm was used to calculate when the sphere hit the surface and how much it had to be transformed by (using instancing). This was done by drawing a ray from the center of the sphere to the surface, and then getting the length of that distance and transforming the sphere by the ratio of the distance vs. the radius. The main file for this animation is contained in makeanim.cpp. It is very similar to the main file for the ray tracer with a couple of small adjustments. The animation is shown in anim.mpg. The make file MakefileAnimation is the one used to generate the program for the animation. raytrace1.jpg This shows a reflective "water" surface on the bottom, with a number of spheres (diffuse and reflective), a cylinder and two transparent refractive triangles. It uses distribution ray tracing with many samples to create a depth of field effect and anti-alias. It also uses soft shadows. There is a mirror in the top back corner of the scene. Note that you can see colorful spheres in the mirror. If you look closely you can see that the reflections of the spheres in the mirror contain the reflections on the spheres because the recursive reflection depth was set at 3. The triangles are generated using the object file test1.obj. raytrace2.jpg This is like raytrace1 except without the triangles and has a half-sphere. raytrace3.jpg This uses the same methods as above to generate a scene surrounded by mirrors. It has two cylinders, a transformed sphere and one reflective gold sphere. It uses a recursive reflection depth of 1 because otherwise it took too long to process.