OpenGL Ray TracerUsed API: OpenGLTeam size: solo projectDuration: half year project

In Digipen Junior year, I made an OpenGL CPU ray tracing project.

The first milestone, I implemented intersections between ray and objects, such as sphere, cylinder, triangle, and box.
The reason why I do this is a ray tracer. Unlike a real time renderer, all objects in a scene is static objects. There are no matrix calculations. However, I need intersections between ray and objects to trace ray from camera to the scene.
Complex models like the dwarf and bunny are composed of numerous triangles, so their intersection calculations typically involve triangle intersections rather than more complex operations.
In order to increase performance, I used bounding volume hierarchy. Instead of calculating intersections with all objects, do it with bounding volume hierarchy. Thus, ideally I would expect O(log n) instead of O(n) to trace a ray.
Given that rays return the color of intersected objects, it becomes challenging to deny the classification of the system as a ray tracer.

The second milestone, I added ray-tracing functions. Upper image is a result of 4096 passes.
Now, the ray delivers information about intersections, including data about the intersected object, the length of the ray, and the position of intersection in world coordinates.
There is both implicit lighting, which includes the diffuse color data of the intersected object, and explicit lighting, which determines the extent to which a portion is exposed to lighting.

In the third milestone, I introduced reflection functions, which establish a harmonious interplay between surface distribution, Fresnel reflection, and self-shadowing effects.