Archived

This topic is now archived and is closed to further replies.

What's the use of an index buffer?

This topic is 5090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve seen index buffers here and there, and tried to find some more information in the MSDN library, but I can''t seem to figure out what the purpose, or benefit, of using an index buffer is. Anyone mind enlightening me?

Share this post


Link to post
Share on other sites
Most models have a lot of vertices that are shared by many triangles. If you''re using a vertex buffer to send all of the vertices as you use them, you''re going to be sending the same vertex over and over - each one of them taking up a relatively large amount of your video bandwidth. If you instead first transmit each vertex used in the model once in a vertex buffer, and then use an index buffer to tell the video card which vertices to use in what order, you''re just sending a bunch of ints, which uses significantly less bandwidth.

Share this post


Link to post
Share on other sites
I find that index buffers are also useful for LOD; I''ve designed (not implemented) a scheme for a simple heightmapped terrain engine that uses indices for different LODs.

Share this post


Link to post
Share on other sites
If I''m not mistaken, indexed primitives allow DirectX to do optimizations based upon the type of data you send to the graphics card.

For example, with triangle strips you only need to know the first two vertices for the starting point, then after that all you need is just one vertex to define the next triangle. If you were using ordinary vertices, you''d have to send that vertex over the AGP bus once per frame. But, if you''ve got all your vertices stored in an vertex buffer (that resides on the card most likely) and is indexed, then you can just send indexes over to the card instead of the full vertex.

Index buffers are especially useful for complex meshes (typical for say, models of the player and enemies or other ingame objects), because if your mesh is static then all you need to squirt across the AGP bus is just a bunch of two-byte integers, instead of the 4 or more bytes for a typical vertex (XYZ, normal, plus diffuse, etc).

---
[[ Gaping Wolf Software ]] [[ GameGenesis Forums ]]

Share this post


Link to post
Share on other sites
Referencing a vertex by an index also allows the GPU to setup a cache of recently transformed/lit vertices. It can use the index as the key to a cache entry and if the vertex is found in the cache it won''t have to transform and light the vertex again.

Share this post


Link to post
Share on other sites
also note that the operations that perform on indexed primitives have a higher periority for the driver than the operations done on none indexed ones.or as ati papers say the index buffers are first class citizens.

Share this post


Link to post
Share on other sites