This project is a ray tracing engine developed from scratch in C++ without any external dependencies. It focuses on rendering scenes with realistic lighting and reflections, using core principles of ray tracing. The renderer supports various materials and recursive reflections, showcasing how basic geometric shapes like spheres can be accurately rendered in 3D space.
This ray tracer implements key features including:
- Ray-sphere intersections
- Recursive reflections and refractions for realistic lighting effects
- Support for various materials like diffuse (Lambertian), metal, and dielectric (transparent)
- Anti-aliasing for smoother image quality
- Multi-threaded rendering using OpenMP (available in the
openmp-support
branch)
It was designed to explore the fundamentals of ray tracing, with additional optimizations such as OpenMP for faster performance.
-
Clone the repository:
git clone https://github.com/mirzaim/ray-tracing-renderer.git cd ray-tracing
-
Create a
build
folder for the compiled output:mkdir build
-
Use the provided Makefile to compile the project:
make
For OpenMP support, switch to the openmp-support
branch and compile using the same process.
Run the ray tracer with the default scene:
./build/main > image.ppm
For a high-quality scene (this takes much longer and uses OpenMP for faster performance):
./build/main 1 > image.ppm
Open the image.ppm
file with an image viewer to see the rendered result.
During the development of this project, I found several resources helpful in understanding ray tracing concepts and improving the implementation. The following is a list of materials I used: