Triangle strips

Could anybody guide me, I have an array of triangles indexs that I would like to convert to triangles strips. Is there an algorythm that can do that?

My goal is to display my whole model in one glDrawElement using GL_TRIANGLE_STRIP…

I saw on NVidia site an application that was finding multiples strips to describe a model. (I think the app name was NVStrip)

Are those multiples triangles strips are displayable trought one glDrawElements?

Thank you for your help.

Gabriel

[This message has been edited by Gabriel (edited 01-08-2001).]

Being able to convert a bunch of triangles into one single triangle strip is extremely uncommon so generally you won’t be able to issue a single call to glDrawElement. There is a an algorithm at nVidia and there’s Stripe (which I don’t have a link to currently) with available source.

Ooops! Sorry about the “converting into a single triangle strip” stuff. I’ve read your post a bit fast . I’ve found the link to Stripe : http://www.cs.sunysb.edu/~stripe/. It’s free for non commercial uses but I don’t think the source code is available. Think I better wake up…

Here some interesting links: http://www.gamedeveloper.org/delphi3d/articles/tristrips.shtml http://www.cg.tuwien.ac.at/studentwork/CESCG-2000/ANeubauerAKanitsar/ http://citeseer.nj.nec.com/186629.html

“My goal is to display my whole model in one glDrawElement using GL_TRIANGLE_STRIP…”

for most models this is impossible, u have to use multiple strips

If you sort out the connection between triangles, it may be possible to include them in a single strip.

I saw Stripe too, looked at the output and was completely confused… what does (example output indices) 1 2 1 3 mean for the first line? 1-2-1?? I could find any very good docs on it either. I then found ATCT:
http://www.plunk.org/~grantham/public/actc/index.html

I’ve found it much easier to understand though Stripe might be better (if someone would explain the output)

It “posible” in theory to have a single strip for a model, but not much probable and depends on the model . of course, if you have a cylinder without caps you can doit easy, but that’s about it.Some vertices maybe will need to be duplicated (because they use different normal, color, or texcoord), therefor breaking posible strips.
Anyway, having multiple strips wont hurt performance as long you dont have too much strips. With triangle strips, the vertices sent are:
sentvertices = 2numstrips+numvertices
with discreet triangles:
sentvertices = 3
numvertices
so, as long as you send less strips with triangles than with triangles, you’re optimizing already. Of course, the less strips the faster you code should go. The rule then is if
numstrips<numvertices
then you’re sending fewer vertices than with discreet triangles.

I warn you that building optimized triangle strips eats your cpu when the models are large, so it should go in the pre-proccesing steps.

[This message has been edited by coco (edited 01-09-2001).]

Wow amazing! Thank you all!

You know I was asking about strip because I read that games engines where using triangles strips to render there maps and monsters…

Assuming that those models cannot be rendered in one call, is it really faster to call several times glDrawElement with gl_triangle_strip or is it faster to call it once with all the non-strip triangles indexs?
What about the function call overhead?

I know that may be application specific but what would be the general awnser?

Maybe in games, they mix possibles triangle strip calls with a non-strippable gl_triangles call…

And again thank you all…

[This message has been edited by Gabriel (edited 01-09-2001).]

Well, small strips beat the tris, but if you have many single polys left it might be better to sort them in an array and use a DrawArrays with GL_TRIANGLES

I posted a mock-up of a naive but good-enough
mesh-to-strips converter algorithm in this
very forum just a few short weeks ago. Try
using the search feature to find the
resulting interesting discussion.

I wrote a stripifier for a 3D engine and I tested it (Strips and vertex array with strips) on large models. Unfortunately, compare to the GL_TRIANGLE rendering mode, the performance profit was poor.
Nevertheless, for getting more optimisations, you can use display lists which ofen offer to you to multiply the frame rate by two but you memory will inevitable fall down.

I coded a stripifier loosely based on some piece of code I found on the net… The results are pretty good on my GeForce DDR (all models using two lights, no textures):

  1. Flower Vase (24582 triangles)

    • No Strips: 20FPS
    • Strips : 63FPS
  2. Mini Submarine (37630 triangles)

    • No Strips: 13FPS
    • Strips : 44FPS

As you can see, stripping is very useful !
Note that the models are rendered in display lists.

Regards.

Eric

Ok… Thank you Eric, But I cannot use display lists, all the models are deformable…

It seem that every one is clear on that one, using strip are better but they are pain in the a$$ to create from a list of triangles…

The improvement ratio from not using to using strips will be the same either if you use or not display lists.

Strips are trick to calc correctly, and are slow to create, but they are worth it all the way, i bet you! If you also use DrawElements, then you have the fastest posible non-displaylist models (of course, there are cases where rendering discreet triangles is faster, for example, when you render more strips than vertices has the model).

I do it something like this:
for each triang

  • find the longest strip from edge 1
  • find the longest strip from edge 2
  • find the longest strip from edge 3
  • store the longest and mark it as taken (so it cant be included in the other triangles).
    endfor

Well, its not that simple, but this is the basic way, and will give you a very good model in no time (depending on the model).

[This message has been edited by coco (edited 01-10-2001).]