Archived

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

popatr

Direct3d which?

Recommended Posts

popatr    122
This question involves the situation where I need one face of a model to have one set of texture coordinates and an adjacent face to have a totally different set. As far as I know, this requires that there be extra vertices at the same position. So here''s what I can do--I can draw one face with a call to drawprimitive, and the other face on another call to drawprimitive. OR, I can add an extra, hidden vertex that connects the two faces so that I can draw both with one call to drawprimitive. Which has the worse penalty--lots of seperate calls to drawprimitive, or lots of extra vertices hidden behind the scenes? Your knowledge on this subject would be appreciated.

Share this post


Link to post
Share on other sites
RenderTarget    398
In general, it''s best to call DP or DIP as few times as at all possible. A few degenerate faces aren''t going to hurt anything, especially if they''re not the majority of your objects.

I like pie.

Share this post


Link to post
Share on other sites
okonomiyaki    548
Definitely the degenerate vertices. As long as there''s not so many of them, at least. Even if there was, you would get a performance hit, but you would even get a bigger hit by using a new DIP call every time you want to switch.
So basically, you will notice a performance hit if there are too many of them, but use degenerate triangles.

Share this post


Link to post
Share on other sites
chdennis    122
I''d actually skip the degenerate triangles and use a DrawIndexedPrimitive using a triangle list. This should be faster than a strip with degenerate triangles.

If you won''t have any shared vertices (i.e., you end up putting in double-vertices for every connected face), a DrawPrimitive should suffice, but definitely use Indexed for models where you have shared vertices.

Share this post


Link to post
Share on other sites
RenderTarget    398
quote:
Original post by chdennis
I''d actually skip the degenerate triangles and use a DrawIndexedPrimitive using a triangle list. This should be faster than a strip with degenerate triangles.

If you won''t have any shared vertices (i.e., you end up putting in double-vertices for every connected face), a DrawPrimitive should suffice, but definitely use Indexed for models where you have shared vertices.



How would a tri list be faster than a tri strip with less than one degenerate per face? I''m aware that tri lists are nearly as fast as strips, but they''re not faster.

I like pie.

Share this post


Link to post
Share on other sites
chdennis    122
quote:
Original post by RenderTarget
How would a tri list be faster than a tri strip with less than one degenerate per face? I''m aware that tri lists are nearly as fast as strips, but they''re not faster.



We can agree that triangle strips are faster to render because they only transform each vertex in the mesh once. Indexed triangle lists have the same characteristic of 1 vertex = 1 transformation on shared vertices (not so with non-indexed triangle lists, of course, so the indexed triangle list is the key here).

Given that, the indexed triangle list can be drawn with zero degenerate triangles.

In my own terrain tests, I tested with 3 methods of rendering large terrain meshes (large being > 100,000 triangles) - triangle strips, triangle fans, and indexed triangle lists. All 3 were very close in terms of rendering speeds. Indexed triangle lists outperformed strips by a very slight margin, and both had a modest speed increase above fans.

But you bring up a good point -- perhaps the term _faster_ may not be the best or most accurate term here. The difference was minimal with my own tests (we''re talking a diff of, like, 46 versus 48 FPS in favor of indexed lists), and who''s to say that another test with strips/fans layed out a bit differently might not produce different results (or even the drivers/hardware that a particular machine uses)?

So I''ll retract the "faster"; however, I will venture to say that the list implementation is a bit cleaner, eliminating the degenerate triangles altogether.

Not sure what I have against triangle strips, though . Maybe it''s that they''re easier to read-write, alleviating the need to arrange the triangles "just so" to get the results you need, especially where irregular meshes are concerned...

Share this post


Link to post
Share on other sites