Sign in to follow this  

Triangle strips for absolutely no USE

This topic is 4688 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

Greetings! I have just downloaded the DX SDK February 2005 edition, and checked the optimized mesh demo. Why do all the papers write use triangle strips wherever you can (i get the logic) where there is absolutely no use - at least there is no advance. I was wondering if anyone has experienced a dramatic speed increese with triangle strips? Another funny thing are INDEXED Skinned Meshes. Using INDEXED HW on GeForce gives you better performanece than NONINDEXED (which might seem logic) but on the other way, RADEON 9800PRO handles NONINDEXED Skinned MESHES far better than Indexed. You can check the Tiny demo. Wierd isn't it?

Share this post


Link to post
Share on other sites
How old were the papers you read?

I've heard it said often that with today's PC graphics hardware, it's usually quicker to throw a single triangle-list batch containing everything than it is to throw a number of triangle-strip batches containing only what you could strip together in each one.

Of course, there is a problem in that a triangle list stands to duplicate vertices. Using an indexed triangle list should defeat that though.

Share this post


Link to post
Share on other sites
Well as you probably know, the main benefit to strips is that almost a third of the information is required so that is much less info to transfer to the GPU each frame.

Back when I was rendering my 256x256 terrain in straight opengl immediate mode with no optimizations, my fps switched from 15 to 58 when I switched from triangles to triangle strips. I was a little surprised by the immense improvement to be honest, but I guess with large amounts of information, the difference can start to show.

Share this post


Link to post
Share on other sites
Quote:
Original post by Khaos Dragon
Well as you probably know, the main benefit to strips is that almost a third of the information is required so that is much less info to transfer to the GPU each frame.

Back when I was rendering my 256x256 terrain in straight opengl immediate mode with no optimizations, my fps switched from 15 to 58 when I switched from triangles to triangle strips. I was a little surprised by the immense improvement to be honest, but I guess with large amounts of information, the difference can start to show.


As superpig said, most papers as of late indicate that sending a batch of vertex cache optimized indexed tris can match/exceed the performance of tri-strips because drivers these days are able to pick up on would-be strips anyway. Granted you're still sending the data, but the post-transform vertex cache is being utilized more frequently due to the vertex cache optimized index list.

Your terrain mesh in some ways doesn't really count since it's easy to generate terrain data that's ideal for stripping. Most real-world geometry in today's games is a bit more complex and not nearly as strip friendly. At least on the DX9 side, leveraging the vertex cache optimization feature of the D3DXMESH feature yields a significant performance increase with indexed tris.

Share this post


Link to post
Share on other sites
Silly intermediate mode :-). Anyways, Triangle strips are quite useful, as Khaos said, its much less data being sent over the bus (or even less data in the index buffer) pretty much no matter what you should be using indexed primitives, whether its strips or lists, doesnt matter so much, but sometimes lists are a huge help (note there are a few reasons why Khaos' instance was so dramatic, first of all, he was in immediate mode, which means he was not only not indexing things, but he was sending every bit of vertex data over the bus, which means that when he switched to strips, he didnt need to send 1/3 of the data, and 1/3 of a bunch of vertices is a lot more than 1/3 of a bunch of indices, and if it all is over on the card already, i assume the difference would be even less, moral of the story: index your triangles, use strips WHEN POSSIBLE, but dont if that means chopping things up into multiple draw calls) (oh and Khaos, not raggin on your method, just explainin to him :-) i use immediate mode all the time for anything that doesnt need über speed)

hope that helps
-Dan

Share this post


Link to post
Share on other sites
I have actually tested lists vs. strips on some reasonable data, and strips were _slower_. This was on a late model NV card. I believe that the vertex cache removes nearly all advantage of using strips. (Of course, you should always be using indexed primitives to take advantage of this cache, and avoid duplicating vertices).

If you break up your data in multiple DrawPrimitive calls obviously it will be slower. If you use degenerate (0 area) triangles to stitch your strips together, my guess is that it still takes the hardware a little time to evaluate the triangle and reject it, and that's why strips ended up being slower in my test (even though there were less indices, there is a cost per triangle, I would guess). Your mileage may vary; if you have some sort of data like the terrain mentioned earlier that has very long strips, maybe it's faster. (Though I wouldn't want to bet on it if a recent card was involved). In any case I definitely wouldn't stripify tris that didn't have natural strip properties for PC hardware.

Share this post


Link to post
Share on other sites
Nowadays, it's suggested that you use strip ordered indexed tri lists.

In other words, use indexed tri lists, but order them kind of like how a strip would look. That gives the best results.

Share this post


Link to post
Share on other sites
The fact today is plain an simple.
Indexed data is the way to go. Period. Non indexed triangles, whether it be trips or triangles, are always a failure performance wise.
Now, should we use indices as strips or explicit triangles?
Strips are better than unordered triangle soup.
Explicit indexing of cache friendly triangles is better than strips.
You can achieve a higher local winding that with strips. The only drawback being IB size. If you ever fill your video memory with IB's, call me, you have a serious problem.
I have done many tests, and if any ordering is faster than soup, and strip get beaten by carefully crafted triangle IBs almost all of the time. You can waste your time trying it out, but I've already wasted mine, so let that be useful.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There is one small caveat I think should be pointed out here - the OpenGL NV_primitive_restart extension. I don't think there is any equivalent functionality in D3D, but basically this extension allows you to draw multiple triangle strips (or for that matter multiple groups of any other primitive) in one batch. I haven't tested it so I don't know if that would help or hurt performance compared to triangle lists.

Share this post


Link to post
Share on other sites
yes, this is handy to remove degenerate tris on cards that support it, however, you can exclude all ATI cards AFAIK (except if they implemented this NV extensions in their latest stuff, but I highly doubt it ;))
(although this isn't really a problem is you rebuild the strips at runtime according the the primitive restart extension...)
and for dynamic data, unless perhaps on PCIE, I guess the gains from lower upload times due tu less vertices in tristrips would be quite advantageous compared to potential rendering gains with tris... (and if both tristrips and tris were ordered cache friendly, perfs are pretty much the same anyway, (didn't do extensive tests on this though.. the only difference except increased upload rates for tri lists (and it doesn't count if already in vid mem) would be the cost of evaluating degenerate tris, or restart indices (I have no idea of what this costs), so deciding on which one to use depends pretty much on the mesh, and on the usage (dynamic, static..)))

Share this post


Link to post
Share on other sites
I'll expand a little on what janos was saying.

Assuming you're using indexed primitives (which you absolutely should be), there are two basic cases of use:

1. Static Data (most of your vertices should be static data, says everything that I've read).

Static data doesn't have any bandwidth issues associated with using strips over lists. It does use up more space, but that's generally not as much of a concern as it used to be. Especially when we're dealing with tiny indices, instead of large vertices. So bandwidth is not a concern here.

2. Dynamic data.

I'd be willing to go out on a limb and say that, for most usages of dynamic data, the vertex data is dynamic, but not necessarily the indices. This may not be true for some things, but for those things that it IS true for, the bandwidth will be the same regardless of using strips or lists.

The only time when you might see a performance hit (exclusing a memory overrun which is unlikely to be caused SOLELY by using lists instead of strips) is in dynamic data with dynamic indices. But my guess would be those cases are few and far between.

As long as the vertices in your vertex buffer are in a strip-like order, lists won't perform any worse than strips, thanks to the wonderful vertex caching that modern cards have. They may even perform better on some cards.

Just make sure that your vertices are ordered in a cache-friendly manner.

Share this post


Link to post
Share on other sites

This topic is 4688 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.

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