Skip to content

Explore the intricacies of the recursive ray tracing algorithm in OpenGL. Users can opt between two programs: a basic recursive ray tracing demonstration and an enhanced version introducing shadows, providing a comprehensive look into ray tracing techniques.

Notifications You must be signed in to change notification settings

vmsaif/recursive-ray-tracing-program-in-openGL

Repository files navigation

Recursive Ray Tracing in OpenGL

Hits

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.

Features

  • 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.

Requirements

This Repository

Clone this repository to your local machine with:

git clone https://github.com/vmsaif/recursive-ray-tracing-program-in-openGL

Visual Studio

Ensure you have Visual Studio installed. If not, download it from Visual Studio Official Website.

GLUT Library

This project requires the OpenGL library or glut.h. The easiest way to set it up in Visual Studio is as follows:

  1. Navigate to the directory where you cloned the project.
  2. Open the Ray_Tracing.sln file in Visual Studio.
  3. Click on Project in the menu bar.
  4. Select Manage NuGet Packages. (If you don't see it, close the VS window, then resume from step 2.)
  5. Click on the "Browse" tab.
  6. Search for "freeglut".
  7. Select "nupengl.core" (which includes glut.h) and click Install. (If already installed, then uninstall then install again).

Running the Project

  1. Open the project in Visual Studio.
  2. Press F5 or choose the Run Without Debugging option.
  3. Follow the on-screen prompts to select and run a ray tracing program.

Purpose

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.

Screenshots

Program 1:

Ray Tracing


Program 2:

Ray Tracing

About

Explore the intricacies of the recursive ray tracing algorithm in OpenGL. Users can opt between two programs: a basic recursive ray tracing demonstration and an enhanced version introducing shadows, providing a comprehensive look into ray tracing techniques.

Topics

Resources

Stars

Watchers

Forks

Languages