Sign in to follow this  
Chris81

Starting Triangle Strips

Recommended Posts

Hello, My engine currently renders indexed triangle lists with 75,000 triangles at 465FPS. I am going to convert to triangle strips, and I was just wondering what algorithm most people use to generate the strips. I found this article which seems good, so I am reading it now. But I thought I would get some opinions or links to resources if you have them. Thanks.

Share this post


Link to post
Share on other sites
Interesting, so are most engines just using optimized lists then?

I added the GenerateStrips() for my meshes index buffer, and it worked great...added 100-150FPS. However it takes FOREVER to optimize for large models. It's been working on a 75k face model for about 5 minutes now...

I also noticed it's staying at 50% CPU usage. Is there a way to override this and use closer to 100% so it goes quicker? I imagine this is handled by win xp's process priority system. Maybe that isn't something I would want to do anyway?

Thanks for the help!

Share this post


Link to post
Share on other sites
Finally finished. 75k face model going 578FPS now instead of 465 previously.

How is this speed, considering all I'm doing is rendering a model with no translations or even texturing yet?

I know what you might say...dont be so worried about speed yet, but I figure this is the very foundation of everything to come - if rendering the vertex data isn't as fast as I can get it, then I'll have troubles later, right?

Share this post


Link to post
Share on other sites
hi,

just my guess, but as you don't use any texturing, translations, etc. your program is currently limited by the speed at which the triangles are drawn. The GPU uses a cache to access vertices, do the T&L on it, etc. With triangle strips, as the vertices are always in the right order (you will never have indices like that : 1, 100, 50, etc. but always like that : 0, 1, 2, 3, etc.) So it's optimal in terms of caching, so that's probably why you have more FPS with triangle strip.

Again, just a guess, I'm not really good with all the low level stuff ^^

Share this post


Link to post
Share on other sites
Quote:
Original post by paic
With triangle strips, as the vertices are always in the right order (you will never have indices like that : 1, 100, 50, etc. but always like that : 0, 1, 2, 3, etc.) So it's optimal in terms of caching, so that's probably why you have more FPS with triangle strip.


That's not entirely accurate. What you've got is two caches - pretransform and posttransform. The pretransform cache contains data read in from the vertex buffer - it usually contains several vertices because it's more efficient for the card to read a block of several vertices from the buffer in one go, instead of one at a time. The posttransform cache contains vertices that have been run through the vertex shader.

Because of the posttransform cache, the same sequence of triangles in both strip and list form should be roughly equivalent because they refer to the same vertices, meaning that you should get cache hits. However, the tri strip can mean fewer indices (provided the number of degenerates you have isn't too high), which is less work to actually process, and takes less memory.

To make best use of the pretransform cache, you should resequence the vertices in your buffer such that vertices which are referred to sequentially in the index buffer are laid out sequentially in the vertex buffer (and this isn't a particularly easy thing to accomplish as vertices may be referred to multiple times in the index buffer). I've got a feeling NVTriStrip provides a function for this.

Share this post


Link to post
Share on other sites
Quote:
Original post by superpig
To make best use of the pretransform cache, you should resequence the vertices in your buffer such that vertices which are referred to sequentially in the index buffer are laid out sequentially in the vertex buffer (and this isn't a particularly easy thing to accomplish as vertices may be referred to multiple times in the index buffer). I've got a feeling NVTriStrip provides a function for this.


Yeah, there is a function added to it by the xbox crew called RemapIndices, however you have to reorder your vertex buffer yourself. I've already implemented it, and the indices are ordered much more sequentially.

So do you think optimized, reordered indexed VB will be sufficient, or should I go for strips?

Share this post


Link to post
Share on other sites
Actually, I think I'll answer that myself. Since the optimized lists are around as fast as strips on newer cards, and the fact that strips will complicate thinks like dynamic meshes, and I am a first timer...I'll stick with lists for now.

Once I get familiar with the entire pipeline and do some complex vertex algorithms, I'll try strip too.

Share this post


Link to post
Share on other sites
Oh yeah, and the comments say Blizzard programmers re-wrote and contributed the two main functions, xbox did the RemapIndices, and yet it's still called ...Nv...TriStrips. That's awesome though, I didn't know there was that much collaborative effort between the big dawgs.

Share this post


Link to post
Share on other sites
Quote:
Original post by Chris81
Yeah, there is a function added to it by the xbox crew called RemapIndices, however you have to reorder your vertex buffer yourself. I've already implemented it, and the indices are ordered much more sequentially.


Well, if you have inplemented RemapIndices() usage, wouldn't you like to show your code? I have some troubles -- i can't understand what should i do with vertices and what with indices. I tryied many variants, but I couldn't get appropriate result. Maybe my copy of NvTriStrip is buggy -- RemappedGroups it returns DON'T contain a transmutation of an array... :(

[Edited by - cppg on July 13, 2005 6:01:59 AM]

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