RayTracer

This program implements ray tracing to create computer generated images. Spheres and triangle meshes are supported. Simple linear algebra classes are also implemented.

Alt text

Features

This ray tracer supports the following:

  1. Phong reflection model
  2. Point lights/directional lights
  3. Hard shadows/soft shadows
  4. Textures
  5. Smooth shading
  6. Perspective/parallel projections
  7. Reflection
  8. Refraction, transparent surfaces
  9. Depth of field

Sample images

Alt text

Alt text Alt text Alt text Alt text Alt text Alt text

How to Build and Run

cmake . && make

./raytracer <path to scene file>

What can be improved

Render Time

Currently, it takes a long time to produce a small, simple image. We can improve the rendering time by adopting a multithreaded approach. OpenMP is an API that can be used for multithreaded programming.

Code Organization

To support more features in the future, it is important to improve the structure of the program. Similar data regarding rays gets passed around the program many times. Therefore, a data structure such as a RayPayload could improve readability and scalability by keeping track of rays, the objects they've intersected, and other relevant data.

Also, it may be more appropriate to move functions in the RayTracer class to their own classes. The RayTracer class holds a significant portion of the ray tracing routines; this will not scale well in the future.