The Assignment
For this assignment, you must write a C++ program that will render spheres using ray tracing. The input is in a subset of the rayshade (.ray) file format, containing information about the view and objects in the scene. You will read a .ray scene from a file, and ray trace the single image described there. Rays that hit an object should be rendered in the object color, while rays that do not hit any object should use the background color of the scene. Do not try to include any of the more advanced ray tracing features you may read about (shadows, reflection, refraction, lights, etc.), we will get to those later. Your output should be an image file in PPM format.
Output
Your output should be a file named "trace.ppm" in the PROJECT_BUILD_DIR directory (not the PROJECT_BASE_DIR directory as was done by the sample code).
We are using the PPM image file format because it is exceedingly simple to write. See the specification for details. PPM colors use unsigned bytes, but colors in the rayshade file are floating point numbers between 0 and 1. I recommend using floating point colors until it is time to assign the color into an image pixel (just multiply by 255 and cast to unsigned char).
Other people's code
Ray tracing is a popular rendering technique, and the internet contains lots of resources for ray tracers in general and things like ray-object intersection in particular. Other than the assn0 sample code, YOU MAY NOT USE ANY OUTSIDE CODE. All code that you use must be strictly your own.
Strategy
This is a big assignment. Start NOW, or you will probably not finish. No, really, I promise you will not be able to do it in the last two days. Even before we get to all of the details of the ray tracing itself, you can still start working on your file parsing.
I have created a separate page with some additional development suggestions.
What to turn in
Turn in this assignment electronically by pushing your source code to your class git repository by 11:59 PM on the day of the deadline and tagging the commit assn1
. Do your development in the trace
directory so we can find it.
Also include an assn1.txt
file at the top level of your repository telling us about your assignment. Tell us what works, and what does not. Also tell us what (if any) help you received from books, web sites, or people other than the instructor and TA.
You must make multiple commits along the way with useful checkin messages. We will be looking at your development process, so a complete and perfectly working ray tracer submitted in a single checkin one minute before the deadline will NOT get full credit. Individual checkins of complete files one at a time will not count as incremental commits. Do be sure to check in all of your source code, but no build files, log files, generated images, zip files, libraries, or other non-code content.