Search code examples
graphics3ddirectxhardware-accelerationsharpdx

Drawbacks of Hardware Instancing for "single instances"


I am writing a 3D graphics application (using SharpDX) with static and animated (including skeletal animated) meshes. Some meshes will only be rendered once per frame, some will be rendered a large number of times. In order to speed up rendering I am planning to take advantage of hardware instancing.

Rather than implementing an instanced and a non-instanced rendering routine and selecting the correct one for each mesh, it has occurred to me that it will be easier to simply use instanced rendering for all meshes.

Assuming that the target hardware supports hardware instancing, are there any drawbacks to using hardware instancing to draw all meshes, even if they only occur once per frame?


Solution

  • I am thinking it could be a tad slower as you are introducing an extra buffer binding to set the instance buffer. So each mesh requires 2-3 buffers to be rendered (the Vertex buffer, the Instance buffer and possibly an Index buffer) instead of only 1-2 (vb and ib).

    As always though, if it helps standardise your engine and you do not experience any noticeable drawbacks then there will be no need to optimise. The only way to know is to profile these two variants of your app.