You may work in teams of two students. Both students will receive the same mark.
Part A (40 marks)
Your rst task is to implement a basic ray-tracer and render a simple scene using ray casting and local (direct) illumination. The starter code sets up a scene comprising of an ellipsoid and a plane, being illuminated by a point light source. Your job is to render the scene by implementing code fragments required for object intersections and Phong illumination. You will have to implement the following code fragments.
[6 marks] Casting rays from the camera towards each pixel of the image plane.
[12 marks] Intersection code for ray-sphere intersection (should work for a nely deformed spheres).
[10 marks] Intersection code for ray-square intersection (should work for a nely deformed squares).
[12 marks] Phong illumination for a point light source (ambient, di use, and specular components).
To demonstrate the working of your program, you should generate three di erent types of renderings.
a scene signature where each pixel shows a unique color identi er for the rst object hit (or background). This gives you an impression of the relative positions of the camera and the objects.
a rendered scene with only the di use and ambient components of the Phong model.
a rendered scene with all three terms of the Phong model.
In addition to specifying your scene, the starter code has been written to generate two distinct views (images) every time you run it. Thus, for each type of rendering above you will generate two views, comprising a total of six images. In your electronic submission, please call these image les sig1, sig2, diffuse1, diffuse2, phong1, and phong2. Below are two images of what the Phong rendered scene should look like. Finally, ray-tracing is compute-intensive, so debug your code on small images, e.g., 200x200, and debug ray intersections using the scene signature. Also, when writing your code, keep in mind that your second task will build upon this work so make sure your implementation is modular and re-usable. Make sure you read the helper code carefully and only implement the functions that are necessary, i.e. try to avoid creating unnecessary structures or classes.
Helper Code. To get started, we have created a simple demo for you. The demo sets up the scene and basic class structures required. Note that the helper code is written in C++ and does not use OpenGL. It will also provide you with a template Make le for compilation and linking of your programs. To unpack and compile the helper code on CDF, download and extract a3.zip and use the following commands.
cd a3/raytracer
make raytracer
Part B (50 marks)
Your second task is to build upon the raytracer to produce special e ects. Use your imagination and any resources you want (as long as you cite them in your report). As a guideline to the scope of what is expected:
Advanced ray-tracing. Extend your ray-tracer to enable global illumination.
| [10 marks] Use recursive ray tracing to show secondary re ections (so you can see one object re ected in another).
| [5 marks] Hard shadows.
Then implement at least 5 of the following features below (35 marks):
| A space partitioning structure (for example, BSP, octree, k-d tree) to accelerate your ray-tracer. This will allow you to generate high-res images of complicated scenes.
Anti-aliasing.
Depth of eld.
Extended light sources, in order to to produce soft shadows.
Texture-mapping of a plane, sphere and cube (an interesting procedural texture is also acceptable).
Environment mapping.
Motion blur.
Refraction (e.g. glass spheres).
Handling a non-trivial compound object, containing quadratic surfaces (e.g., a cone or cylinder). Spheres, ellipses, planes and patches thereof don't count.
Handling arbitrary surface mesh geometry.
In your submission, you must turn in images showcasing all the features individually. For example, if you implement anti-aliasing and depth of eld, then include two images|one showing each feature. You are free to include any additional images showing cool e ects with combinations of features.
Report and Submission
Report [10 marks] Write a clear REPORT describing
| your overall submission,
| the code, and the le structure of the submission,
what you have implemented and what external resources you have used,
the role of each member on the project.
BONUS [10 marks] We will award you up to 10 bonus points for the overall \wow factor".
Turning in your solution. All your code should remain in the directory a3/raytracer. In addition to your code, you must complete the les CHECKLIST and REPORT contained in that directory. Failure to complete these les will result in zero marks on your assignment.
Your code should be well commented if you want to receive full (or even partial) credit for it. To pack and submit your solution, execute the following commands from the directory containing your code (i.e., a3/raytracer).
cd ../../
tar cvfz a3-solution.tgz a3
submit -c csc418h -a A3 a3-solution.tgz (if registered for CSC418)
submit -c csc2504h -a A3 a3-solution.tgz (if registered for CSC2504)
Compatibility. You are welcome to work on any platform but must be able to run your demo in front of the TA. Also your submitted les must either run on CDF (Linux), or provide a self-contained Windows compilation environment (Do not expect the TAs to ddle with the project settings or search for 3rd party libraries to compile your code).