For this assignment, you will be building a Ray Tracer using C/C++, Python, or Java. The choice of which of these languages is up to you, but keep in mind that language-specific support is not provided (you should use the language you can locally support and are comfortable coding in). The system only needs to handle the rendering of ellipsoids (transformed spheres), with a fixed camera situated at the origin in a right-handed coordinate system, looking down the negative z-axis. Local illumination, reflections, and shadows will also need to be implemented.
The program should take a single argument, which is the name of the file to be parsed. Make sure your executable has the name “RayTracer.exe” (or equivalent for the language you choose) and that we can run it as in the following examples:
> RayTracer.exe testCase1.txt
or
> java RayTracer testCase1.txt
or
> python RayTracer.py testCase1.txt
We will use a script to generate the outputs for the set of posted test cases. You will get zero marks if we cannot compile your program and if we cannot run this script because your project does not implement the required specifications above.
Make sure you carefully read the Instructions and Clarifications below as they contain important information on the lighting, scene setup, tracing depth etc.
Input File Format
The content and syntax of the file is as follows:
File Content
* integer ** float(s) *** float(s) between 0 and 1
-
The near plane**, left**, right**, top**, and bottom**
-
The resolution of the image nColumns* X nRows*
-
The position** and scaling** (non-uniform), color***, Ka***, Kd***, Ks***, Kr*** and the specular
exponent n* of a sphere
-
The position** and intensity*** of a point light source
-
The background colour***
-
The scene’s ambient intensity***
-
The output file name (you should limit this to 20 characters with no spaces)
File Syntax
Do not write the angle brackets, these are to show you where to insert values. See the testcase files!
NEAR <n>
LEFT <l>
RIGHT <r>
BOTTOM <b>
TOP <t>
RES <x> <y>
SPHERE <name> <pos x=""> <pos y=""> <pos z=""> <scl x=""> <scl y=""> <scl z=""> <r> <g> <b> <ka> <kd> <ks> <kr> <n>
... // up to 14 additional sphere specifications
LIGHT <name> <pos x=""> <pos y=""> <pos z=""> <ir> <ig> <ib>
... // up to 9 additional light specifications
BACK <r> <g> <b>
AMBIENT <ir> <ig> <ib>
OUTPUT <name>
All names should be limited to 20 characters, with no spaces. All fields are separated by spaces. There will be no angle brackets in the input file. The ones above are used to indicate the fields.
Output File Format
You should output your images in PPM format. You can choose binary (P6) or text-based ppm (P3). The text-based format is very simple, but it is important to understand the assumptions about which pixel is where (where (0,0) is for example). Example code for these has been provided in C++ attached to the assignment. We must be able to open your output files in a viewer that is freely available see clarifications below.
https://netpbm.sourceforge.net/doc/ppm.html
Marking Scheme Total Marks: 26
-
[2] Coding Style (i.e. well designed, clean, & commented code)
-
[2] x 12 For each of the given test cases.
-
[-4 Marks if not] Provide a readme.txt that describes what you have done, what you have
omitted, and any other information that will help the grader evaluate your work, including what is
stated below.
There will be no partial marks given if your program fails to parse an input file or if it does not produce the correct output.
Make sure you submit all the required files so we can compile and build your program. If there are missing libraries, you will get zero marks.
We will use a script to generate the outputs for a set of test cases. You will get zero marks if we cannot run this script because your program does not adhere to the given requirements. (Repeated for emphasis)
Requirements/Policies
Collaboration
None. If you discuss this assignment with others, you should submit their names along with the assignment material.
Original Work
The assignment must be done from scratch. Apart from the code provided, you should not use code from any other source, including the previous offering of the class. (see clarifications below)