This page has been translated automatically.
UNIGINE 基础课程
1. 简介
2. 虚拟世界管理
3. 3D模型准备
4. 材质
5. 摄像机和光照系统
6. 实现应用程序逻辑
7. 制作过场动画与动画序列
8. 准备发布项目
9. 物理系统
11. 项目2:第一人称射击游戏
12. PROJECT3: Third-Person Cross-Country Arcade Racing Game
13. PROJECT4: VR Application With Simple Interaction

基础优化技巧

Once you have assessed the scene performance status, you already have some idea of what exactly you need to pay attention to in order to improve and speed up your application.一旦评估了场景性能状态,您就已经对需要重点关注哪些方面来提升和加速应用程序有了初步概念。

As a rule, one of the main ways to improve performance is to correctly select and apply optimization tools to the 3D scene geometry.通常,提升性能的主要方法之一是为3D场景几何体正确选择并应用优化工具。

Let's take a look at the main tools available in UNIGINE:让我们看看UNIGINE中提供的主要工具:

  • Levels of Detail (LODs) — the main way to optimize your project. The idea is to show a simplified model with less detail instead of a highly detailed model when the object is far away from the camera. To do this, you need to take a detailed model and create several versions of it for different distances, each with a reduced number of polygons.细节层次(LOD)优化项目的核心方法。其原理是当物体远离摄像机时,用简化版低精度模型替代高精度模型。为此,您需要基于原始高模创建多个版本,每个版本随距离增加逐步减少多边形数量。

    A model with LODs can be represented as a single Mesh object with a number of surfaces, each representing a certain LOD. LOD settings allow you to specify the distance for switching between surfaces.带LOD的模型可表示为包含多个表面的单一网格对象,每个表面对应特定LOD层级。LOD设置允许指定各层级间的切换距离。

    LODs can be configured automatically when importing the model into UNIGINE or manually via a 3D editor and UnigineEditor.LOD可在模型导入UNIGINE时自动配置,也可通过3D编辑器和UnigineEditor手动设置。

    10109 polygons
    LOD 0
    10109 个多边形
    LOD 0
    5004 polygons
    LOD 1
    5004 个多边形
    LOD 1
    2583 polygons
    LOD 2
    2583 个多边形
    LOD 2
  • Impostors — flat images used instead of real models at a far distance from the camera. This method allows rendering objects with preserving visual accuracy: each impostor has the same transformation and appearance of the original object, but its geometry has only 2 triangles. Typically, impostors are used in scenes with a large number of objects that need to be visible from a long distance.替身图用平面图像替代远处实模的方法。该技术能在保持视觉准确性的同时渲染物体:每个替身图具有与原物体相同的变换和外观,但其几何体仅含2个三角形。通常用于需要远距离显示大量物体的场景。

    UNIGINE has a handy tool for creating impostors — Impostors Creator. It is accessible via the UnigineEditor main menu (Tools -> Impostors Creator).UNIGINE提供便捷的替身图创建工具,Impostors Creator,可通过UnigineEditor主菜单访问(Tools -> Impostors Creator)。

    A real object (on the left) and its impostor (on the right) in the scene场景中真实物体(左)与其替身图(右)的对比
  • Switching on and off the nodes at a certain distance from the camera using World Switcher. With this tool, you can disable parts of the virtual scene that are far away from the user, thus improving performance.World Switcher(世界切换器)可在特定距离开关节点。该工具能禁用远离用户的部分虚拟场景,从而提升性能。
  • Occlusion Culling allows you to avoid rendering geometry occluded by other opaque geometry by cutting it off using special occluders (Occluder, Occluder Mesh) or using Hardware Occlusion Queries.Occlusion Culling(遮挡剔除)通过特殊遮挡物(Occluder, Occluder Mesh)或硬件遮挡查询(Hardware Occlusion Queries),避免渲染被不透明几何体遮挡的部分。
  • Managing a large number of identical objects using Mesh Cluster and Mesh Clutter allows you to simplify the node hierarchy by replacing many identical objects with one. Mesh Cluster allows you to arrange the meshes it stores around the scene as you see fit. Mesh Clutter scatters meshes randomly, and they cannot be edited individually. However, using Mesh Clutter is more efficient in terms of memory consumption.Mesh Cluster与Mesh Clutter通过将大量相同物体合并为单一节点来简化层级结构。Mesh Cluster可自由排布存储的网格,而Mesh Clutter会随机散布且不可单独编辑,但内存效率更高。

However, it's not just the geometry of a 3D scene that affects performance. Inefficient use of light sources, dynamic shadows and reflections, and other effects can significantly reduce the application speed. That's why UNIGINE has a bit masking mechanism that allows you to selectively apply certain effects or enable certain properties for individual objects. Bit masks are used in the following systems:然而,影响性能的不只是3D场景几何体。低效的光源、动态阴影与反射等效果也会显著降低运行速度。为此UNIGINE提供位掩码机制,可选择性应用特效或为特定对象启用属性。位掩码应用于以下系统:

  • Rendering into viewport视口渲染
  • Shadowing阴影
  • Reflections rendering反射渲染
  • Collisions碰撞检测
  • Intersections相交测试
  • Decals贴花
  • Fields力场
  • Sound sources音源
  • Physicals物理实体
  • Pathfinding (inside Navigation Areas)寻路(Navigation Area,导航区域,内)

Bit mask operating principle is as follows: an effect or property has a certain set of flags — bit masks — that define the scope of this effect or property. Cameras, Objects, Collision Shapes (used to detect collisions with physical objects) and other entities contain some of these bit masks depending on the type of entity and the possibility of applying a particular effect to it.位掩码运作原理如下:每个特效或属性拥有定义作用范围的标志位集合——即位掩码。摄像机、物体、碰撞形状(用于物理碰撞检测)等实体根据类型和可应用效果携带相应掩码。

Masks are compared bitwise using logical conjunction, that is, the first bit of one mask is compared to the first bit of the other mask and so on. Two bit masks are considered a match if they have at least 1 matching bit, regardless of the value of the other bits.掩码通过逻辑与进行逐位比对:两个掩码只要存在任一相同位即视为匹配(其他位值不影响判断)。

An effect is only applied to an object if their bit masks match.仅当对象与特效的位掩码匹配时,特效才会作用于该对象。

本页面上的信息适用于 UNIGINE 2.20 SDK.

最新更新: 2025-06-09
Build: ()