Ray Tracer

An Object Oriented ray tracer written in C++. The image below shows the Cornell Box rendered with the ray tracer.

Image
graphical divider

For a programming class in my second year of training 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 means the number of times a ray is shot through that pixel, and each time through a slightly different point in that pixel.

Installation

The installation process is quite simple. Clone this repository and execute the following command:

$ make
Features
  • Support for Spheres, Cubes and Planes
  • Diffuse and reflection
  • Multiple lights
  • Movable camera with a user controlled FOV and position
  • Scene reader
Renders

Render time for the cornell box on a i5-8250u

Resolution Sampels Per Pixel Render time Result
100x100 10 0.27s Link
100x100 100 2.32s Link
100x100 1000 23.93s Link
100x100 10000 4m34s Link
500x500 10 6.38s Link
500x500 100 1m7s Link
500x500 1000 11m27s Link
500x500 10000 1h54m36s Link
1000x1000 10 28.16s Link
1000x1000 100 4m41s Link
1000x1000 1000 45m58s Link
Todo
  • Add support for more shapes
  • Multithreading
  • Textures
Code

Checkout the source code here!

divider graphic

Check out other projects

arrow-up icon