Jump to content

  • Log In with Google      Sign In   
  • Create Account

Question about instanced rendering performance


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 22 November 2012 - 09:05 PM

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?

Sponsor:

#2 kauna   Crossbones+   -  Reputation: 2514

Like
3Likes
Like

Posted 23 November 2012 - 07:08 AM

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!

#3 mhagain   Crossbones+   -  Reputation: 7978

Like
0Likes
Like

Posted 23 November 2012 - 08:25 AM

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.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 MJP   Moderators   -  Reputation: 11367

Like
1Likes
Like

Posted 23 November 2012 - 12:11 PM

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, 23 November 2012 - 12:12 PM.


#5 samoth   Crossbones+   -  Reputation: 4783

Like
0Likes
Like

Posted 23 November 2012 - 12:28 PM

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].

#6 phantom   Moderators   -  Reputation: 7278

Like
1Likes
Like

Posted 23 November 2012 - 02:01 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS