RayTracer
This program implements ray tracing to create computer generated images. Spheres and triangle meshes are supported. Simple linear algebra classes are also implemented.
Features
This ray tracer supports the following:
- Phong reflection model
- Point lights/directional lights
- Hard shadows/soft shadows
- Textures
- Smooth shading
- Perspective/parallel projections
- Reflection
- Refraction, transparent surfaces
- Depth of field
Sample images
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.