- Weekend project
- Our own engine
- C++ and DirectX 11
I wanted to familiarize myself with the GPGPU(General Purpose GPU), so I decided to make particle simulation where the simulation is updated in a compute shader. Since the focus here wasn’t the rendering, I decided to just render the particles as a point cloud.
I have 2 Structured Buffers that hold the particle data. During each frame, one of the buffers is used as an input buffer and the other one as an output buffer, they are then switched, to achieve some kind of ping pong behaviour, so that the next frame’s input data is the output from the last frame.
I then created one compute shader that updates the simulation, and another compute shader that emits new particles upon invocation.
Since I didn’t have a lot of time to work on this project, I never managed to implement all the ideas I had, but I still think it was a successful project because it fulfilled its purpose.
Some of the other ideas I had were:
- Have the particles react to the other particles around them. This would require some rework on how I handle my buffers and some kind of spatial partitioning for it to perform well with large amounts of particles. This would allow me to implement things like Smoothed Particle Hydrodynamics(SPH), which I have done on the CPU once before, on the GPGPU. It would be interesting to see how many more particles you could have on the GPGPU and compare the results with the CPU version.
- Have the particles write text in 3D space using a mesh or a 3D texture.
This would make a cool cartoony effect in explosions for example,
where the particles would spell out
BOOOOM!and then dissolve.