GlassOverFlow is a real-time 2D fluid simulation game developed by a team of three enthusiasts for the IGR205 course. The game is built from scratch using the OpenGL API. The technical report can be found here.
The source code is divided into three parts: the engine, the physics solver, and the game itself.
The Engine structure is inspired by an early version of the Hazel Game Engine. It features OpenGL class abstraction, a 2D renderer, and some primitives like squares, circles, and rendering properties. It also features a handling of user events, a camera system, and position transforms.
The solver implements the DFSPH method and features various kernels:
- Density:
- Pressure: (be careful in 0)
- Viscosity:
It is capable to handle rigid structures that will interact with the fluid:
It is also capable of handling different fluids with different parameters:
The game features several levels to showcase the different features. The rendering of the different levels is done using several compute passes to get the 'pixel art' style. It uses some spatial hashing and computes the color of the pixels by using the SPH method idea.
From left to right and top to bottom: Rough particle rendering; Simple pixel art render pass; Per pixel density computation; Final rendering
To build the project, follow these steps:
mkdir build
cmake -B build
make -C build
To update submodules, run:
git submodule init
git submodule update
We would like to thank Prof. Kiwon Um for being our supervisor for this project.