Unity3D高级手册0600:优化图形性能

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

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

Unity Manual > Advanced > Optimizing Graphics Performance

Unity手册->高级->优化图形性能

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.

使你的游戏顺利运行是最重要的成功。值得庆幸的Unity为你准备了!我们花了很多时间和精力使它在多种硬件快速运行。以下是最大限度地发挥你的游戏速度的一些简单的指导方针。

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.

现代显卡擅长推动很多的多边形,但他们仍有很多开销为每一批你提交的显卡。因此,如果你有一个100三角形对象它将是一样昂贵去作为1500三角形对象渲染。达到最佳的渲染性能是每网格1500-4000三角形。

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.

你只需为对象给予一个网格渲染器附加的一个渲染。你只需给予对那些视域范围内的。目前没有渲染的费用为许多空白GameObjects在你的场景里。

  • 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设置,使你的游戏可以良好的运行在老的显卡上。

<12>
发表评论0条 】
网友评论(共?条评论)..
Unity3D高级手册0600:优化图形性能