This project is aimed to create a real-time ray tracer program on the CPU, utilizing the wide possibilities for parallelization. Blinn-Phong reflection model is used as a backbone of lighting effects. Ray-objects intersection testing is conducted using the Möller–Trumbore algorithm for triangles and simple linear algebra operations for plains, spheres, and ellipses. Global and local view concepts are introduced to implement the 3D object sizing, rotation, and positioning. To reproduce the properties of the camera, such as field of view and perspective, the camera obscura model is used.
You need to have C++ std lib installed. You will also need gcc
or clang
compiler, cmake
and make
installed to build the project.
Additionally, SDL2, TBB, and glm libraries are required.
We use SDL2 library as an API for computer multimedia hardware. Intel Threading Building Blocks is used to utilize the parallelization. OpenGL Mathematics (GLM) provides a mathematical backbone for our application.
Our project uses CMake as a build system. To compile the project, run the following commands:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
To install the project, run the following commands:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --target install
To start the program just run the executable file:
cd ./cmake-build-release
./Ray_Tracer
There are controls for the camera:
W
- move forwardS
- move backwardA
- move leftD
- move rightQ
- move upE
- move downUP
- rotate upDOWN
- rotate downLEFT
- rotate leftRIGHT
- rotate right