• Advertisement
Sign in to follow this  

DrawPrimitive Optimizations

This topic is 4787 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 have read that triangle strips are often faster for hardware, but I also know that it's much better to reduce number of drawprimitive calls, so here is my problem: I have many characters which have each about 2000 triangles, my question is what's the better, rendering them entirely in only one drawprimitive call using triangle lists or doing many (a few hundred) drawprimitive calls using small triangle strips or triangle fans. thanks

Share this post


Link to post
Share on other sites
Advertisement

In theory the more triangles you can send to the pipeline in one pass the better. I usually set up a global pool of triangles and just render them all in one fast swoop... Although I'm not 100percent sure this is the "best" way.

In theory it seems like it would be faster.

Share this post


Link to post
Share on other sites
nVidia recommends about 300 DrawIndexedPrimitive calls per frame as a maximum in general. On a 1GHz target PC, I think they suggest 500 is a good maximum. Spending a few hundred calls on just characters is too much. You've got the world, large things in the world (like cars, benches, houses, trees), and small things in the world which add realistic detail (rocks, flowers, grasses, birds, insects). You quickly run into having a huge numbers of things to render, and getting each item to render in 1 call, or even rendering a dozen things in one call, becomes an important concern.

If you can use a tristrip, go for it. You'll save fetching a few indices. This is perfect of chunks of terrain and the like. In general though, for an arbitrary mesh, a trilist that is optimized for cache usage is better. If you're just toying around learning how to use some new features like shaders, or just getting a feel for the API, it doesn't matter much. Ignore it for now. It's something you can change later on. If you're trying to make a decent game project or engine though, then it's time to worry about these things.

Share this post


Link to post
Share on other sites
thanks for the advice, but how exactly do you manage device state,material changes when you send all youre triangles in a global pool. Do you flush polys(render them) every time a new state or material change occurs or do you batch them per state and render them all at the end. An other question for dynamic meshes(I mean meshes that you create on the fly) what's the best: using video(or AGP) memory vertex buffers or system memory, I have experienced that writing with random accesses to video memory is very slow, and copying big bunches from system to video memory can also be quite slow compared to using directly system memory buffers. I do use d3d_discardlock flag and nooverwrite, but every time I wan't to use static vb I get a significant fps fall. Has somebody got any idea of how to optimize vertex buffer mnagement.

Share this post


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

  • Advertisement