Jump to content
  • Advertisement
Sign in to follow this  
mrheisenberg

Question about instanced rendering performance

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

Can you use instancing for everything?I mean obviously if something is rendered 1000 times,you should instance it,but what about if it's only rendered 1-5 times,does the instancing cycle(or whatever it is in the GPU) cause a large overhead?

Share this post


Link to post
Share on other sites
Advertisement
Well, that's something to test. Instancing is a good way to reduce draw calls which helps to reduce the CPU load.

I use instancing in my projects for every drawn mesh and I don't make difference if there is just 1 instance or 100. This way I have only one shader for each case instead of 2 (because typically instancing shader and single object rendering shader are slightly different).

Cheers!

Share this post


Link to post
Share on other sites
I believe that there is a cutoff point beyond which the performance of instancing is always better (and below which it's quite likely going to be slightly slower), but that this point will depend on hardware, drivers, API usage, API version, vertex formats, per-vertex data size, per-instance data size, etc, so it's impossible to give a definitive answer.

Personally I do the same as kauna here: if a model type is a candidate for instancing then I always draw it using an instanced path. The reasoning is also the same: being able to just have a single shader, and also a single code-path in my C++. If there is a performance hit then I accept that (a) it's going to be small, and (b) it's a fair tradeoff for the increased code simplicity.

Share this post


Link to post
Share on other sites
There is almost no difference between an instanced draw and a non-instanced draw on a modern GPU, since vertex fetch is performed by the shader cores. Edited by MJP

Share this post


Link to post
Share on other sites
There used to be a "use wisely, instancing has a non-neglegible fixed overhead" once upon a time, but that was 3 generations of hardware ago.

Meanwhile, people have abused instancing for implementing tesselation on NV40 hardware (which means using instancing on a per-triangle scale!). The performance is in my opinion entirely acceptable [Tatarinov08].

Share this post


Link to post
Share on other sites
I'm pretty sure that engines such as the Frostbyte engine (BF3) treat all drawn objects as instanced draw calls (with maybe some case by case exceptions) based on the principle; if you have one then you'll likely have many.

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!