⭐ Raytracer
CSCI 420: Building a simple raytracer with recursive reflections
Implementation
First time learning to build raytracer from scratch using OpenGL. The logic was pretty straightforward:
- Shoot a primary ray from the camera pixel by pixel within a frame
- Calculate to determine whether the ray hits any object, two types of geometry in the scene was Triangle and Sphere
- If the primary doesn’t hit anything, then there’s nothing to render
- If the primary does hit something, send a secondary ray from the hit spot to the light source to determine whether the object is in shadow
- If in shadow, render black. If not in shadow, render the color using Phong shading
- Shoot recursive reflection from that hit spot as well, rinse and repeat
Demo
Below are some of the result pictures:
🛠️ Tools used
- C++
- OpenGL