Optimizing for integrated graphics cards 为集成显卡优化

优质
小牛编辑
131浏览
2023-12-01
Desktop

Polygon count matters 多边形数量问题

On most graphics cards today, polygon count does not really matter. The common knowledge is that object count and fillrate is much more important. Unfortunately, not so on the majority of older integrated chips (Intel 945 / GMA 950 and similar). How much it matters depends on the complexity of the vertex shaders or lighting and the speed of the CPU (thats right, most integrated cards transform & light vertices on the CPU).

今天,对大多数显卡的多边形数量并是不真正的问题。常识是物体数量和填充率是非常重要的。不幸的是,仍有很多老的集成芯片(Intel 945 / GMA 950等)。有多少问题,取决于的顶点着色器或照明的复杂性和 CPU 的速度(大多数集成显卡变换和顶点光照运行在CPU上)。

Big Bang Brain Games never went above 25 thousand triangles in a scene using 1-2 per-vertex lights and no pixel lights (essentially a VertexLit rendering path). Quality Settings were used to speed up performance automatically when frame rate drops. So on higher end machines a higher quality setting was used which had pixel lights enabled.

Big Bang Brain Games游戏从来不在场景超过25万三角面,使用1-2 per-vertex灯并没有像素灯(基本上是VertexLit rendering path)。质量设置用来当帧速率下降时自动提升性能,更高端的机器,更高的质量设置,启用像素灯光。

What slows things down is drawing objects multiple times, using complex vertex shaders and lots of polygons. This means:

被绘制的物体多次减慢了下来,使用复杂的顶点着色器和许多多边形,这意味着:

  • Use VertexLit rendering path if possible. This will draw each object just once, no matter how many lights are in the scene.
    如果可能的话使用VertexLit rendering path,这将绘制每个对象只有一次,无论多少灯在场景。
  • Try not to use lights at all, even vertex lights. Lights make sense if your geometry moves, or if your lights move. Otherwise bake the illumination using Lightmapper, it will run faster and look better.
    尽量不使用所有的灯光,即使是顶点灯光。如果物体移动或灯光移动,灯光是否有意义。否则,使用Lightmapper烘焙照明,这将运行非常快,看起来很好。
  • Optimize your geometry (see section below).
    优化几何物体(见下部分)。
  • Use Rendering Statistics window and Profiler!
    使用Rendering Statistics窗口和Profiler

Optimize model geometry 优化模型几何体

When optimizing the geometry of a model, there are two basic rules:

优化模型几何体,有两个基本规则:

  • Don't use excessive amount of faces if you don't have to.
    如果不是必须,不使用过多的面。
  • Keep the number of UV mapping seams and hard edges as low as possible.
    保持UV贴图接缝和硬边尽可能的少。

Note that the actual number of vertices that graphics hardware has to process is usually not the same as displayed in a 3D application. Modeling applications usually display the geometric vertex count, i.e. number of points that make up a model.

注意,图形硬件处理在的实际的顶点数,3D程序中显示的通常是不一样的。建模程序通常显示几何顶点数,即,构成模型的顶点数。

For a graphics card however, some vertices have to be split into separate ones. If a vertex has multiple normals (it's on a "hard edge"), or has multiple UV coordinates, or multiple vertex colors, it has to be split. So the vertex count you see in Unity is almost always different from the one displayed in 3D application.

不过对于图形卡,一些顶点分割成单独的。如果一个顶点有多个法线(在硬边上),或有多个UV坐标,或多个顶点颜色,会被分割。因此在Unity看到的顶点数几乎总是和在3D应用程序中是不同的。

Bake lighting 烘焙灯光

Bake ligthing either into lightmaps or vertex colors. Unity has a great Lightmapper built-in; also you can bake lightmaps in many 3D modeling packages.

烘烤灯光到光照贴图或顶点颜色。Unity内置强大的Lightmapper;也可以在许多3D建模程序中烘焙。

The process of generating a lightmapped environment takes only a little longer than just placing a light in the scene in Unity, but:

生成烘焙环境的过程比在场景放置灯光花费更长的时间,但是:

  • It usually will run a lot faster; especially if you have many lights.
    这通常运行快的多,尤其是有很多灯光的时候。
  • And look a lot better since you can bake global illumination.
    因为烘焙的全局照明,看起来要好了很多。

Even next-gen games still rely on lightmapping a lot. Usually they use lightmapped environments and only use one or two realtime dynamic lights.

即使是下一代游戏,仍然很多依赖烘焙。通常,使用它们烘焙的环境,并且在场景只使用一个或两个实时动态光源。

最近页面更新:2010-09-24