Convert triangle list to triangle strip

Started by
16 comments, last by jbarcz1 16 years, 9 months ago
Hi, I hope this is the right forum for this question! I'm a little confused about this whole thing so I apologise in advance for any stupidity! The scenario is this: I'm writing a game engine and have been working on the mesh export tools for 3dsmax. Max provides mesh data in a triangle list format, and what I want to do is to turn the list into a triangle strip for dumping out to disk. So then my question is, where can I find out about this? Further info: I've been researching and experimenting with the NvTriStrip library as a possible solution and it's confused me somewhat. What's confusing me is what do the 2 main conversion functions actually do? So my question really is, can I use the NvTriStrip library to convert my triangle list to a triangle strip. All I need here is a reference. If anyone knows of a definitive reference on this then I'll buy it if necessary - I've tried searching the web with little luck :-( Also if anyone with experience of the NvTriStrip library could offer me a pointer then that would help too - I tried looking at the NVidia sample but the data is somewhat hidden in the D3D mesh structure with little to no documentation for me to reference. Also there is only very little documentation on the library. All I want to know is _what precisely does it do_? Ok I'd better go take a lye-down now I'm so exasperated ;-) Any and all help, comments, suggestions, links etc are encouraged!
Advertisement
Out of interest, why do you want to do this? I was under the impression that indexed triangle lists were generally more efficient than [indexed] triangle strips anyway.
Exactly - Indexed TriStrips can be 50% less efficient than TriLists, especially when rendering terrain, for little additional memory footprint (considering today`s cards have 1GB of VRAM).
Just go for VRAM and you`ll save yourself troubles with degenerate vertices (that are necessay when connecting strips) and you can efficiently use the post-transform vertex cache.

VladR My 3rd person action RPG on GreenLight: http://steamcommunity.com/sharedfiles/filedetails/?id=92951596

Basically there's only one function you need from NvTriStrip:

GenerateStrips(...)

You pass it only the indices of your vertices (extract the vertex indices form the 3DS faces) and the number of indeces you passed.

Additionally you provide a pointer to a PrimitiveGroup array as well as a pointer to an int that will receive the strips (PrimitiveGroups) and the number of strips.

If you enable stitching, i.e. you want the individal strips merged by adding degenerated triangles, you get only one PrimitiveGroup, i.e. one long strip.

NvTrisStrip also is able to remap/reorder the indices to improve the spatial locality of the vertices in order to better employ vertex caching for performance gains.

NvTriStrip does a good job but unfortunately it's slow. However, there is another library called TriStripper which is faster and almost as good (in terms of number of strips) but doesn't support stitching of triangle strips.

Hope that helps.

Edit:
Ah, I was to slow.

I have that impression, too (that indexed lists are faster than indexed strips). There are tools out there that reorder your vertices for more efficient use of post-transform vertex cache. IIRC NvTriStrip might also do that for triangle lists.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Indexed triangles lists and reorder vertices in a cache friendly mannar check out the article Linear-Speed Vertex Cache Optimisation and then there is Cache-Oblivious Mesh Layouts.
Ah, thanks snk_kid. The first one was the article i read, too. Fortunately you remembered the link.
If I was helpful, feel free to rate me up ;)If I wasn't and you feel to rate me down, please let me know why!
Wow! Thank you very much guys, as usual your knowledge and support is positively priceless!

A special thank you to Lord_Evil for the heads up on the 'Tri Stripper' lib, and snk_kid for the article references!
You can try out ATI Tootle as well. I haven't personally used it yet but it's based on another paper, Triangle Order Optimization for Graphics Hardware Computation Culling (pdf), that I've heard good things about. Anyway, it's just another option. I recommend trying them all and see which works best for you.
Quote:Original post by Kalidor
You can try out ATI Tootle as well. I haven't personally used it yet but it's based on another paper, Triangle Order Optimization for Graphics Hardware Computation Culling (pdf), that I've heard good things about. Anyway, it's just another option. I recommend trying them all and see which works best for you.


Interesting, i assume this isn't ATI only? here is another paper 2007 which seems to extend the work: Fast Triangle Reordering for Vertex Locality and Reduced Overdraw.
Don't do triangle strips!

When you would like to find it out, you will find out, that VCACHE optimized triangle lists are by far faster as any triangle strip will ever be.

This is the truth. You need to use D3DXMeshOptimizeInPlace to achive VCACHE optimized index lists.

This topic is closed to new replies.

Advertisement