Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

This is a general question, but as a specific example, I'll use the XNA Particles3D sample (http://xbox.create.msdn.com/en-US/education/catalog/sample/particle_3d).

What is the point of the index buffer in a particle system? If the advantage is indexing repeated vertices, wouldn't only a connected mesh take advantage of these? The probability that the vertices in a particle system will be shared for extended periods of time is extremely low.

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

Since each particle is a quad of 2 triangles, there are 2 vertices per particle that are shared. That's enough to consider it a savings to index them. It reduces the vertex buffer size from MaxNumParticles * 6 (if you didn't use indices) to MaxNumParticles * 4 (when using indices, like the sample does). If you set it to 1000 max particles per particle system and have a half dozen systems loaded up, it's worth saving that GPU memory. All for the expense of a relatively small amount of space that the index buffer uses.

share|improve this answer
add comment

Indexing particles can allow multiple particles to be drawn in a single draw call. Since D3D9 (which XNA is derived from) has no quad primitive type, indexing is an efficient way of concatenating multiple strips or fans. It doesn't require degenerate vertices, indices are smaller than vertices, and thousands of particles can be handled in a single draw call which greatly enhances performance.

Take these two strips for example:

Indexed Strips

They don't share vertices, and without indexing you would need to make a separate draw call per strip. Now multiply that by hundreds or thousands, and you'll get so much draw call overhead that your performance will really suffer.

However, if you add an index buffer you just need a single draw call to draw both of them. Hundreds of particles? Single draw call. Thousands? Likewise. So you get to avoid the draw call overhead of an unindexed particle system.

Another reason is that instancing is sometimes used as an efficient way of pushing vertex data to the GPU for particles. Using instancing it's possible to draw billboarded particles using only one vertex per particle, rather than the usual four, so this quarters the memory overhead.

Now, and again with D3D9 class APIs, instancing is only supported for indexed drawing. So if you want to use instancing you have no choice - you must index.

(Of course other solutions - such as point sprites and geometry shaders - are also possible for particles, but since the question was about indexing I'm focussed on answers that provide the rationale for that.)

share|improve this answer
add comment

I've never measured, but there may be use for index buffers in mesh particles. Though the particles don't share vertex, the meshes making up a particle might, and reducing the vertex processing of those is just as helpful (if not more so, with a large enough number of particles) than doing it for many "regular" models.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.