Rendering particles
In this recipe, we will implement a simple particle system on the GPU. Compute shaders will be used to generate and update the particles within append/consume buffers, and we will use the vertex shader input semantics, SV_VertexID
and SV_InstanceID
, to generate billboards from the particle points.
We will introduce blend states to deal with the alpha blending of particles. In order to render the particles without regard to the order, we will also disable writing to the depth buffer.
Getting ready
Let us start with one of the previous rendering projects used in the recipe, Animating bones, of Chapter 4, Animating Meshes with Vertex Skinning. In this recipe, we will make use of a modified version of the CreateBufferUAV
C# function that we created in the Calculating an image's luminance histogram recipe of Chapter 7, Performing Image Processing Techniques.
The completed project and the following textures can be found in the downloadable companion code as well as the following...