Particle-Simulation using the GPU via the OpenGL Compute-Shader
This particle simulation is more like a proof of concept for myself or others, to show and understand how compute shaders in OpenGL work. Using the knowledge I gathered from this project, more complex, fascinating and fast projects are possible, which use the power of the graphics hardware for computations.
The final result looks like that:
Animation
Each particle has a life span in which it fades from red (new born) to blue (about dying). When a particle dies, it respawnes in its negated (x,y,z) position.
The movement itself is computed using an Euler integration method for each particle.
There are several global randomly moving attraction points. Particles are attracted and accelerated by these points.
Example screenshots:
Install && Run
I tested an ran this simulation on a debian-based Linux OS (Ubuntu, Mint, ...). It should run on other machines as well but is not tested.
System Requirements
The following system attributes are required for running this simulation:
-
A graphics card supporting OpenGL version 4.3 (For the compute-shader!).
-
Unix-Libraries: xorg-dev and mesa-common-dev
Both GLEW (The OpenGL Extension Wrangler Library) and GLFW (Window-Manager) are now included locally, so no system wide installation is necessary!
For a system wide installation, further information is available under the following links:
-
GLFW: http://www.glfw.org/.
-
GLEW (with install instructions): http://glew.sourceforge.net/build.html.
Running
Compiling and running should work under windows. OSX is not supported as the available OpenGL version does not reach 4.3. In the root directory, execute:
-
cmake .
-
make
-
cd bin/
-
./particleSim
While the simulation runs, you can move around (always looking to the center!) with your mouse (left-klick and move) and zoom in/out with your mouse (right click and move up/down).
More Screenshots
So, here are some more screenshots, because screenshots are awesome :)
You can find some more screenshots in the screenshot-folder: More Screenshots :).