Jump to content
  • Advertisement
Sign in to follow this  
nini

How to render a lot of triangles fans quickly

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

Hi,all i'm currently working on the implementation of a Landscape renderer for convenience, i want to use the triangle fan primitive but i would like to render a lot of triangle fans at a time so what is the best practice with DX9 ? use an index buffer ? preprocess the vertex data and refine geometry on the fly and only use vertex buffer as a real buffer (eg rendering vertices in small batches ) in this case what size the batch is the better ? by advance thanks for your answers

Share this post


Link to post
Share on other sites
Advertisement
It is not possible to render more than one fan per draw call... which is why everyone says "stay away from fans... they were a bad idea". Convert to indexed tristrips, and join them the degenerate triangles (repeat last index of strip1 and first index of strip2 when you concatenate them). Heck, convert to indexed tri-lists. Slightly less efficient than strips, but easier to work with, and MUCH BETTER THAN FANS.

Share this post


Link to post
Share on other sites
Unfortunately there isn't any way to specify a new centre/"anchor" vertex part way through the vertex or index stream for a primitive so every vertex after the first one (even if you use indexed primitives) is considered to be linked to the first; thus with fan primitives you're stuck with one Draw*Primitive*() call per fan!!

For this reason, fan primitives are not usually a good idea.

The simplest optimisation to this is to use a triangle list and generate the fans into that. The massive advantage of doing it this way is you can draw more than one fan in a single Draw*Primitive*() call - this should give much better performance than a single draw call per fan.

Using indexed triangle lists will get you closer to the "number of vertices per triangle" count that you get with fans but also the more than one fan per draw call benefit. Additionally indexed primitives are the way to take advantage of the post-T&L vertex cache found in modern GPUs, they can further improve performance.

Indexed triangle strips are the best primitive - but you tend to need to use lots of degenerates to stitch strips together to get a decent batch size. Extra stitching work, degenerate data and overall flexibility concerns often makes indexed triangle lists a better choice.


ROAM style algorithms are very fan friendly - but unfortunately fans aren't very hardware friendly. Higher level changes to the algorithm to make it output strips or lists directly should give good wins. There are other terrain algorithms too which may be worth considering.

This article might be of interest: http://www.flipcode.org/articles/article_roamopt.shtml a Google search should turn up similar articles, papers and discussions.

Share this post


Link to post
Share on other sites
okay this was the answers that i was guessing to be !
thanks for your help , i'll try to take a look at the paper for sure !

i think i will use indexed t-list much simpler to use than the strips

another question is : does the class D3DXMesh do the job of converting from t-list to t-strip... is it a good idea to enclose Row of terrain into a D3DXMesh class ?

does the gain of performance between T-list and t-strip justify this programming effort ?
thanks

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!