Jump to content
  • Advertisement
Sign in to follow this  
ElFrogo

Generalized TRISTRIP DIP PrimtiveCount equation

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

I was wondering if anyone had a formula for a generalized equation to compute the number of primitives to submit to DIP, given a vertex list, and index list only. (IE, trilists is gives primitivecount=numInds / 3) If, given the size of strips, we could generalize the formula to be: NumStrips * (NumIndsInStrips +2) Where, 2 equals the number of verts needed for degenerate tris. BUT, if we're trying to abstract our DIP call from the higher levels, then trying to compute the generalized equation just from vert count and ind count gets pretty difficult. I was hoping that someone out there has solved this? FROG!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by ElFrogo
I was wondering if anyone had a formula for a generalized equation to compute the number of primitives to submit to DIP, given a vertex list, and index list only.
(IE, trilists is gives primitivecount=numInds / 3)

If, given the size of strips, we could generalize the formula to be:
NumStrips * (NumIndsInStrips +2)
Where, 2 equals the number of verts needed for degenerate tris.

BUT, if we're trying to abstract our DIP call from the higher levels, then trying to compute the generalized equation just from vert count and ind count gets pretty difficult.

I was hoping that someone out there has solved this?


FROG!


I don't know if this article helps (i have not read it yet) but you can give it a try : http://wscg.zcu.cz/wscg2004/Papers_2004_Poster/P89.pdf

Share this post


Link to post
Share on other sites
Wouldn't a DIP call for a triangle strip always use (number of indices - 2) for the primitive count? I can't think of any reason why it wouldn't.

Share this post


Link to post
Share on other sites
Well, a 4x4 terrain grid, would have 25 verts, 40 indicies, 6 degenerate indicies, 32 visible polies, and 3 degenerate polies.
giving 46 indicies, 35 polies (primitives)

46-2 = 44 != 35


For a single strip, maybe -2 would work, but when you start concantenating strips next to eachother, you have to increase the degenerate polies, which help even more to move that -2 away.

FROG!

Share this post


Link to post
Share on other sites
However the degenerates are still primitives as far as the hardware is concerned. So the DrawIndexedPrimitive call should still be told the total primitives including any degenerate.

In a triangle strip, each vertex, after the first two, makes a new triangle primitive (even if it's degenerate).

This is assuming your are wanting to know the valid value to pass into the DIP call for number of primitives. If you want to know the number of actual non-degenerate triangles, then you'll have to calculate that yourself in each case.

Share this post


Link to post
Share on other sites
BTW, mapping out a 4x4 grid on paper into a single triangle strip I end up with 32 visible triangles, 4 degenerate triangles, and a total of 38 indices. This fix exactly into the (number of indices - 2) = number of primitives for the DIP call.

Share this post


Link to post
Share on other sites
where's that math coming from?

a 4x4 grid, would yield

4 strips of 8 polies a piece. (total 32 polies)
4 sets of 10 indicies a piece. (Gives 40 indicies)
3 degenerate triangles (not adding the dangler at the end of the grid)
(giving 46 indicies)

?

FROG!

Share this post


Link to post
Share on other sites


The larger numbers are the triangles, the smaller numbers are the indices. The smaller index numbers are inside the triangle they form (except the degenerate ones). Triangles 9, 18, 19, and 28 are degenerate.

When you make it into one strip you don't have 10 indices per row. You have 10 in row one, and 8 in each of the other 3, plus the 4 degenerates. That's 38 indices and 36 primitives (32 visible, 4 degenerate).

Share this post


Link to post
Share on other sites


This is an alternate way to do the strip which more closely matches your decription. It is basically taking the 4 seperate strips and combining them without modification. However, when you do this then you have to insert some indices along with the 2 indices at the beginning of the 2nd, 3rd, and 4th strips form 4 degenerate triangles each. So, triangles 9, 10, 11, 12, 21, 22, 23, 24, 32, 33, 34, and 35 are degenerate.

This one has 44 total triangles, 12 degenerate, and 46 indices. So it's still number of indices minus one equals the primitive count.

[Edited by - reltham on August 3, 2005 6:47:42 PM]

Share this post


Link to post
Share on other sites
Where are the indicies to create the degenerate triangles? Your diagrams don't seem to list those?

FROG!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!