My submission for the Graphics Programming 1 course of the International Game Architecture and Design study program at NHTV University, taught by Jacco Bikker. The topic of the course was about ray/pathtracing and lighting techniques. The base requirement for the assignment was to have a CPU raytracer with some simple geometric shapes, with the possibility of getting extra points for speed or pathtracing.

For my implementation, I wrote a runtime shader generator which takes a set of scene data and inserts this into a template shader file. This allowed the raytracing to execute on the GPU, rather than the CPU. The scene data contains data for geometric shapes, supporting quads, triangles, circles, spheres and planes. It also compiles a list of materials with several properties (like reflectiveness and emission) that can be assigned to these shapes. I added in support for bumpmaps and textures for extra detail.

The application has a raytrace mode and a pathtrace mode. The raytrace mode only supports very simple lighting and has a hard limit on the amount of bounces between reflective objects. This allows for fast camera movement and positioning. The pathtrace is activated by pressing a key, which locks the camera in place and renders the current view using pathtracing. The pathtracing is done through multiple random rays in a semi-random direction, and then averaging the output of all the hit results. This allows for colorbleeding and soft shadows. Because of the ray randomization, implementing a depth of field effect was trivial.

My implementation was nominated as one of the three best of the class, and I received a copy of Jacco Bikker's thesis as prize.


Duration: 10 weeks
Tech: OpenGL 4 (C++, GLSL)


AggroBird | 2024