This project delves into the world of computer graphics by implementing the recursive ray tracing algorithm in OpenGL. The user can choose between two programs: one that demonstrates basic recursive ray tracing and another that introduces shadows to the scene.
- Recursive Ray Tracing: Casts rays from the source to the scene, determining whether rays hit reflective or non-reflective surfaces.
- Shadow Implementation: Enhances the ray tracing algorithm by checking if intersection points can see the light source, introducing shadows where necessary.
- User Interaction: Allows users to select between two distinct ray tracing programs.
Clone this repository to your local machine with:
git clone https://github.com/vmsaif/recursive-ray-tracing-program-in-openGL
Ensure you have Visual Studio installed. If not, download it from Visual Studio Official Website.
This project requires the OpenGL library or glut.h
. The easiest way to set it up in Visual Studio is as follows:
- Navigate to the directory where you cloned the project.
- Open the
Ray_Tracing.sln
file in Visual Studio. - Click on
Project
in the menu bar. - Select
Manage NuGet Packages
. (If you don't see it, close the VS window, then resume from step 2.) - Click on the "Browse" tab.
- Search for "freeglut".
- Select "nupengl.core" (which includes glut.h) and click
Install
. (If already installed, then uninstall then install again).
- Open the project in Visual Studio.
- Press
F5
or choose theRun Without Debugging
option. - Follow the on-screen prompts to select and run a ray tracing program.
The primary goal of this project is to showcase the recursive ray tracing algorithm. Rays are cast from the source to the scene, determining if they hit walls (non-reflective surfaces) or floors (reflective surfaces). The algorithm either terminates upon hitting a wall, returning the wall's local color, or recursively invokes itself upon hitting the floor, calculating the mixed color. An additional feature tests intersections to determine if they can see the light source, introducing shadows where necessary.