This page has been translated automatically.
Setting Up Materials
World Nodes
Sound Objects
Pathfinding Objects
UUSL (Unified UNIGINE Shader Language)
File Formats
Materials and Shaders
Rebuilding the Engine Tools
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Material Nodes Library
Art Samples


This article covers UNIGINE-specific terminology and concepts and is highly recommended for all new users.本文介绍了UNIGINE专有的术语和概念,强烈建议所有新用户使用。

Please consider hardware requirements.请考虑硬件要求

How Are Virtual Worlds Organized?虚拟世界是如何组织的?#


When you create an application in UNIGINE, it is represented by a project. A project is a "container" for the application's code, content, and meta-data.在UNIGINE中创建应用程序时,它由项目表示。 项目是应用程序的代码内容和元数据的“容器”。

A project can consist of one or several complex 3D scenes, which are called worlds.一个项目可以包含一个或几个复杂的3D场景,这些场景称为 worlds

All projects are managed via the UNIGINE SDK browser.所有项目都通过 UNIGINE SDK浏览器进行管理


A UNIGINE-based virtual world is a 3D scene that contains a set of different scene graph nodes (e.g. static meshes, lights, cameras, etc.) placed into specified positions, and global settings (rendering, physics, etc.) applied to the whole scene.基于UNIGINE的虚拟 世界 是3D场景,其中包含一组不同的场景图 节点 (例如静态网格物体,灯光,照相机等)放置到指定位置,并应用全局设置渲染物理等)整个场景。

A scene graph in UNIGINE is a multi-root tree (hierarchy) of nodes. UNIGINE中的场景图是节点的多根树(层次结构)。

Each world is represented by an XML file with the .world extension.每个世界都由一个扩展名为.world的XML文件表示。

When you create a new project via the SDK Browser, a new world is also created with the same name as your project.通过SDK浏览器创建新的项目时,还会创建一个与您的项目同名的新世界。

To edit your existing worlds and create new ones, use UnigineEditor. You can create and use as many worlds as you need.要编辑现有世界并创建新世界,请使用 UnigineEditor 。您可以根据需要创建和使用任意多个世界。

A world with nodes in it viewed in UnigineEditor在UnigineEditor中查看了带有节点的世界


In terms of UNIGINE, all objects added to the scene are called nodes. Nodes can be of different types, determining their visual representation and behavior.就UNIGINE而言,添加到场景中的所有对象都称为节点。节点可以是不同类型,可以确定其视觉表示和行为。

There is a rich set of built-in node types. Though the set covers almost all of required cases, it can be manually extended by the user.有一组丰富的内置节点类型。尽管该集合涵盖了几乎所有必需的情况,但用户可以手动对其进行扩展。

You can also extend basic functionality of any node by adding components to it.您还可以通过向其添加 components 来扩展任何节点的基本功能。

Every node has a transformation matrix, which encodes position, rotation, and scale of the node in the world.每个节点都有一个变换矩阵,该矩阵对世界上该节点的位置,旋转和比例进行编码。

There are node types that appear visually: Objects, Decals, and Effects. Other node types (Light Sources, Players, etc.) are invisible.有一些直观显示的节点类型:对象贴图效果。其他节点类型(光源播放器等)是不可见的。

Node parameters are regularly stored in the .world file, but also can be saved into a separate XML file with the .node extension (and later be referenced from the .world file via the special nodes called Node References, which is used for node instancing).节点参数通常存储在.world文件中,但也可以保存到扩展名为.node的单独XML文件中(以后可以通过称为.world file via the special nodes called Node References, which is used for node instancing)。


One of the most important node types is Object. Objects represent imitations of entities existing in the real world: objects (people, trees, cars, planes, etc.), sky, terrains, water, and so on. Objects have a single surface or a set of surfaces defining their visual appearance. They can have a shape to represent the volume they occupy in 3D space and a body to participate in physical interactions.最重要的节点类型之一是 Object 。对象代表对现实世界中存在的实体的模仿:对象(人,树,汽车,飞机等),天空,地形,水等。对象具有单个 surface 或一组定义其视觉外观的表面。它们可以具有 shape 来表示它们在3D空间中占据的体积,并且可以具有 body 来参与物理交互。


A mesh is a collection of polygons defining object's geometry. It has the following properties: 网格是定义对象几何形状的多边形的集合。它具有以下属性:

