As developers, we’re always aware of performance, both in terms of CPU and GPU. Maintaining good performance gets more challenging as scenes get larger and more complex, especially as we add more and more characters. Me and my colleague in Shanghai come across this problem often when helping customers, so we decided to dedicate a few weeks to a project aimed to improve performance when instancing characters. We call the resulting technique Animation Instancing.
作为开发人员,我们始终了解CPU和GPU的性能。 随着场景变得越来越大,越来越复杂,保持良好的性能变得越来越具有挑战性,尤其是当我们添加越来越多的角色时。 我和我在上海的同事在帮助客户时经常会遇到这个问题,因此我们决定花几个星期的时间致力于提高实例化字符的性能。 我们称这种技术为动画实例化。
We often implement outdoors scenes with GPU Instancing, such as grasses and trees. But for SkinnedMeshRenderer (for example characters), we can’t use instancing, because the skinning is calculated on the CPU, and submitted to the GPU one by one. In general, we can’t draw all characters through one submission. When there are lots of SkinnedMeshRenderers in the scene, this results in lots of draw calls and animation calculations.
我们经常使用 GPU Instancing 实现户外场景 ,例如草木。 但是对于 SkinnedMeshRenderer (例如字符),我们不能使用实例化, 因为皮肤是在CPU上计算的,并一一提交给GPU。 通常,我们无法一次提交所有字符。 当场景中有很多SkinnedMeshRenderers时,这将导致大量绘制调用和动画计算。
We have found a way to reduce CPU cost and supplement GPU Instancing in Unity with Animation Instancing. You can get our code on GitHub. Be aware that this is custom experimental solution, we’ve only shared it with a few of our enterprise support customers until recently. Now we’re ready for more feedback – please let us know what you think directly in the project comments!
我们找到了一种方法来降低CPU成本,并通过动画实例化补充Unity中的GPU实例化。 您可以 在GitHub上获取我们的代码 。 请注意,这是定制的实验性解决方案,直到最近我们才与一些企业支持客户共享它。 现在,我们已经准备好 征求 更多反馈– 请