For a programming class during my studies at the Rotterdam University of Applied Sciences I wrote an object oriented ray tracer in C++. There is support for multiple types of objects, diffuse and reflection, multiple light sources and a scene reader.
I have rendered the same scene with different resolutions and samples per pixel. Samples per pixel refers to the number of times a ray is shot through every pixel. For every sample, a ray is shot through a slightly different point in the pixel.
Render time for the cornell box on a i5-8250u processor.
|Resolution||Sampels Per Pixel||Render time||Result|
- Support for Spheres, Cubes and Planes
- Diffuse and reflection
- Multiple lights
- Movable camera with a user controlled Field of View (FoV) and position
- Scene reader using JSON
The ray tracer is build using Object-oriented programming (OOP). For example, a parent class (BasicObject) was created for all objects to be placed in the scene. The different objects are derived from this parent class (Cube, Sphere and Plane). By using the Parent-Child structure, the child class can inherit functions that are the same for all objects. The full UML can be found here. A simplified UML can be found below.
Code & Installation
The source code for the Ray Tracer is available here. The installation process is quite simple. Clone the repository and execute the following command: