GPU instancing unity官方文档翻译

来源:互联网 发布:mac删除virtualbox 编辑:程序博客网 时间:2024/05/24 06:49

自己的翻译,术语不太会,想喷就喷哟,学到东西就好。

Introduction

介绍


使用很少数量的dc(draw calls)一次性的绘制由相同mesh的物体的多份实例。主要用在以下一些情况,比如,建筑群的渲染,树木,草地等那些在场景中重复出现的物体。

(概括:减少dc,批处理)

GPU instancing只能渲染只有一个drawcall的相同mesh的物体。但是,每一个instance可以有不同的参数(例如color和scale)去增加变化,减少物体的重复感

Adding instancing to your Materials

让你的材质使用GPUInstancing


如何开启?!直接见下图,官网的意思也是这个。


注意:unity只有支持cpuinstancing才会显示这个选项,哪些是unity支持的呢:Standard,StandardSpecular,和所有的SurfaceShaders


下图显示开启了之后的FPS,Batches,SavedByBatching


下图是没有开启的,可以和上图做比较,一个字牛B

如果你要使用GPUInstancing,遵守一下几点:

1.unity自动的获取MeshRenderer并调用Graphics.DrawMesh指令去绘制。注意:不支持SkinnedMeshRenderer

2.unity只支持相同mesh使用相同Material的物体去使用,并且这个Material的shader只能有一个dc。

GPU Instancing is available on the following platforms and APIs:

  • DirectX 11 and DirectX 12 on Windows

  • OpenGL Core 4.1+/ES3.0+ on Windows, macOS, Linux, iOS and Android

  • Metal on macOS and iOS

  • Vulkan on Windows and Android

  • PlayStation 4 and Xbox One

  • WebGL (requires WebGL 2.0 API)

让你的shader飞起来

还是参考官网吧。。。只能看懂翻译不出来了。。

https://docs.unity3d.com/Manual/GPUInstancing.html









原创粉丝点击