2014-09-01 21:21:20|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:游戏, 虚拟现实, Unity3D|来源:唯设编程网

Unity Manual > Advanced > Optimizing Graphics Performance


Making your game run smoothly is of prime importance to its success. Thankfully Unity is there for you! We have spent a lot of time and energy making it run fast on a wide variety of hardware. Below are some simple guidelines to maximizing the speed of your game.


In summary - combine, combine, combine   总的来说-组合,组合,组合

  • If you care about performance, combine meshes.  如果你关心性能,结合网格。
  • If you care about performance, make sure all your combined meshes also share the same material and texture. 如果你关心性能,请确保你所有的组合网格也有同样的材料和纹理。
  • Profiler and Rendering Statistics window are very helpful!
  • 分析器和渲染统计窗口是非常有帮助!

In detail: 详细

Modern graphics cards are really good at pushing a lot of polygons, but they have quite a bit of overhead for every batch that you submit to the graphics card. So if you have a 100-triangle object it is going to be just as expensive to render as a 1500-triangle object. The sweet spot for optimal rendering performance is somewhere around 1500-4000 triangles per mesh.


You only pay a rendering cost for objects that have a Mesh Renderer attached. And you only pay for those that are within the view frustum. There is no rendering cost from having a lot of empty GameObjects in your scene.


  • The best way to improve rendering performance is to combine objects together so each mesh has around 1500 or more triangles and uses only one Material for the entire mesh.
  • 最好的办法提高渲染性能是结合在一起的对象,因此每个网格拥有大约1500或更多的三角形,并使用只有一个材质为整个网格。

It is important to understand that just combining two objects which don't share a material does not give you any performance increase at all. If you want to combine effectively, you need to make sure your mesh uses only one material after you have combined it.


There is one thing to be aware of when combining objects though: if you use a lot of small lights in your scene, it might make sense to combine only objects that are close to each other.


The rendering cost for a mesh that has multiple materials is the same as having multiple renderers for each material. The most common reason why you have multiple materials is because two meshes don't share the same textures. So, if you want to optimize rendering performance, you need to make sure that the objects you combine share textures.


  • Unity is very good at pushing lots of polygons. Unity uploads all geometry to the graphics card for good cache utilization and optimal data alignment.
  • Unity是非常善于推动大量的多边形。Unity上传到所有的几何给适合缓存的显卡应用和和优化数据。
  • You simply have to make sure that the graphics card doesn't have to handle large numbers of batches.
  • 你只需确保显卡不要处理大量的批次。
  • The number of Pixel Lights affecting an object heavily affects performance.
  • 光源的像素数量严重影响对象性能。

If you want to have the best performance and don't care about Bumpmapping or Pixel Lighting, go to Edit->Render Settings... and set Pixel Light Count to zero. This will simply use vertex lighting for all objects. This means all geometry will be rendered only once per frame. This is an extremely useful LOD setting, so your game can run fine on older graphics cards.

如果您想拥有最好的性能而不关心凸起块映射或像素光源,进入Edit->Render Settings...并设置像素光源为零。这将对所有对象简单的使用顶点光源。这意味着所有几何将每帧渲染仅一次。这是一个非常有用的LOD设置,使你的游戏可以良好的运行在老的显卡上。

发表评论0条 】