Unity优化之Model(记录1)

 

Modeling characters for optimal performance

Using these techniques might help increase the animation and rendering speed of your characters, but be aware that they might also reduce the visual fidelity and realistic effects you are trying to achieve. There is no single answer for every situation that can produce a perfect balance between better performance and visual realism. You have to find the perfect balance according to the complexity of your characters and your scene
, vs. the overall appearance and realism that you require.

Use a single skinned Mesh Renderer

Use only a single skinned Mesh Renderer for each character. Unity optimizes animation using visibility culling and bounding volume
updates, and only activates these optimizations if you use one Animation component and one skinned Mesh
 Renderer in conjunction. Using two skinned Meshes in place of a single Mesh could roughly double rendering time for a Model, and there is seldom any practical advantage in using multiple Meshes.

Use as few Materials as possible

Keep the number of Materials
 on each Mesh as low as possible. Only have more than one Material on a character when you need to use different Shaders for different parts, such as a special Shader
 for the eyes. However, two or three Materials per character should be sufficient in almost all cases.

Use as few bones as possible

In general, the fewer bones you use, the better the performance is. However, sometimes you need to create characters with a large number of bones: for example, when you want a lot of customizable attachments. These extra bones increase the size of the build, and may have a relative processing cost for each additional bone. For example, 15 additional bones on a rig that already has 30 bones takes Unity 50% more operations to solve in Generic mode, which might impact the time it takes to solve.

Note that you can have additional bones for Generic and Humanoid types. When you have no animations playing using the additional bones, the processing cost should be negligible. This cost is even lower if their attachments are non-existent or hidden.

For performance reasons, use linear blend skinning
 with a maximum of four influences per vertex. However, some 3D modeling applications allow more than four bones to influence vertices, so you have to weigh the performance cost against greater control. For more information, see Importing skinned Meshes.

Minimize the polygon count

The number of polygons you should use depends on the visual quality you require and the platform you are targeting. These two competing facts are equally true:

  • The fewer the polygons you use in your Meshes, the faster your application runs. This is because every vertex, edge, or face requires computing resources.
  • The more polygons you use in your Meshes, the more detailed and organic your GameObjects
     look, because smaller polygons give you more control over the shape.

Also consider what else is competing for rendering resources. If you have a lot of GameObjects or Terrain
 objects on screen at the same time, consider reducing the polygon count per Mesh.

Desktop platforms can generally handle more complexity than mobile platforms, but performance on mobile platforms can vary enormously depending on the quality and capacity of the device itself.

Keep forward and inverse kinematics separate

When Unity imports animations, it bakes a Model’s inverse kinematic (IK) nodes into forward kinematics
 (FK), and so Unity doesn’t need the IK nodes at all. However, if they are left in the Model, then Unity still includes them in calculations, even though they don’t affect the animation. You can either delete the redundant IK nodes in Unity or in your 3D modeling application. To facilitate removing the IK nodes, keep separate IK and FK hierarchies while modeling.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值