Jump to content
  • Advertisement
Sign in to follow this  
CProgrammer

multiple draw calls

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

Well we all know that draw calls are slow so one should keep vertexbuffers large and draw them in one go. Now my question is when does this really become an issue? An example would be trees? Say I define one tree and make multiple instances. Basically I have only one vertexbuffer that holds a tree and each instance makes a draw call. This way things are clean and easy, instances can easily be deleted and created. Now Im wondering wether I should copy each instance translated into one vertexbuffer. Would the speed difference be large enough to justify the inflexibility? Another example that is slightly different. Say I have an army of soldiers that all look alike. Should these be dynamically copied into a vertexbuffer per frame? Would that be faster? -CProgrammer

Share this post


Link to post
Share on other sites
Advertisement
I'd say benchmark it, and see where you get the improvement.

But I would suspect that for dynamic rendering, multiple draw calls would actually be faster than constantly resetting a vertex buffer each time you wanted to add/remove a tree. And it would make culling a mess -> more fps lost.

So I'd say stick with the down-and-dirty for dynamic things, but if you're not going to be moving them, removing them, or adding them, then by all means put them all in the same vertex buffer.

And don't forget - you have to use a call for EACH texture. [wink] So unless you're really good with fitting 10 textures into a 512x512... good luck.

IMHO it's more work than its worth.


Mushu - trying to help those he doesn't know, with things he doesn't know.
Why won't he just go away? An question the universe may never have an answer to...

Share this post


Link to post
Share on other sites
What I do is place a number of copies of small objects into the VB each with a unique ID.

If I need to render 4 trees, I adjust the vertexcount, and primitivecount to the draw call, and set a few more shader constants with the extra world matrices, material colors, opacity, etc for each instance.

Depending on what you're doing, you might prefer to put pre-translated ones into a VB. That can lead to very large VBs, but will work nicely on pre-shader cards with hardware T&L. If you require shaders, a little work will give you batching as I've described above. Dynamically updating each frame will use quite a bit of AGP traffic, but on a pre HW T&L card that will be necessary anyway.

So anyway, depending on your target specs, you can atleast limit your choices, or open up options your didn't consider before.

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!