Assignment 3:
A Ray Tracing Application
Due Date: December 30th, Wednesday, Class Hour (20.00-22.00)
Grade Value: 20 %
 
You can form groups of two students for this homework again.
Important Notice
You must submit your source codes
(comments and a README.txt file explaining how it is compiled and run, and
parts that you implemented and couldn't implement) to the TA.
You should email (with the Subject CS465 Assignment #2) to Aytek
Aman (aytek.aman@bilkent.edu.tr) a single zip file named as
LastName1_LastName2_CS465_Asst2.zip, containing a source directory
and a README.txt file describing how to compile and run your assignment.
Aim
Our aim is to implement a ray tracer. A ray tracer needs following main
parts:
 
-
It generates rays from the eye point through each pixel.
-
Intersects the rays with the objects in the scene
-
Calculate the secondary rays from the point of intersection
-
According to the above tasks, shade the rays and assign a color to each
pixel.
Your ray tracer will have the following ray tracing functionality:
-
The sphere, cube and the cone (the tracer should support
these primitives).
-
Point light sources with a Phong lighting model.
The scene you generated for demonstration should include the following
to test the correctness of your ray tracer:
-
Solid objects
-
Shiny surfaces
-
Transparent objects (optional)
Your objects must include at least the following:
- A sphere, a cube and a cone.
You are also supposed to make your scene visually interesting (for example,
a nice background picture which will not interfere with the rays
going through the scene). As bonus points, you may include sun shining,
or any other effects. But the background scene should not be interfered
with the objects; i.e., avoid using too bright and/or too many colors.
Here is a sample data file for your convenience. You don't have to
use it in its current form. You may use it by ignoring some items in it
or you may add any meaningful extra objects in it.
Ray Tracing Data
The images that your program have created should be viewed inside a WebGL app. For that purpose, you need to create a 2D texture, fill the pixels and display that texture by mapping it to a quad.
Test your ray tracer by using
-
Separate and Intersecting objects
-
Solid(opaque), shiny(metallic) and transparent objects
+BONUS: Any meaningful extra functionality that you put such as texture mapping and bump mapping.
However, this should be demonstrated very well. A poor result of these extra functionality will not
get any extra point. Besides, bonus part will be applied if you complete all of the required
functionality described previously.
All the formulations (such as intersection calculations) and starting code
you may need are given in handouts distributed in class.
Cautions
You will do a lot of work in this assignment. You are advised to design
your program and environment as soon as possible. The following may help
you during the development and debugging sessions:
-
You will deal with algebraic operations. You will perform lots of intersection
and normalization operations.
-
Try to minimize the number of times that you normalize vectors and normals.
After each normalize step, you will lose a small amount of reality.
-
The intersection of ray and an object may actually be slightly inside the
object. When casting secondary rays(like shadow rays), the first object
the secondary rays will hit will be the same object. So, you may discard
all the intersections that occur too close to the ray origin.
-
In intersection routines, use "epsilon" checks, especially for ray-polygon
intersection routine.