Drawing particle systems can be divided in two steps:
- We calculate and update positions of all particles with compute shaders
- We draw particles in updated positions using graphics pipeline with vertex, geometry, and fragment shaders
To prepare a particle system, we need to think about the data needed to calculate positions and draw all particles. In this example we will use three parameters: position, speed and color. Each set of these parameters will be accessed by a vertex shader through a vertex buffer, and the same data will be read in a compute shader. A simple and convenient way to access a very large number of entries in stages other than the vertex shader is to use a texel buffer. As we want to both read and store ...