Throughout this quarter you will implement the basic functions of a distribution ray tracer. This software will be enhanced throughout the quarter, thus this initial assignment will serve as the base for following assignments. Since you will be adding and reusing your code, it is advised that you write your code in a clean, structured object-oriented fashion. All code must be written in C++.
- Program 1 - File Parsing and Ray Cast due Saturday 4/14.
- Program 2 - Shading, Shadows, and Camera due Friday 4/27.
- Program 3 - Reflection, Refraction, and Triangles due Monday 5/14.
- Program 4 - Transforms and Anti-aliasing due Wednesday 5/23.
- Program 5 - Spatial Data Structures due Saturday 6/2.
- Program 6 - Monte Carlo Ray Tracing due Sunday 6/10.
- Program 7 - Final Project due Friday 6/15.
Use of a version control system is mandatory for this project and is how I will be collecting your source code for grading. In particular, we will be using GitHub Classroom.
We will have a class continuous integration server that builds and tests your programs. The server runs on an hourly basis and uses access to your hosted repositories. There are two primary benefits provided by this server:
- Resolve build issues early on - it’s always a nightmare trying to get everyone’s code to build on my machine
- Detect cross-platform runtime issues
You have the option of using either a CMake or Make build.
If you provide neither a
Makefile in your repository, the server will attempt to run a command similar to:
This will sometimes work but it is highly recommended that you provide a
CMakeLists.txt or a
Later in the quarter I might revoke the option to use a
Makefile and require everyone to provide a
The directory structure of your project may vary depending on your build system, but it should generally look something like this:
. ├── CMakeLists.txt ├── README.md ├── resources │ ├── planes.pov │ ├── simple.pov │ ├── spheres.pov │ └── ugly.pov └── src ├── Camera.cpp ├── Camera.h ├── ... etc └── stb_image_write.h
If you’re using a CMake build, I will execute these commands to run your program:
> cd build/ > cmake .. > raytrace render /long/absolute/path/to/simple.pov 640 480
As such you should not make assumptions about where the
simple.pov etc. files will be, but just use the path as specified.
That means that when you are testing your program locally, assuming a CMake build, you’ll do something like this:
> raytrace render ../resources/simple.pov 640 480
Or better yet, you can simply clone the input files repository to your home directory, then do:
> raytrace render ~/csc473-inputfiles/p1/simple.pov 640 480
In order to match my output exactly for the different test input/output files, you will need to use
std::setprecision along with cout.
cout << std::setiosflags(std::ios::fixed); cout << std::setprecision(4); cout << "Pixel: [" << X << ", " << Y << "] Ray: " << Ray << endl;
Also, when converting the float color values to 0-255 ints (which you should do as the last step before printing out or writing out pixel colors), you will need to round:
unsigned int red = (unsigned int) std::round(color.r * 255.f); unsigned int green = (unsigned int) std::round(color.g * 255.f); unsigned int blue = (unsigned int) std::round(color.b * 255.f);
Image files should be output as png files. Use stb_image_write.h to produce your output images unless you have a strong inclination to use some other library. Name the output file “output.png” and create it in the current directory (where the executable is run). See the C++ snippets reference for an example of how to write an image using stb_image_write.