图形性能优化:角色建模

翻译,E文链接。

Below are some tips for designing character models to give optimal rendering speed.

下面是一些设计角色模型的小提示,可以优化渲染速度。

Use a Single Skinned Mesh Renderer 使用单个蒙皮网格渲染器

You should use only a singleskinned mesh rendererfor each character. Unity optimizes animation using visibility culling and bounding volume updates and these optimizations are only activated if you use oneanimation componentand one skinned mesh renderer in conjunction. The rendering time for a model could roughly double as a result of using two skinned meshes in place of a single mesh and there is seldom any practical advantage in using multiple meshes.

对于每个角色你应该只使用一个蒙皮网格渲染器。Unity使用可视裁剪和更新包围体来优化动画,并且只有组合使用一个动画组件和一个蒙皮网格渲染器才激活优化。对于一个模型,使用两个蒙皮网格比使用一个的渲染时间会大约增加一倍,并且很少有实际上的好处。

Use as Few Materials as Possible 使用尽可能少的材质

You should also keep the number ofmaterialson each mesh as low as possible. The only reason why you might want to have more than one material on a character is that you need to use different shaders for different parts (eg, a special shader for the eyes). However, two or three materials per character should be sufficient in almost all cases.

在每个网格中,你应该尽可能使用最少的材质。在一个角色上使用多于一个材质的唯一原因,可能是对于不同部位你想使用不能的着色器(比如,对眼睛使用一个特殊的着色器)。然而,在差不多所有情况下,对一个角色使用2-3种材质应该是足够的。

Use as Few Bones as Possible使用尽可能少的骨骼

A bone hierarchy in a typical desktop game uses somewhere between fifteen and sixty bones. The fewer bones you use, the better the performance will be. You can achieve very good quality on desktop platforms and fairly good quality on mobile platforms with about thirty bones. Ideally, keep the number below thirty for mobile devices and don’t go too far above thirty for desktop games.

在典型的PC游戏中,一个骨架(也就是一个角色)大约使用15-60个骨骼。用的骨骼越少,性能越好。使用大约30个骨骼,你可以在PC平台获得很好的效果,在移动平台也可以获得相当不错的效果。理想情况下,在移动设备上保持30个以下的骨骼数量,在PC游戏中不能超过30个太多。

Polygon Count 多边形数量

The number of polygons you should use depends on the quality you require and the platform you are targeting. For mobile devices, somewhere between 300 and 1500 polygons per mesh will give good results, whereas for desktop platforms the ideal range is about 1500 to 4000. You may need to reduce the polygon count per mesh if the game can have lots of characters onscreen at any given time. As an example, Half Life 2 used 2500–5000 triangles per character. Current AAA games running on the PS3 or Xbox 360 usually have characters with 5000–7000 triangles.

你应该使用的多边形数量依赖于你想要的表现效果和目标平台。对于移动设备,一个网格使用300-1500个多边形可以获得好的效果,然而对于PC平台,理想的数量是1500-4000个。如果你的游戏需要在屏幕上同时显示很多角色,,那么你需要减少每个网格的多边形数量。比如,《半条命2》每个角色使用2500-5000个三角形。目前在PS3或Xbox 360上的3A游戏常常每个角色使用5000-7000个三角形。

Keep Forward and Inverse Kinematics Separate 将FK和IK分开

When animations are imported, a model’s inverse kinematic (IK) nodes are baked into forward kinematics (FK) and as a result, Unity doesn’t need the IK nodes at all. However, if they are left in the model then they will have a CPU overhead even though they don’t affect the animation. You can delete the redundant IK nodes in Unity or in the modeling tool, according to your preference. Ideally, you should keep separate IK and FK hierarchies during modeling to make it easier to remove the IK nodes when necessary.

导入一个动画的时候,模型的IK(反向运动学)节点会被烘培成FK(正向运动学)节点,因此,Unity不需要IK节点。然而,如果模型中存在IK节点,虽然它们并不影响动画,但是会消耗CPU。可以根据你的喜好,在Unity或建模工具中删除多余的IK节点。理想的,你应该在建模的时候保持IK和FK结构独立,这样在需要的情况下,你可以删除所有IK节点。

你并不一定会从此拥有更美好的人生,

图形性能优化:角色建模

相关文章:

你感兴趣的文章:

标签云: