I Feel Like I'm Going In Circles

(aka Experimenting with OpenGL 4.2's Atomic Image Operations)


This project introduced us to some of OpenGL's newest APIs. Starting with OpenGL 4.2, shaders are capable of atomically reading and writing from individual levels of a texture. In addition, there are global atomic registers available allowing shaders to accurately keep global statistics, despite their massively parallel nature.

A screenshot of my program, showing the effects of the Gaussian and motion blurs.

For this project, the goal was to use these atomic operations to construct a spatial acceleration data structure on GPU, which would otherwise be prohibitively difficult. Unfortunately, atomic operations on GPU are currently quite slow, and using them to create the cell hashing structure ends up being more costly than running a brute-force O(n^2) algorithm. Despite this, the final program uses a modified version of Newtonian gravitation (to nicely handle overlapping bodies) along with Verlet integration to simulate the physical system. To add some visual character, the scene is blurred with a separable Gaussian blur shader, then composited with the previous frame to create a simple motion blur (both visible in the above picture).