Sign in to follow this  
mrheisenberg

Question about instanced rendering performance

Recommended Posts

mrheisenberg    362
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
kauna    2922
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
mhagain    13430
I [i]believe[/i] 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 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
_the_phantom_    11250
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this