Animation in UNIGINE can be performed by skinned meshes (bone-based), morph targets (keyframe) or dynamic meshes (code-controlled). UNIGINE中的动画可以通过皮肤网格物体(基于骨骼),变形目标(关键帧)或动态网格物体(代码为

At run time, meshes are stored in proprietary UNIGINE formats with .mesh (static mesh + optional animation data) and .anim (external animation data) extensions.在运行时,网格以专有的UNIGINE 格式存储,扩展名为.mesh(静态网格+可选动画数据)和.anim(外部动画数据)。

When importing an FBX model to the Engine, it is automatically converted to the .mesh format. 将FBX模型导入到引擎时,它会自动转换为.mesh格式。

If you want parts of your object to have different materials (e.g. transparent / opaque, shiny metal / human skin), you should split your mesh into surfaces. However, if you want parts of your geometry to move separately (e.g. spinning wheels of a car), you would need several separate meshes.如果希望对象的各个部分具有不同的材质(例如,透明/不透明,有光泽的金属/人体皮肤),则应将网格划分为多个表面。但是,如果要使几何图形的各个部分分开运动(例如汽车的旋转车轮),则需要几个单独的网格。


A surface is a named non-overlapping subset of the object geometry (i.e. object mesh). Each surface can have its own material or property assigned. It is also possible to enable/disable surfaces independently from each other. 表面是对象几何体(即对象网格)的命名的不重叠子集。每个表面可以分配自己的材质属性。也可以彼此独立地启用/禁用表面。

Surfaces can be organized in a hierarchy within a mesh (it can be used for LOD switching).可以在网格中的层次结构中组织表面(可用于 LOD 切换)。

At the picture below, a soldier 3D mesh consists of 4 surfaces: eyes, skin, bags (body armor, radio set, bag), and body (overalls, shoes, hard hat, gloves).在下面的图片中,一个士兵3D网格由4个表面组成:眼睛,皮肤,包(防弹衣,收音机,包)和身体(工作服,鞋子,安全帽,手套)。


In terms of UNIGINE, a material is a rule defining how the surface will look like: its interaction with lights, reflection parameters, etc. It is based on:就UNIGINE而言, 材料 是一个规则,用于定义表面的外观:其与灯光,反射参数等的交互。它基于:

  • Vertex, fragment and geometry shaders that actually draw the material based on different conditions.顶点,片段和几何形状着色器,它们根据不同的条件实际绘制材质。
  • User-defined textures passed to shaders.用户定义的纹理传递给着色器。
  • States that specify conditions, based on which the appropriate shaders will be applied. 状态,用于指定条件,并根据这些条件应用适当的着色器。
  • Parameters defining how shaders will be used. 参数,用于定义如何使用着色器。

UNIGINE提供了一组丰富的 内置基础材料 。推荐的方法是从基础材料继承并调整新的用户材料。您还可以使用UUSL(Unified UNIGINE Shader Language)或HLSL / GLSL创建自定义着色器,但在后一种情况下,您需要自己随每个SDK版本一起迁移自定义着色器。

除了在某些表面上应用常规材料外,还有一种特殊类型的材料称为 后期材料 ,它们会应用到最终屏幕组成之上(例如夜间或热视觉效果)。您还可以使用自定义后期材质和自定义着色器创建自己的后效果。

Material Hierarchy物质层次#

Materials are organized in hierarchy with parameters inheritance and overloading (much like in object-oriented programming). When a material is inherited, all its parameters are inherited from the parent. If a parameter value is changed for the parent, it will be automatically changed for the child as well, unless it was overridden (set to a different value) for the child before that.材料在层次结构中进行组织,并带有参数继承和重载(类似于面向对象的编程)。 继承材料时,其所有参数均从父级继承。 如果为父项更改了参数值,则该参数值也会为子项自动更改,除非在此之前为子项覆盖(设置为其他值)。

Example: a material A has two parameters (color: blue and specular power of 1.4), a material B is inherited from the material A and has color parameter overridden (red). If we change specular power to 2.0 in the material A, then the material B will have the following parameters: red color (overridden) and 2.0 value of specular power (inherited).示例:材料A具有两个参数(颜色:蓝色和1.4的镜面反射力),材料B继承自材料A,并且颜色参数被覆盖(红色)。如果我们将材质A中的镜面反射功率更改为2.0,则材质B将具有以下参数:红色(覆盖)和2.0的镜面反射功率值(继承)。

By using parameter inheritance it is very convenient to mass control values of multiple materials parameters.通过参数继承,可以非常方便地控制多个材料参数的值。


A property is a "material" for application logic. It specifies the way the object will behave and interact with other objects and the scene environment. Properties can have parameters of various types — from a simple integer representing your character's hit points, to node, material, file (for textures, meshes, sounds, etc.), or property, which simplifies access to various resources. 属性 是应用程序逻辑的“材料”。它指定对象的行为方式以及与其他对象和场景环境交互的方式。属性可以具有各种类型的参数-从代表角色命中点的简单 integer 节点,材质,文件(用于纹理,网格,声音等),或属性,可简化对各种资源的访问。

Properties can be used to build components to extend the functionality of nodes.属性可用于构建 组件 以扩展节点的功能。

Properties, like materials, are organized in a hierarchy with parameter inheritance. But, unlike materials, they can be applied either per-surface or per-node. 属性(如材料)在具有参数继承的层次结构中进行组织。但是,与材料不同,它们可以每个表面每个节点应用。

How to Add Content to the Virtual World?如何向虚拟世界添加内容?#

Every piece of content, that can be used in your world or project, is an asset. An asset may come from a file created using a third-party application, such as a 3D model, an audio file, an image, or any other type supported by the UNIGINE Engine.可以在您的世界或项目中使用的所有内容都是资产。资产可能来自使用第三方应用程序创建的文件,例如3D模型,音频文件,图像或UNIGINE Engine支持的任何其他类型。

The main front-end tool of the Asset System is the Asset Browser in UnigineEditor. It is used to organize content in your project: create, import, view, rename your assets, move them between the folders and manage their hierarchy.资产系统的主要前端工具是 UnigineEditor Asset Browser中的 。它用于组织项目中的内容:创建,导入,查看,重命名资产,在文件夹之间移动资产和管理其层次结构。

Each time an asset is created or imported, UnigineEditor does all necessary job, including conversion of your assets (be it a JPG texture or and FBX model) to its native format (such as compressed .dds textures, .mesh geometry, .anim animations, etc.) to be used by the Engine at run time. Such files, generated as a result of conversion, are called "run-time files", and they are updated by UnigineEditor each time you modify the corresponding asset.每次创建或导入资产时, UnigineEditor 都会执行所有必要的工作,包括将资产(无论是JPG纹理还是FBX模型)转换为其资产引擎在运行时使用的本机格式(例如压缩的.dds纹理,.mesh几何图形,.anim动画等)。转换后生成的此类文件称为“ 运行时文件”,每次您修改相应资产时,UnigineEditor都会对它们进行更新。

It is recommended that you familiarize yourself with the Assets Workflow to learn all the details.建议您熟悉资产工作流程以了解所有详细信息。


UnigineEditor allows you to assemble a virtual world: import and set nodes, assign materials and properties to them, setup lighting, adjust global settings (physics, rendering, etc.) and more. It features What You See Is What You Get approach: you can instantly see the scene with final quality (as at run time). UnigineEditor 允许您组装虚拟世界:导入和设置节点,为其分配材质和属性,设置照明,调整全局设置(物理,渲染等)等等。它具有所见即所得方法:您可以立即以最终质量(在运行时)看到场景。

Watch the tutorial below to learn how to import 3D models to UNIGINE:观看以下教程,了解如何将3D模型导入UNIGINE:

How Do We See the Virtual World?我们如何看待虚拟世界?#

For visual representation, UNIGINE uses a standard perspective projection. The orthogonal projection is also available.对于视觉表示,UNIGINE使用标准的透视投影。也可以使用正交投影。

Perspective projection透视投影

In UNIGINE, the way how the world is seen is based on the 3 entities:在UNIGINE中,查看世界的方式基于以下三个实体:

  • A camera is a structure containing 2 matrices: view and projection. Through this structure, you set the camera parameters: field of view, masks, near and far clipping planes, and post materials. Then, the camera is passed to a Viewport that will render an image from this camera. The camera is assigned to a Player, that will further control its position. A 相机 是一个包含2个矩阵的结构:视图和投影。通过这种结构,您可以设置摄影机参数:视野,蒙版,近距和远距剪切平面以及张贴材料。然后,将摄影机传递到视口,该视口将从此摄影机渲染图像。摄像机被分配给 Player ,它将进一步控制其位置。
  • A viewport receives a camera and renders an image from it on the screen. In addition, it provides all functions of the main renderer, for example, cube maps rendering, stereo rendering, panoramic rendering and so on. A 视口 接收摄像头,并在屏幕上从中渲染图像。此外,它提供了主渲染器的所有功能,例如,立方体贴图渲染,立体渲染,全景渲染等。
  • A player is a node controlled via the input devices (keyboard, mouse, joystick). It has a camera assigned. Once a player has changed its position, its internal camera's view matrix will be changed as well.

    UNIGINE features several types of players: Player Dummy, Player Actor, Player Persecutor and Player Spectator.UNIGINE features several types of players: Player Dummy, Player Actor, Player Persecutor and Player Spectator.

    UNIGINE features several types of players: Player Dummy, Player Actor, Player Persecutor and Player Spectator.
    A player 是一个通过输入设备(键盘,鼠标,操纵杆)控制的节点。它分配了一个相机。玩家更改位置后,其内部摄像机的视图矩阵也将更改。

    UNIGINE features several types of players: Player Dummy, Player Actor, Player Persecutor and Player Spectator. UNIGINE具有多种类型的播放器:Player DummyPlayer ActorPlayer PersecutorPlayer Spectator

The terms discussed above refer only to the API. The Camera panel in UnigineEditor manages cameras, which in terms of API would be called players.上面讨论的术语仅指API。 UnigineEditor中的相机面板管理相机,根据API,这些相机将称为 players


Lighting in your worlds is created by placing Light Sources. These nodes contain parameters, which determine various light characteristics, such as brightness, color, etc. You can also use physically-based parameters, like color temperature and illuminance, to set up your lights.您的世界中的灯光是通过放置光源创建的。这些节点包含确定各种灯光特征(例如亮度,颜色等)的参数。您还可以使用基于物理的参数(例如色温和照度)来设置灯光。

There are different kinds of lights and they emit light in different ways. A light bulb, for example, emits light in all directions — in UNIGINE it is represented by the omni light. A projector or car headlights emit a cone of light in a certain direction — projected light. Light beams that come from the sun appear to be parallel, as their source is located so far away. To simulate this type of lighting in UNIGINE, the world light is used.有不同种类的灯,它们以不同的方式发光。例如,灯泡向各个方向发光-在UNIGINE中,它由 全方位照明 表示。投影仪或汽车前灯在特定方向上发出锥形光束- 投射光 。来自太阳的光束看起来是平行的,因为它们的光源太远了。为了在UNIGINE中模拟这种类型的照明,使用了 世界照明

To learn more about lighting in UNIGINE, see the Lighting Video Tutorial.要了解有关UNIGINE中照明的更多信息,请参见 Lighting Video Tutorial


UNIGINE has a combination of full deferred renderer with forward rendering techniques: UNIGINE结合了完整的延迟渲染器和正向渲染技术:

To learn more about the applied rendering techniques, see the Rendering Sequence article.要了解有关应用的渲染技术的更多信息,请参见 Rendering Sequence 文章。

In UnigineEditor all rendering settings (such as global illumination, shadows, environment, anti-aliasing, post-effects, etc.) can be adjusted via the Rendering Settings section and saved to a *.render file to be used later. Each new project contains settings for low, medium, high, and ultra quality presets as well as settings optimized for best performance in VR. You can now simply double-click on any of them in the Asset Browser to apply corresponding settings. UnigineEditor 中,可以通过 Rendering Settings 部分,并保存到*.render文件中以备后用。每个新项目都包含低,中,高质量预设的设置,以及为实现VR最佳性能而优化的设置。现在,您只需在资产浏览器中双击其中的任何一个即可应用相应的设置。

How Do We Hear Sounds?我们如何听到声音?#

Next to the visual component, sound is a very important domain of real-time technologies. It is the key resource for creating the proper feeling of immersion in the virtual world. For example, rolling echo cues us to anticipate a scene to take place in a lofty dome. Soft tapping of a stone hit by an incautious foot or a car whooshing by with lightning speed — all that can be modelled aurally. UNIGINE offers a multi-channel sound system with support for binaural HRTF-based sound, various 3D effects, sound occlusion and multiple reverberation zones. You can assign any MP3, WAV, or OGA sound to be played by contact of the objects simulating their physical properties on the level of sound. For the moving sources, like a car, the Doppler effect is applied so that the movement of the sound source relative to the listener is authentically imitated.在视觉组件旁边,声音是实时技术的一个非常重要的领域。它是在虚拟世界中营造适当沉浸感的关键资源。例如,回声的滚动提示我们可以预期在一个高耸的穹顶中发生的场景。轻敲不稳的脚砸石头或以闪电般的速度轻敲汽车-所有这些都可以在听觉上建模。 UNIGINE提供了一种多声道声音系统,该系统支持基于双耳HRTF的声音,各种3D效果,声音遮挡以及多个混响区域。您可以分配任何 MP3,WAV OGA 声音,以通过在声音级别上模拟它们的物理特性的对象的接触来播放。对于像汽车这样的移动声源,将应用 Doppler 效果,以便真实地模仿声源相对于听众的移动。

All sound settings can be adjusted via the Sound Settings section in UnigineEditor. You can also save your presets to *.sound files to be used later.所有声音设置均可通过Sound Settings section in UnigineEditor. You can also save your presets to *.sound文件中,以备后用。

How Is Physical Behavior Defined?身体行为如何定义?#

UNIGINE features a built-in simplified game-like Newton physics. The use cases for physics properties (where physics is more preferable than hard-coding objects animation) are the following: UNIGINE具有类似于牛顿 physics 的内置简化游戏。物理属性的用例(物理比硬编码对象动画更可取)如下:

  • Collision detection (preventing moving through walls) 碰撞检测(防止穿过墙壁)
  • Simulating perfectly elastic collisions (redistribution of kinetic energy)模拟完全弹性的碰撞(动能的分布)
  • Simulation of simple mechanisms by rigid bodies and destructible joints由刚性实体和可破坏的关节模拟简单机制
  • Simulation of basic physical phenomena: gravity, friction, buoyancy对基本物理现象的模拟:重力,摩擦,浮力
  • Procedural destruction of meshes网格的程序破坏
  • Simulation of cloth and ropes movement 衣服绳索运动的模拟
It is important to understand that the built-in physics module is very generic and works within the specific range of parameters: for precise simulation of mission-critical tasks (i.e. flight dynamics) it is highly recommended to use specialized solutions. As in any game-like physics, you should not use real masses and extremely high velocity values. 重要的是要了解内置物理模块非常通用并且可以在特定的参数范围内工作:对于关键任务的精确模拟(即飞行动力学),强烈建议使用专门的解决方案。 在任何类似于游戏的物理学中,您不应使用真实质量和极高的速度值

Physics is simulated with its own update FPS and is in effect within the physics simulation distance. Physical properties can be applied to the objects only.物理是使用自己的更新FPS 进行仿真的,并且在物理仿真距离内有效。物理属性只能应用于对象


To assign some physical properties to an object, so that it could participate in interactions between objects or external physical forces, it should have a body. There are several types of bodies: Rigid, Rag Doll, Fracture, Rope, Cloth, Water, Path.要为对象分配一些物理属性,使其可以参与对象之间的相互作用或外部物理力,它应具有 body 。主体有几种类型:Rigid, Rag Doll, Fracture, Rope, Cloth, Water, Path

Almost like in the real world, virtual physics of the body follows the concepts of velocity, force, mass, density and so on.几乎像在现实世界中一样,人体的虚拟物理学遵循速度,力,质量,密度等的概念


While a body simulates various types of physical behavior, a shape represents the volume (sphere, capsule, cylinder, box, convex hull) that a rigid body occupies in space. A physically simulated object usually has a single body and one or several shapes which allow objects to collide with each other.虽然 body 模拟各种类型的物理行为,但形状表示刚性的体积(球体,胶囊,圆柱体,盒子,凸包)身体占据了空间。物理模拟的对象通常具有单个主体和一个或多个形状,这些形状允许对象彼此碰撞

Collision Detection碰撞检测#

A collision detection algorithm detects contact points between shapes and prevents them from penetrating each other. Contact points and normals are accessible via API.一种 碰撞检测 算法可检测形状之间的接触点,并防止它们相互穿透。接触点和法线可以通过API访问。


Joints are used to connect several objects with respect to the mass balance and represent constraints removing certain degrees of freedom. There are different types of joints: Fixed, Hinge, Ball, Prismatic, Cylindrical, Wheel. 接头 用于相对于质量平衡连接多个对象,并表示消除某些自由度的约束。关节有多种类型:Fixed, Hinge, Ball, Prismatic, Cylindrical, Wheel

Global Physics Settings全局物理设置#

There are global physics settings (gravity, penetration factor, etc.) affecting all physical objects present in the world.全局物理设置(重力,穿透因子等)会影响世界上存在的所有物理对象。

How to Control the Virtual World?如何控制虚拟世界?#

Programming Languages编程语言#

To implement your project's logic in UNIGINE, you can use the following programming languages:要在UNIGINE中实现项目的逻辑,可以使用以下编程语言:

  • C# for a good balance between speed and ease of use. It allows using C# Component System enabled by default and integrated into the UnigineEditor. It is the easiest way to implement your application logic in components and assign them to any node to be executed. C#在速度和易用性之间取得良好的平衡。这是在组件中实现应用程序逻辑并将它们分配给要执行的任何节点的最简单方法。
  • C++ for maximum performance and seamless integration with the existing code base. C ++ ,以实现最佳性能并与现有代码库无缝集成。
  • UnigineScript, fast iterative scripting language featuring instant compilation and thousands of useful functions. UnigineScript ,一种​​快速迭代的脚本语言,具有即时编译和数千个有用的功能。
All *.usc and *.h files inside of the data folder are scripts in UnigineScript language (they do not require compilation).数据文件夹中的所有*.usc*.h文件都是UnigineScript语言的脚本(它们不需要编译)。

All the APIs are unified: every class, method, and constant are accessible via any API. However, there are minor language-specific differences.所有 API都是统一的:每个类,方法和常量都可以通过任何API访问。但是,特定于语言的差异很小。

To learn more, see the following usage examples articles:要了解更多信息,请参见以下用法示例文章:

Mixing Languages混合语言#

You can stick to a single language: C++ if maximum performance is a key factor, or C# for optimum balance. In case of C# (.NET 5), UNIGINE provides the C# Component System integrated into UnigineEditor. This approach is deemed to be the most convenient and ensuring good performance for complex applications with elaborate logic.您可以只使用一种语言:如果要确保最高性能是关键因素,请使用C ++;对于最佳平衡,请使用C#。如果为C# (.NET 5),UNIGINE将提供集成到UnigineEditor中的 C#组件系统。对于具有复杂逻辑的复杂应用程序,此方法被认为是最方便并确保良好性能。

Alternatively, you can have different programming languages (C++, C#, and UnigineScript) for different pieces of your project: for example, you can use C++ for base classes and performance consuming operations; and implement some simple application logic in UnigineScript. You can also call methods from one API when using another, and manually expand API functionality.或者,对于项目的不同部分,您可以使用不同的编程语言(C ++,C#和UnigineScript):例如,您可以将C ++用于基类和性能消耗较高的操作。并在UnigineScript中实现一些简单的应用程序逻辑。您还可以在使用其他API时从一个API调用方法,并手动扩展API功能。

Run-Time Logic运行时逻辑#

Every UNIGINE-based application has its life cycle, that consists of certain stages, some of them are performed once, others are repeated each frame. In short, these stages are as follows:每个基于UNIGINE的应用程序都有其生命周期,它由某些阶段组成,其中某些阶段执行一次,其他阶段每帧重复一次。简而言之,这些阶段如下:

UNIGINE has three main logic components, Each of them has a set of functions (named init(), update(), postUpdate(), etc.) that contain actions to be performed at corresponding stages of the Engine's working cycle. These components are: UNIGINE具有三个主要逻辑组件,它们每个都有一组功能(名为 init() update() postUpdate()等),其中包含要在引擎工作周期的相应阶段执行的操作。这些组件是:

  • System Logic is the code that is run during the whole application life cycle (its scope exists even when switching between worlds). System Logic是在整个应用程序生命周期中运行的代码(即使在世界之间切换时,其范围也存在)。

    • For applications written using UnigineScript, the system logic is written to the system script file (unigine.usc).对于使用UnigineScript编写的应用程序,系统逻辑将写入系统脚本文件(unigine.usc)。
    • For applications that use C++ AppSystemLogic.cpp is created, and for C# applications — AppSystemLogic.cs. This file is stored in the source/ folder of your project. It has implemented methods to put your logic code inside.对于使用C ++的应用程序,将创建AppSystemLogic.cpp,对于C#应用程序,将创建AppSystemLogic.cs。该文件存储在项目的source/文件夹中。它具有已实现的方法将逻辑代码放入其中。
  • World Logic is the logic of the virtual world. The logic takes effect only when the world is loaded. World Logic虚拟世界的逻辑。该逻辑仅在加载世界后才生效。

    • For applications written using UnigineScript, the world logic is written to the world script file (*.usc named after your project) and is loaded and unloaded together with the corresponding world. 对于使用UnigineScript编写的应用程序,世界逻辑将写入 world脚本文件(以您的项目命名的*.usc),并与相应的世界一起加载和卸载。
    • For applications that use C++ AppWorldLogic.cpp is created, and for C# applications — AppWorldLogic.cs. This file is stored in the source/ folder of your project and stays loaded during the whole engine runtime. It has implemented methods to put your logic code inside. 对于使用C ++的应用程序,将创建AppWorldLogic.cpp,对于C#应用程序,将创建AppWorldLogic.cs。该文件存储在项目的source/文件夹中,并在整个引擎运行时保持加载状态。它具有已实现的方法将逻辑代码放入其中。
  • Editor Logic. This component is to be used in case you need to implement your own Editor. It has more implemented methods providing you with clear understanding of the current Engine events (a node has been created, a property has been deleted, a material has been changed, etc.). Editor Logic。如果您需要实现自己的编辑器,将使用此组件。 它有更多的实现方法,让您清楚地了解当前的引擎事件(节点已创建、属性已删除、材质已更改等)。

It is highly recommended that you familiarize yourself with the execution sequence to know the details, including the multi-threaded mode.强烈建议您熟悉执行顺序以了解详细信息,包括多线程模式。

Component System组件系统#

Component System enables you to implement your application's logic via a set of building blocks — components, and assign these blocks to nodes extending their basic functionality. You can add a component to a node via code or via UnigineEditor. 组件系统使您能够通过一组构件-组件来实现应用程序的逻辑,并将这些块分配给节点基本功能。您可以通过代码或UnigineEditor将组件添加到节点。

Each component's logic is implemented inside the following functions: init(), update(), postUpdate(), etc. Just like for the main logic components, these functions are executed at corresponding stages of the Engine's working cycle.每个组件的逻辑在以下功能内实现:init(), update(), postUpdate()等。与主要逻辑组件一样,这些功能在引擎工作周期的相应阶段执行>。

The logic of a certain component is active only when the corresponding node and property are enabled. Thus, you can enable/disable logic of each particular component at run time, when necessary.仅当相应的节点和属性启用时,某个组件的逻辑才有效。因此,您可以在运行时在必要时启用/禁用每个特定组件的逻辑。

You can assign several properties corresponding to different components to a single node. The order in which the logic of components is executed can be changed at run time to fit your needs, giving you an exceptional flexibility and freedom to implement any functionality you have in mind.您可以将与不同组件相对应的几个属性分配给单个节点。可以在运行时更改组件逻辑的执行顺序以适应您的需求,从而为您提供了出色的灵活性和自由度,以实现您所想到的任何功能。

In UNIGINE, there are two implementations of the Component System: 在UNIGINE中,组件系统有两种实现:

  • C# Component System available for C# projects. In this case, a logic component integrates a node and a C# class, containing logic implementation (actions to be performed), defining a set of additional parameters to be used. C#组件系统可用于C#项目。在这种情况下,逻辑组件将节点和C#类集成在一起,其中包含逻辑实现(要执行的动作),并定义了一组要使用的附加参数。
  • C++ Component System available for C++ projects. In this case, a logic component integrates a node, a C++ class, containing logic implementation (actions to be performed), and a property, defining a set of additional parameters to be used. C ++组件系统可用于C ++项目。在这种情况下,逻辑组件将集成一个节点,一个C ++类(包含逻辑实现(要执行的操作))和一个属性(定义一组要使用的其他参数)。

Intersection Detection交叉口检测#

UNIGINE features a fast intersection detection algorithm. It can be used for ray-casting, calculating line of sight (LOS) or height above terrain (HOT), etc. UNIGINE具有快速的 交叉点检测算法。它可用于射线投射,计算视线(LOS)或地势高度(HOT)等。

Intersections can also be found between the node's bounding volume and another bounding volume of the specified size.也可以在节点的边界体积和另一个具有指定大小的边界体积之间找到交点。

Samples and Demos样本和演示#

UNIGINE provides a rich set of built-in samples and demo projects covering basic principles of working with the Engine (operations with the built-in nodes, output rendering, GUI setting, etc.). There are different samples for each of the 3 programming languages. All samples come with the full source code. To check them out, go to SDK browser -> Samples. UNIGINE提供了丰富的内置示例 demo项目,涵盖了使用引擎的基本原理(使用内置节点进行操作,输出呈现, GUI设置等)。三种编程语言中的每一种都有不同的示例。所有示例均附带完整的源代码。要检查它们,请转到SDK browser -> Samples

An extended set of art samples is also included for your convenience to illustrate various aspects of working with content: you can learn how to use UNIGINE's built-in objects with different settings, set up LODs and materials, adjust rendering settings, or work with vegetation. These art samples are available via UNIGINE SDK Browser as a demo: go to Samples -> Demos and install the Art Samples demo.其中还包含一组扩展的 艺术样本 ,以方便您说明使用内容的各个方面:您可以学习如何使用 UNIGINE内置的在具有不同设置的对象中,设置 LOD 材质,调整渲染设置,或使用植被。这些艺术品示例可以通过 UNIGINE SDK浏览器作为演示获得:转到Samples -> Demos并安装Art Samples演示。

How to Optimize Your Project's Performance?如何优化项目的绩效?#

UNIGINE offers a wide range of various optimizations to ensure that your application runs at its best and fastest. But in order to enable them, you should do your part of the job: follow recommendations when preparing and setting up your project's content, e.g., use LODs, bit masking, and other techniques. UNIGINE提供广泛的各种优化,以确保您的应用程序以最佳和最快的速度运行。但是为了启用它们,您应该做自己的工作:准备和设置项目内容时遵循建议,例如,使用 LOD 位掩码和其他技术。


Smooth alpha-blended levels of details (LODs) are used to decrease geometry complexity of 3D objects, when these objects move away from the camera, making it possible to lighten the load on the renderer.平滑的alpha混合细节级别(LOD)用于降低3D对象的几何复杂度,当这些对象远离相机时,可以减轻渲染器上的负担。

Usually, LODs are used for:通常,LOD用于:

  • Switching high-polygonal surfaces of the mesh to low-polygonal ones.将网格的高多边形曲面切换为低多边形的曲面。
  • Switching surfaces with complex materials to surfaces with simplified optimized ones.将具有复杂材质的曲面切换为具有简化的优化材质的曲面。
  • Switching several high-polygonal surfaces to a single simplified surface.将多个高多边形曲面切换到单个简化的曲面。
  • Switching one node type to the other (for example, switching a high-polygonal mesh to a billboard, a two-polygonal object that always faces the camera).将一种 node 类型切换为另一种类型(例如,将高多边形网格切换为广告牌,即始终面向摄像机的两个多边形对象)。

Switching between LODs can depend not only on the distance from the camera, but also on the distance from the certain object.在LOD之间切换不仅取决于距相机的距离,还取决于距特定物体的距离。

UNIGINE offers two mechanisms of LODs switching: UNIGINE提供了两种 LOD 切换机制:

  • Disable one LOD and enable another at the specified distance defined by two values: maximum visibility distance of the first LOD (Max Visibility) and minimum visibility distance of the second LOD (Min Visibility).

    禁用一个LOD,并在由两个值定义的指定 distance 启用另一个LOD:第一个LOD的最大可见距离(Max Visibility)和第二个LOD的最小可见距离(Min Visibility)。

  • Smoothly fade one LOD into another at the specified interval defined by two values: minimum fade distance of the first LOD (Min Fade) and maximum fade distance of the first LOD/minimum fade distance of the second LOD (Max Fade).

    以两个值定义的指定间隔将一个LOD平滑地淡入到另一个LOD:第一个LOD的最小淡入距离(Min Fade)和第一个LOD的最大淡入距离/第二个LOD的最小淡入距离(Max Fade )。

See the Setting up object LODs article for the details.有关详细信息,请参见设置对象LODs文章

Bit Masking位屏蔽#

Bit masking defines whether two entities affect each other or not. It can be used to:位掩码定义两个实体是否相互影响。它可以用于:

The bit masking algorithm compares 32-bit masks of each of two nodes using binary operator and. If masks match, one object will influence another object; if they don't, the objects won't interact. 位掩码 算法使用二进制运算符比较两个节点中每个节点的32位掩码。如果蒙版匹配,则一个对象将影响另一对象;如果不这样做,对象将不会交互。

If two masks have at least one matching bit, the masks match. E.g. the following two masks match, as they have 4 matching bits:如果两个掩码具有至少一个匹配位,则掩码匹配。例如。以下两个掩码匹配,因为它们具有 4 个匹配位:

You can learn more about content optimization by watching the following tutorial:您可以通过观看以下教程来了解有关内容优化的更多信息:

Now you are prepared to start your experience with UNIGINE. Enjoy!现在,您准备开始使用UNIGINE。享受吧!

最新更新: 2021-07-16
Build: ()