Archived

This topic is now archived and is closed to further replies.

NeXius

Triangle Strips VS just plain Triangles

Recommended Posts

Hi I''ve heard from a few places that using triangle strips isn''t as much of a speed boost as it''s sometimes made out to be... and that it''s usually smarter to just use triangles for simplicity and ease (making culling, collision detection, etc. easier) I know at some time in the past it made a great optimization but what about for modern GPU''s? Please clarify this for me Thanks

Share this post


Link to post
Share on other sites
Triangle strips are fastest for maily two reasons:

1) you pass a new polygon with only a new single vertex.

2) every software/hardware renderer can manage only triangles so passing triangles is the natural way to describe a polygon.

Older/newer GPU it is not the matter...passing more data (vertices) consumes time! However the rel bottleneck, we know, is the fillrate (80-90% of the total rendering time) so passing TRIANGLE STRIP can be a minor optimization and it''s possible only with a specific mesh.





Share this post


Link to post
Share on other sites
and now that you can even store the index arrays in video memory the difference is even smaller ,-) a big advantage so far would have been that you have just about a 3rd of the indices to send with strips (of course now you can say you have just a 3rd of them to store ,-) )...

Share this post


Link to post
Share on other sites
Strips are faster there is no doubt on that.

Consider this:


  
p1---p2---p4---p6
\ | /| /|
\ | / | / |
\p3.---p5---p7


what happens here is that you only provide one extra vertex
for a new polygon where in the single poly case you have three
vertices per polygon. That means extra traffic on the card.
Traffic that could have been used to draw two more polygons.


____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

Share this post


Link to post
Share on other sites
youre forgetting cases where you would need to draw 5 strips instead of one tri list, where you''re fillrate bound and it doesnt matter if you could send three times as many polys etc.
isolated they may be faster, but quite often they wont make a difference or slow you down (prefer one tri list over 10 short strips any day)

Share this post


Link to post
Share on other sites
quote:

Strips are faster there is no doubt on that.


Meeep, wrong

They are faster, only if one condition is met: if you are AGP transfer bound (they use less memory for the indices, and less bandwidth for the transfer). Once the index arrays are in VRAM, the rasterization speed of both is exactly the same. Although tristrips might be a bit faster here too (because of less memory access), this will almost be unnoticeable (VRAM is very fast, when accessed by the GPU).

But don''t forget to include the vertex cache into the equation. And that''s where the situation turns around: a well optimized (ie. vertex cache friendly) triangle list mesh is going to be much faster than a perfectly optimized tristrip mesh (assuming both are in VRAM). Why ? Because the stripping limits your use of the vertex cache. You don''t have much choices about the next face to be drawn, it has to fit into the strip. Lots of already transformed vertices will be pushed out of the cache, you have no possibilities to reuse them. With tri-lists, however, you have arbitrary access to the indices, and can take full adavantage of the cache. That can make a huge difference, especially in combination with complex vertex shaders.

Share this post


Link to post
Share on other sites
Hmm, well I can say that Richard Huddy who used to work t nVidia
would disagree. When I talked with him little over a year ago he was quite specific about the use of strips over anything else. What you say might be true for an older generation of cards I really can''t say but I have honestly heared (and from what I myself have tested) that Tri lists are faster. But at the same time when I saw some demonstrations that he presented of the different techniques I am not so sure any more. To quote him: -Always use strips, there are almost no case where anything else is faster.

So whom should I listen to? Someone who has been working on this issue internally at nVidia or you? ;-) It''s all very confusing. Although I would not mind to see some source that further proves the point. This is not meant as I don''t believe you but now I have two opinions from quite respectacle ground standing against each other. If you feel you have the time to provide me with some samples feel free to drop me a mail at michael@planetrift.com I really would appreciate that since it really would affect the way I make my gaming API. Since I am just making the 3D part it is still not too late for me to change strategy.

Sincerely

Michael

____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

Share this post


Link to post
Share on other sites
People I know in the 3D hardware industry told me I''d better used index primitive rather than anything else, cause it''s more cache friendly (the driver/hardware could manage it).

So Indexed Triangles or TriStrip should do the trick, difference of performances is minimal I heard. (and I agree with Yann L about the cache and all)

-* So many things to do, so little time to spend. *-

Share this post


Link to post
Share on other sites
If you are using tristrips you have less vertices to transform with matrices, vp! Often It''s smarter to jump to strips rather than have a lot of tris & frustuming/oclusioning. However, its question what''s slower CPU/GPU!

______________________________
Madman

Share this post


Link to post
Share on other sites
quote:

What you say might be true for an older generation of cards I really can't say but I have honestly heared (and from what I myself have tested) that Tri lists are faster.


No, I meant the most recent generation. The larger the vertex cache (and it will obviously grow larger, as newer cards come out), and the more complex your vertex processing, the larger the speed gain for (well optimized) tri-lists.

Note that there are two primary factors playing against each other: tri-strips are inherently faster, because they need less memory access. But tri-lists are faster, because they can better reuse pre-transformed vertices.

Now, which is faster in practice, does entirely depend on your use of those features. In old-school engines (no vertex shaders, lots of streaming, no VRAM cache: Quake3 style), then tri-strips are going to be faster. Always.

But on next-generation engines, with highly complex (and slow) vertex shaders and VRAM caching, then the equation flips around: the fact, that the results of the expensive vertex shader can be retrieved from a cache (in a much better way than with tri-strips) will definitely make tri-lists faster. That was the case on any 3D card I tested, and that were quite a few.

In conclusion: since it depends on your particular use of the GPU, you'll have to profile it for yourself.

Oh and important: we are of course comparing indexed tri-strips with indexed tri-lists, obviously.

quote:

If you are using tristrips you have less vertices to transform with matrices, vp!


Nope, it's the opposite: while tri-strips have less indices, they need to transform vertices much more often to get the same mesh (at least statistically, on real-life meshes).


[edited by - Yann L on May 5, 2003 11:40:48 AM]

Share this post


Link to post
Share on other sites
So, what we have here are two possible pieces of advice. One is that strips are faster the other is that tri-lists are faster. The moral of the story here is that you need to look into what you want to do and measure which is the fastest approach because no single approach is the best. Something that seems to be increasingly more common today. I rarely ask for advice but I am glad this issue came up, because I was quite firm in my beliefs. Personally I have learned something today and I am happy about it, even if this means more work for me as I will now have to look into how to improve my mesh handling.

____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won''t engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.

Share this post


Link to post
Share on other sites
quote:

The moral of the story here is that you need to look into what you want to do and measure which is the fastest approach because no single approach is the best.


It''s not so much a question about a single best approach, but about the the best approach suited to your particular situation. If you take this into account, then there might very well be a single best way to accomplish somethine: but this way will mostly be valid for you, with your specific engine. The only thing that can be generalized are abstract statistics: if you do this and that, then expect this and that behaviour. If, and how that behaviour will impact your performance, depends on your particular engine design. The concept of "faster" is highly relative these days, and the standard answer to those kind of issues typically is: "it depends".

Share this post


Link to post
Share on other sites
look at the bright side.. sooner or later you will have a lot of fun with textures and rather sooner than later you might hit the fill rate limit. and from there on it really doesnt matter anymore if strips would perform 0.002ms better if fillrate would let them. but the time you might have invested to convert everything into the longest possible strips is something you wont get back ,-)

why not stick with the simpler lists and if you later get to a point where they become the bottleneck and you need every fps you can get you can still change to strips.

Share this post


Link to post
Share on other sites