Triangle strips for absolutely no USE

Started by
10 comments, last by Drilian 19 years, 2 months ago
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?
Advertisement
How exactly is there no use in triangle strips over raw triangles?
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.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

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.
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.
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
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
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.

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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.
Act of War - EugenSystems/Atari
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.

This topic is closed to new replies.

Advertisement