Sign in to follow this  
pcwlai

Indexed primitives and texture mapping

Recommended Posts

Indexed primities is a great way to reduce the amount of vertex data and so, decrease bandwidth requirement on AGP/PCI Express and reduce graphics card work load on vertex transform. A problem exists and how to solve this? Or just don't use indexed primitives? When creating models on 3DS Max, and if you don't (or mostly, you cannot) flatten the model's texture into 2D, you need to detach meshes and map them seperately. In this case (the most common case?), you need to have duplicate vertex (duplicate the coordinate but have different texture coordinate). e.g. when drawing a cube and all 6 faces have different texture coordinates, then, you still need to have 24 vertex data to accomodate the texture coordinates which eliminated the use of index buffer. So, is indexed primitives usable in commercial game engines and how most do it? Thanks.

Share this post


Link to post
Share on other sites
If I understand you correctly...

You're pointing out that vertex data and texture coord data can't always be indexed together -- vertices may share the same position but different tex coords, or vice versa. All of the modeling packages I've worked with seperate texture coords and vertex positions into seperate arrays, with seperate sets of indices. Unfortunately, that configuration simply isn't useful, since the hardware doesn't support using multiple index streams for different vertex streams. I can't comment on commercial games at the moment (I can ask a few friends of mine, though, so wait a bit), but I do the following:
  1. Flatten the indices completely, using the faces as the definitive array and constructing an unindexed array.
  2. Re-index the vertices based on all data, which means position, normals, all tex coord sets, and color.
  3. Run the entire thing through NvTriStrip, so that the indices are laid out in an optimal configuration.
Overall this doesn't work out too badly. The actual quality of results depends on the specific model, but generally there's fairly decent re-indexing, even when the model's texturing is fairly sophisticated. And there's no real way around this to regain the "lost" bandwidth, so what can you do? Bandwidth is getting to be quite plentiful these days; I don't think it's very often at all that a game is bandwidth limited, unless you're doing something fairly strange.

Share this post


Link to post
Share on other sites
Thanks a lot for your decent help, Promit! It really answered my curiouse a lot. And hope you can get the ways from how commerical engines are working on this problem soon.

Currently, I am grouping and re-indexing the model data from 3DS Max 7/8 with plugin. Because of the complex mapping requirements from modellers, it is not that efficient in re-indexing in my case.

The most troubled problem is, when doing skeleton and skinned character animation, fixed pipeline or shader, both need to transform the same vertexes which I think is a waste. So, finding any solution on that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this