CS4451A: Assignment 5

Ray Tracing

Due: December 3rd.



Turn in

Due date

Additional Instructions

Your task will be to implement the function "public Color ShootRay(int x, int y)" in the file RayTraceWindow.java. The window has a copy of the scene graph that can be used inside ShootRay.

A skeleton version of RayTraceWindow.java, with a simple driver program to call it and save a file, is available here.

A suggested way to implement the ray tracer is to create a Hit.java class and implement a function such as "public abstract Hit intersectRay (originx, originy, originz, dirx, diry, dirz, jooglRoot root)" on each of the scene objects, and put whatever information you need in the returned "Hit" object that this function returns (for example, the color, object hit, and t-value of the intersection along the ray might all be useful).

The window size is passed to the RayTraceWindow when it is created. You should keep it small while debugging (ray tracing is slow), but increase it when you are generating images you are happy with.

Finally, the provided sample program is based on the juggler in assignment 4. Feel free to change it as you want, but do not change the interface to RayTraceWindow.java.