views:

361

answers:

2

I'm implementing billboards for vegetation where a billboard is of course a single quad consisting of two triangles. The vertex data is stored in a vertex buffer, but should I bother with indices? I understand that the savings on things like terrain can be huge in terms of vertices sent to the graphics card when you use indices, but using indices on billboards means that I'll have 4 vertices per quad rather than 6, since each quad is completely separate from the others.

And is it possible that the use of indices actually reduces performance because there is an extra level of indirection? Or isn't that of any significance at all?

I'm asking this because using indices would slightly complicate matters and I'm curious to know if I'm not doing extra work that just makes things slower (whether just in theory or actually noticeable in practice).

This is using XNA, but should apply to DirectX.

+1  A: 

When it comes to very primitive gemotery then it might won't make any sense to use indices, I won't even bother with performance in that case, even the modest HW will render millions of triangles a seconds.

Now, technically, you don't know how the HW will handle the data internally, it might convert them to indices anyway because that's the most popular form of geometry presentation.

Shay Erlichmen
+1  A: 

Using indices not only saves on bandwidth, by sending less data to the card, but also reduces the amount of work the vertex shader has to do. The results of the vertex shader can be cached if there is an index to use as a key.

If you render lots of this billboarded vegetation and don't change your index buffer, I think you should see a small gain.

Cat
Not only that, you used to (probably still have to) have to use index buffer to enable the post-transform cache, which is a good thing (tm)
Rodrigo Lopez
I'm confused by your comment. When I wrote "The results of the vertex shader can be cached if there is an index to use as a key" I assumed I was referring to the post-transform cache.
Cat