Post

Voxel ray tracer

Pong gameplay

About the Project

A voxel ray tracer built on top of a provided base, with a pong game made inside it that uses ray tracing functionality as a core part of the gameplay.

Team: Solo
Duration 8 weeks
Engine: Custom engine


Overview

The starting point for this project was an engine with a basic ray setup already in place. Everything beyond that was ours to build. The assignment was to make a game within the ray tracer, with the challenge of actually incorporating ray tracing into the game itself for a higher grade.

I extended the renderer with reflective and glossy materials, glass materials for sphere primitives, an HDR skydome, point and spot lights, stochastic lighting, and accumulation to smooth out the noise over time. The source code is no longer available, but the videos below show most of the features in action.


The Game

Spotlight

Stochastic lighting with accumulation

Reflective material

Glossy material

Glossy material with accumulation

Glass Sphere

The game is a pong variant where each paddle is a spotlight pointing downward onto the play field. The ball reads the light cast by the spotlights to determine where it should bounce, meaning the ray tracing is directly tied to the game logic rather than just being visual.

The more interesting constraint on this project was the requirement to incorporate ray tracing into the gameplay itself rather than just using it as a renderer. The spotlight-as-paddle mechanic came from that: the ball reads the actual light cast by the spotlights to determine where it bounces, so the rendering and the game logic share the same data. On the renderer side, building out reflective, glossy, and glass materials, stochastic lighting, and accumulation gave me a solid grounding in how a ray tracer actually works at the implementation level rather than just the concept level.

This post is licensed under CC BY 4.0 by the author.