In Spring 2024, as part of CS 434: Advanced Graphics, I built a raytracer from scratch in C. I started by implementing a basic ray-casting system, where rays are shot out from the camera and check objects for intersection

One sphere is in the scene, rays that exit the camera and hit the sphere are colored white, others are gray.
Then, I calculated the normals of the shape where it was hit

Here, the sphere is colored according to the normal vectors present at each point of intersection
With normals included, I was able to implement basic Phong shading by adding a point light source and calculating the lighting contributions to the color of each pixel

With just Phong shading diffuse effects implemented, the shape of the sphere becomes clear

With colored specularity added, local occlusion, diffusion, and specular effects are visible
I continued by adding shadow rays for global shadow effects, reflection rays to allow for reflections, and implemented support for multiple objects and light sources

In this screenshot, multiple lights can be seen, as well as nested reflections between multiple glossy objects

In this reflective cornell box, full shadows, reflections, specular and diffuse effects are clearly visible for both sphere objects as well as flat (triangle) objects