DirectX - 何时使用实例化,何时不使用?

DirectX - when to use instancing and when not?

我正在使用 directx 11 制作一个应用程序。我想首先使用实例化,所以为了简单起见,我组织了我的整个管道以始终使用实例化。这意味着目前如果我想在我的场景中绘制一个几何体,它仍然会通过实例渲染。

我的问题是实例化会引入哪些开销?这种方法通常是一种不好的做法吗?如果是这样,是否有关于如何决定何时使用实例有益以及何时不有益的规则?

一个类似的问题对我没有帮助:

多年来,硬件实例化何时获胜与仅绘制多次的性能图表中的“拐点”已经发生了变化。在硬件实例化的早期,那些第一代卡几乎从来没有赢过。随着 GPU 的发展并提供更多硬件支持以使其更快,它得到了显着改进。

对于 DirectX 12 class 硬件(最低 Direct3d 硬件功能级别 11.0),您可以依靠实例化来绘制相同的对象数千次。如果你说的是几十次,那么这将取决于许多你只能通过 运行 性能试验才能解释的因素。

Specifically for 'point-sprites' i.e. particles systems for special effects, there are a number of different approaches. For Xbox One class GPU hardware, just drawing a bunch for vertices is very fast and vertex hardware instancing only wins over it for huge numbers of particles (although it will use less VRAM so that may be a consideration). For "DirectX 12 Ultimate" class GPU hardware, a Mesh Shader is actually the fastest way to draw particle systems. See the PointSprites sample on GitHub.