flood_fill June 2015

3d puzzle game that involves filling in voxel terrain with different fluids. Created with C++ using only OpenGL.

View on GitHub

View on YouTube

Development Team

I was the lead developer of a four-person team. This was our quarter-long project for our “real-time 3D computer graphics” course. I was primarily responsible for the following features:

Simple heightmap fluid effect

I developed the simple fluid effect, which stores heightmap data in several textures. I use these textures to calculate the positions of the fluid’s vertices. Then, every frame, I use a fragment shader to update the data in the heightmap textures.

The “flood fill” algorithm

The game title is a pun on the “flood fill” algorithm, often used for the “paint bucket” tools in image editing programs. I implemented a 3D variation of the flood fill algorithm to determine what areas of the terrain can be filled with fluid, flowing downward from the initial cell.

Mesh simplification algorithm

Finally, I also implemented an algorithm that combines adjacent cubes into fewer, larger faces, which significantly improved the game’s framerate. When the terrain changed in-game, the algorithm would mark the affected faces as “dirty,” and recalculate the arrangement of cube faces. When displaying the faces, I scaled and repeated the texture appropriately, so that the player could not see any difference.

Back to All Projects