Hardware instancing:
This is a method supplied by Direct3D which allows you to draw multiple instances of a mesh in a single draw call. This is what the OP was asking about, and what Aras said would be difficult or impossible to implement in a generic way.
FBX Instancing:
This is a method that the FBX format allows you to use for models that contain multiple instances of the same mesh. It reduces the size of the FBX, but does not inherently improve rendering performance. As far as I know, Unity does not support FBX instancing. Each instance will be imported as a unique mesh. I'm not sure whether Unity's mesh asset format could easily be modified to support instancing, but it's something to ask about either way.
Unity's mesh instancing:
If you have two MeshFilters (or MeshColliders, or MeshParticleEmitters) pointing to the same Mesh asset, Unity will not duplicate that asset other than storing it both in video memory and main memory, as necessary. This is the standard behaviour for Unity, and (as I understand it) works automatically as long as you don't apply different non-uniform scales to your MeshRenderers. If you do this, then multiple copies are kept in memory due to the way Unity handles mesh scaling. I could be wrong, and it might just be that different scales create different VBOs, whether they are uniform or not.
Unity Instancing类别
最新推荐文章于 2024-05-06 17:16:38 发布