Elements of Computer Graphics CS 174, Spring 2002: Assignment 3

Name: ______________________________________

Student ID: _________________________________

Due date:  May 29, 2002 at 4:00pm.

Weight: 15 %.

Collaboration: None. If you discuss this assignment with others you should submit their names along with the assignment material.

Instructions: Submit your assignment at SEASNET. Make sure you submit all the necessary files and a readme.txt that explains your project. Document any shortcuts you took, for example if you didn’t implement shadows. Failure to do so may result in loss of marks. Do NOT Submit a printed version of your code.

Start working on it early. You will not have time to do it at the  last minute.

1.      Visibility [6 marks]
a. [3 marks] Create a BSP tree for the following scene using the algorithm presented in the lecture notes. Chose the roots randomly. Make sure you label polygons properly and show how the algorithm works, that is show each stage.

b. [3 marks] Given the BSP you just created, show how the algorithm will draw the polygons for an eye position of your choice. Make sure you indicate clearly where the eye is.

2.      Ray tracing [24 marks]
Implement a ray tracer.
A good implementation should include the following features:

Beware! Ray tracing uses lots of CPU. Keep your recursion depth low (max 2 or 3) and your images tiny (200x200) while testing.

You can display your image on the screen or you can save it as a PPM file (see assmt2 code).

Instructions:
For this project, no skeleton code is provided, but the implementation should be relatively straightforward. Some code is provided at www.cs.ucla.edu/~pfal/courses/cs174/2002s/coursework/

Here are some suggestions on organizing your code:

In other words, don't keep following rays hoping to hit a light. It will happen with zero probability (ie never), for point lights.

Here's a little hard-to-understand gotcha! that you will probably run into: when a ray hits a surface, you obtain a hit point. If you cast a secondary ray, it will start from the hit point, and test all objects for intersection. Due to numerical errors, the hitpoint may be slightly INSIDE the object, so the math may yield an intersection with the same object again! Hence, discard hits that are very close to the original hit point.