Project: Raytracer
Overview
Over the course of the semester, you will develop a raytracer using Processing 4 that supports several primitives, constructive solid geometry, realistic lighting, reflection and transparency, as well as textured surfaces (some of these tasks are optional). This page serves as a guide and documents the requirements for each individual task. You are free to work on the tasks as you see fit, but there are several milestone submissions that are strongly recommended.
Requirements
The final submission should consist of a raytracer implemented in Processing that can read a json file, in a defined format, and raytraces the scene defined in this file according to the specification. The output should either be to the screen or to a file. The raytracer should support several features:
- Raytracing to image or screen
- Spheres, cylinders, planes, triangles, and other primitives
- Movement and rotation of primitives
- Constructive Solid Geometry: Union, Intersection and Difference of arbitrary geometry (including any of the primitives)
- Phong lighting with different material properties
- Arbitrary camera placement
- Reflective surfaces with a limited, but configurable number of reflective rays
- Transparent objects with different refraction indices and transparencies
- Textured materials
You can find a more detailed description of these features below, including the points assigned to each and which I would consider “optional”. Note that the only requirement for the project is that the raytracer can read the given json file format and produces a raytraced output image. To help with development, however, a framework with a suggested code structure is provided, as described below. You are free to change anything in this framework, but these pages might refer to the class structure as it exists.
Framework
While it is certainly possible to write this raytracer from scratch, having a structure to get started with could be helpful, and therefore there is a framework that you can use for development. In particular, it takes care of the (tedious) task of reading the JSON file, instantiating the corresponding objects and filling in all the default values. The framework consists of several files:
raytracer.pde
: This is the “main” file, and also where theRaytracer
class lives.Primitives.pde
: Contains the class definitions for the primitives (Spheres, Cylinders, Planes, etc.)CSG.pde
: Contains the class definitions for the CSG operations (Union, Intersection, and Difference)Transforms.pde
: Contains the class definition for the transformation operationsMaterial.pde
: Contains classes for surface materials and their propertiesLighting.pde
: Contains a basic lighting model, as well as the class definition for the Phong Lighting modelScene.pde
: Contains base class of all scene objects, and some auxiliary classesutil.pde
: Contains some useful utility functions
If you use the framework as intended, you should never have to change SceneLoader.pde
or util.pde
(although you may want to add functions you find useful to the latter). Note that almost all class definitions are empty, apart from comments that explain what should/could go where. A more detailed documentation of the framework can be found here.
Milestones and Tasks
The project consists of five main “milestones”, each of which consists of several tasks. While you are free to work on the project with any schedule that works for you, you are strongly encouraged to submit the milestones on the given dates. I will provide feedback on the milestone submissions and point out potential or actual issues and bugs.
- Milestone 1: Basic raytracing with defined primitives (sphere, cylinder, plane, etc.)
- Milestone 2: Constructive Solid Geometry (Union, Difference, Intersection), Movement, Rotation and Scaling, Camera Placement and Rotation
- Milestone 3: Phong Lighting, Reflection and Transparency
- Milestone 4: Textured Surfaces
- Milestone 5: Project presentation and report
You can find a more detailed overview of the tasks and their assigned points here.
Presentation and Final Report
In lieu of a final, we will have short presentations by each group of students where you can show some pictures your raytracer was able to produce. You are expected to submit your names, and any number of pictures (I recommend around 5-10) with captions, and I will assemble all of the received pictures into a single slide show, with title pages for each group in between. Do not just show results of the provided test cases, but create your own scenes that show off some features you implemented and find particularly interesting (for example, magnifying glasses if you implemented refraction, or mirrors to show off some cool reflections, etc.). Additionally, you have to submit your code and a report in a single zip file, where the report should contain a set of interesting test cases, and any specific notes about any of the tasks you may have. This final submission is what determines the grade for the project, milestone submissions are just opportunities for you to get feedback during the semester.
Links
- JSON File Format
- Framework documentation
- Task overview and points
- Task: Primitives
- Task: Movement and Rotation
- Task: Constructive Solid Geometry
- Task: Phong Lighting
- Task: Camera Placement and Rotation
- Task: Reflection and Transparency
- Task: Textures
- Task: Presentation and Report
- Test cases
- More test cases