世界结构与内置对象
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的虚拟世界(world)是一个3D场景,包含一组放置于特定位置的不同场景图节点(如静态网格、光源、摄像机等),应用于整个场景的全局设置(渲染、物理等)。
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. All nodes are arranged into a hierarchy: there are parent and child nodes; one node can have several child nodes. A scene graph in UNIGINE is a multi-root tree (hierarchy) of nodes. Each world is represented by an XML file with the *.world extension.在UNIGINE中,所有添加到场景中的对象都称为节点(node)。节点可以有不同的类型,这些类型决定了它们的视觉表现和行为。所有节点都按层级结构排列:存在父(parent)节点和子(child)节点,一个节点可以包含多个子节点。UNIGINE中的场景图是多根节点树(层级结构)。每个世界都由一个扩展名为*.world的XML文件表示。
To edit your existing worlds and create new ones, use UnigineEditor. You can create and use as many worlds as you need.要编辑现有世界或创建新世界,请使用UnigineEditor。你可以根据需要创建和使用任意数量的世界。
There is a rich set of built-in node types with various functions. 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.UNIGINE提供了丰富的内置节点类型,具有各种功能。虽然这些类型已覆盖几乎所有需求场景,但用户仍可手动扩展。你还可以通过添加组件来扩展任何节点的基本功能。
Coordinate system. Local and global coordinates坐标系:局部坐标与全局坐标#
Each node has a transformation matrix that defines its position, rotation and scale in the virtual world.每个节点都拥有一个变换矩阵,用于定义其在虚拟世界中的位置、旋转和缩放比例。
The three-dimensional space in UNIGINE is represented by the right-handed Cartesian coordinate system where the X and Y axes form a horizontal plane, and the Z axis points upwards. The Y axis in UNIGINE always points forward, but in third-party editors the forward axis direction may be different. Take this into account when exporting models.UNIGINE采用右手笛卡尔坐标系表示三维空间:X轴和Y轴构成水平面,Z轴垂直向上。Y轴始终指向正前方(注意:第三方建模软件的前向轴方向可能不同,导出模型时需特别注意)。
A positive rotation angle specifies counterclockwise rotation. This corresponds to the right-hand rule: if you place your right thumb along the axis, the direction of the other fingers will show the direction of rotation.正旋转角度表示逆时针旋转。这符合右手定则:将右手拇指沿轴向放置,其他手指的弯曲方向即为旋转方向。
The position of the first-level nodes (parent nodes) is set in global coordinates. The position of child nodes is set in local coordinates relative to the parent node (unless other conditions have been set). Due to this, any transformation (moving, rotation, resizing) of one parent node will result in transformation of all children: we can move just one node by specifying its coordinates in global space, and the children nodes location will be calculated automatically.父节点的位置使用全局坐标设置。子节点的位置则相对于父节点使用局部坐标设置(除非设置了其他条件)。因此,对父节点进行的任何变换(移动、旋转、调整大小)都会导致所有子节点的变换:我们只需在全局空间中指定一个节点的坐标来移动它,子节点的位置将自动计算。
The basis of the global coordinate system is located in the origin of the virtual world and is set automatically. In case of the local coordinate system, the pivot point of the parent node is taken as the basis.全局坐标系的原点位于虚拟世界的起点并自动设置。对于局部坐标系,则以父节点的枢轴点(pivot point)作为原点。
Parameters of all nodes in the world are usually stored in a file with the *.world extension, but can also be stored in separate XML files with the *.node extension. These files can be referenced from the *.world file via Node Reference — a specific node designed for various purposes (object templates, dividing the world hierarchy into segments).世界中所有节点的参数通常存储在扩展名为*.world的文件中,但也可以存储在单独的扩展名为*.node的XML文件中。这些文件可以通过节点引用(Node Reference)从*.world文件中引用:这是一种特殊节点,设计用于各种目的(如对象模板、将世界层次结构分割成段等)。
Basic objects基本对象#
Let's review main node types available in UNIGINE. They are divided into groups depending on their purpose. There are nodes that have a visual representation: objects, effects, and decals. Objects have surfaces that define their geometry (polygonal mesh). The other types of nodes (light sources, physical effects, cameras, etc.) are invisible.让我们概述UNIGINE中的主要节点类型。它们根据用途被分为不同组别。有些节点具有视觉表现:对象、特效和贴花。对象拥有定义其几何形状的表面(多边形网格)。其他类型的节点(光源、物理效果、摄像机等)则是不可见的。
Nodes节点(Nodes)#
This group includes such types as Node Reference, Dummy Node, Layer Node, and Trigger Node. Let's review them in detail.这一组包含节点引用(Node Reference)、虚拟节点(Dummy Node)、图层节点(Layer Node)和触发器节点(Trigger Node)等类型。让我们详细了解一下它们。
Node Reference节点引用(Node Reference)#
This type of node refers to a *.node file on the disk, which contains a pre-fabricated node (or a hierarchy of nodes) with links to all materials, properties, physical bodies, and components that are required for its rendering and behavior. Node Reference is used for placing of multiple identical objects (instancing — we'll talk about that in the next chapter in more detail), which point to one and the same *.node asset. Editing and saving only one Node Reference will update all placed copies. 这类节点引用磁盘上的*.node文件,该文件包含一个预制节点(或节点层次结构),以及渲染和行为所需的所有材质、属性、物理体和组件的引用。节点引用用于放置多个相同对象(实例化,我们将在下一章详细讨论),这些对象都指向同一个*.node资源。只需编辑并保存一个节点引用,所有放置的副本都会更新。
Dummy Node虚拟节点(Dummy Node)#
This is a zero-sized node that has no visual representation. It is used to organize other nodes into a hierarchy and control them as a group by transforming or enabling/disabling the parent Dummy Node. This node can have logic assigned via a component.这是一个零尺寸的无视觉表现节点。它用于将其他节点组织成层次结构,并通过变换或启用/禁用父虚拟节点来控制它们作为一个组。该节点可以通过组件分配逻辑。
Layer Node图层节点(Layer Node)#
This node is also invisible and used as a container for editing other nodes. Layer Node allows saving all its child nodes into a separate *.node file, enabling you to split the world into several logical parts and save each of them separately. This approach facilitates collaborative work on one project by eliminating conflicts arising from simultaneous editing of this world by several people (changes in child Layer Nodes do not affect the *.world file).这个节点也是不可见的,用作编辑其他节点的容器。图层节点允许将其所有子节点保存到一个单独的*.node文件中,使你能够将世界分割成多个逻辑部分并分别保存每个部分。这种方法通过避免多人同时编辑这个世界时产生的冲突(子图层节点的更改不会影响*.world文件),促进了项目协作。
Unlike Node Reference, it is impossible that multiple Layer Nodes refer to the same *.node file. This will lead to conflicts when saving changes.与节点引用不同,多个图层节点不能引用同一个*.node文件。这会在保存更改时导致冲突。
Trigger Node触发器节点(Trigger Node)#
This is a zero-sized node that has no visual representation. It fires callbacks on transforming and enabling/disabling its parent node.这是一个零尺寸的无视觉表现节点。它会在父节点变换和启用/禁用时触发回调。
Objects对象(Object)#
Objects are a virtual representation of entities or objects from the real world. They are used to build the virtual world: you can create sky, terrain, water, buildings, characters, any objects using the corresponding types of objects.对象是现实世界中实体或物体的虚拟表现。它们用于构建虚拟世界:你可以使用相应类型的对象来创建天空、地形、水、建筑物、角色或任何物体。
Dummy Object虚拟对象(Dummy Object)#
This is an empty invisible object similar to Dummy Node. The only difference is that it can have a physical body assigned and therefore is used as an invisible object with physical properties. For example, you can use it to fix the fabric in a specific position.这是一个类似于虚拟节点的空不可见对象。唯一区别是它可以分配物理体,因此被用作具有物理属性的不可见对象。例如,你可以用它来固定织物在特定位置。
Mesh Objects (Static, Skinned, and Dynamic)网格对象(静态、蒙皮和动态)#
Static Mesh is an object consisting of polygons that define its geometry. This geometry is stored in the *.mesh file and is always unchanged. Usually Static Mesh is used to create static geometry, such as buildings or furniture. The geometry of such objects is created in third-party 3D editors and then imported into the engine. In addition to Static Mesh, there are two other similar objects used in specific cases:静态网格(Static Mesh)是由定义其几何形状的多边形构成的对象。这种几何形状存储在*.mesh文件中且始终不变。静态网格通常用于创建静态几何体,如建筑物或家具。这类对象的几何体在第三方3D编辑器中创建,然后导入引擎。除静态网格外,还有两种用于特定情况的类似对象:
- Dynamic Mesh is an object the geometry of which can be modified procedurally. As a rule, such modification is required to change the object shape as a result of some external impact (clash, explosion) or to create dynamically changing surfaces (fabric, wire, liquid, etc.).动态网格(Dynamic Mesh)是其几何形状可以通过程序修改的对象。通常,这种修改是为了因应某些外部影响(碰撞、爆炸)而改变物体形状,或创建动态变化的表面(织物、电线、液体等)。
-
Skinned Mesh is an object used to create characters with skeletal animation or animation based on a set of distorted versions of an object (morph targets or blend shapes). In addition to geometry, it contains animation data.蒙皮网格(Skinned Mesh)是用于创建带有骨骼动画或基于一组变形版本对象(变形目标或混合形状)动画的角色对象。除了几何体外,它还包含动画数据。
UNIGINE also uses composite objects based on Static Mesh for optimization purposes:UNIGINE还使用基于静态网格的复合对象来优化性能:
-
Mesh Cluster is an object that can contain a great number of identical meshes placed around the scene as you see fit. Mesh Cluster manages these meshes as one object, but their position, rotation, and scale can be changed manually. This object is usually used to place multiple identical objects, for example, houses in a neighborhood. Identical mesh objects can be baked to Mesh Cluster manually or in semi-automatic mode.网格簇(Mesh Cluster)是可以包含大量相同网格的对象,这些网格可以按照你的需求放置在场景各处。网格簇将这些网格作为一个对象来管理,但它们的位置、旋转和缩放可以手动更改。该对象通常用于放置多个相同物体,例如社区中的房屋。相同的网格对象可以手动或半自动模式烘焙到网格簇中。
-
Mesh Clutter is an object that contains identical meshes. However in this case meshes are positioned randomly and cannot be managed manually. Mesh Clutter is used to fill the scene with vegetation (for example, to create a forest) or place identical objects (leaves, branches, garbage). Areas where meshes can be placed are defined by specific masks.网格散布(Mesh Clutter)是包含相同网格的对象。但在这种情况下,网格是随机放置且无法手动管理的。网格散布用于用植被填充场景(例如创建森林)或放置相同物体(树叶、树枝、垃圾)。可以通过特定遮罩定义可放置网格的区域。
Landscape Terrain地形景观(Landscape Terrain)#
UNIGINE has Landscape Terrain, which is used to create a virtually infinite arbitrary landscape with high level of detail, optimized performance, and flexible settings. It supports collaborative editing and the ability to modify the surface in real time (creating craters, explosion funnels, and trenches). The Landscape Terrain object consists of individual layers (Landscape Layer Map), each storing the data used for rendering (elevation, imagery, and masks). These layers are blended to create a realistic landscape. You can draw a landscape from scratch in the Editor or use data generated in a third-party application.UNIGINE拥有景观地形(Landscape Terrain)功能,可用于创建具有高细节度、优化性能和灵活设置的近乎无限的任意地形景观。它支持协作编辑和实时修改地表的能力(如创建弹坑、爆炸漏斗和战壕)。景观地形对象由独立的图层(Landscape Layer Map)组成,每个图层存储用于渲染的数据(高程、影像和遮罩)。这些图层通过混合来创建逼真的地形景观。你可以在编辑器中从头绘制地形,或使用第三方应用程序生成的数据。
You can also use the Terrain Global object to create a landscape — it has specific features and is mainly used for flight simulators. We are not going to review this object in the course.你也可以使用全局地形(Terrain Global)对象来创建地形,它具有特定功能,主要用于飞行模拟器。本课程将不涉及该对象的详细介绍。
Water水体(Water)#
To create realistic water (with waves, ripples and foam, reflection and refraction effects) and various liquids, UNIGINE provides two objects:为创建逼真的水体(含波浪、涟漪和泡沫,反射和折射效果)和各种液体,UNIGINE提供两种对象:
- Global Water is an infinite mesh with automatic tessellation used to create the global ocean. This object has an underwater mode, and the water level is the same everywhere. You can create realistic waves on the surface by setting the Beauforts mode or using the Layers mode. The object does not interact with physical objects as this would require a large amount of calculations. 全局水体(Global Water)是带有自动细分功能的无限网格,用于创建全球海洋。该对象具有水下模式,且各处水位高度一致。你可以通过设置蒲福风级模式(Beauforts mode)或使用图层模式(Layers mode)在表面创建逼真波浪。该对象不与物理对象互动,因为这需要大量计算。
- Water Mesh is used for finite basins (pools, ponds, lakes, etc.), as well as for modeling any liquids in a confined basin of arbitrary shape. It can be used to create a mountain lake or a stream of water with an altitude difference above sea level. This object supports interaction with physical bodies (buoyancy simulation) but has no underwater mode. You can create ripples and waves on the surface using the Normal map or a combination of four directional geometric waves.水体网格(Water Mesh)用于有限水域(水池、池塘、湖泊等),以及模拟任意形状封闭容器中的任何液体。它可用于创建高山湖泊或具有海拔落差的溪流。该对象支持与物理体的交互(浮力模拟)但不具备水下模式。你可以使用法线贴图或四种方向性几何波的组合在表面创建涟漪和波浪。
Sky天空(Sky)#
This object is used for simplified simulation of the planet's atmosphere. It is modelled as an upper hemisphere of the specified color with dynamic clouds generated using a special texture.该对象用于简化模拟行星大气层。它被建模为指定颜色的上半球体,并使用特殊纹理生成动态云层。
Cloud Layer云层(Cloud Layer)#
This object allows generating layers of volumetric clouds that drift across the sky, with realistic lighting, shadow casting, and interactivity.该对象可生成体积云层,这些云层会随天空漂移,具有逼真的光照、投影和交互效果。
It supports the 10 basic types of clouds that exist in nature (cumulus, cirrus, etc.), which are available as customizable presets, and you can simultaneously add several different layers at different heights. Support for the Earth's curvature is also available to make the cloudy sky conform to the planet's shape.它支持自然界存在的10种基本云类型(积云、卷云等),这些类型可作为可定制预设使用,并且你可以同时在多个不同高度添加不同云层。还支持地球曲率效果,使云空符合行星形状。
Grass植被(Grass)#
This object is used to create animated vegetation, including grass. Its appearance is determined mainly by two textures: the Diffuse texture, which defines variations of each type of vegetation, and the Mask texture, which defines the areas of growing and density.该对象用于创建含动画效果的植被,包括草类。其外观主要由两种纹理决定:定义每种植被变体的漫反射(Diffuse)纹理,以及定义生长区域和密度的遮罩(Mask)纹理。
Vegetation diversity is also achieved through a probability factor that affects height, color, slope, rotation, and other parameters.植被多样性还通过影响高度、颜色、坡度、旋转等参数的概率因子来实现。
Billboards公告牌(Billboards)#
Billboard is a rectangular flat object that always faces the camera. The Billboards object consists of a number of such billboard elements. It is used instead of fully functional objects that are barely seen from far off and slightly change their position when the camera moves around them (such as stars, clouds, or trees at a distance). Using Billboards helps to speed up rendering. 公告牌(Billboard)是始终面向摄像机的矩形平面对象。公告牌对象(Billboards)由多个此类公告牌元素组成。它用于替代那些远距离几乎看不清且随摄像机移动仅轻微改变位置的完整功能对象(如星星、云朵或远处的树木)。使用公告牌有助于加速渲染。
Depending on its purpose, a Billboards object can be of either of three types (Base, Impostor, or Cloud) and is assigned a corresponding material. Materials differ in a set of parameters and are displayed in different ways.根据用途不同,公告牌对象可以是三种类型之一(基础型、替身型或云型),并分配相应的材质。这些材质具有不同的参数集,并以不同方式显示。
Effects特效(Effects)#
UNIGINE has several types of nodes that provide visual effects:UNIGINE提供多种能产生视觉特效的节点类型:
- Particle system is a complex object consisting of an emitter, particles, and additional physical forces affecting the particles. It is used to create fire, smoke, fireworks, fountains, snow, rain, etc. We will review this node type in more detail later.粒子系统(Particle system)是由发射器、粒子及影响粒子的附加物理力组成的复合对象。用于创建火焰、烟雾、烟花、喷泉、雪、雨等效果。我们稍后将详细讲解这类节点。
-
Volumetric objects are used to create volumetric effects (fog, clouds, sun rays, etc.):体积对象(Volumetric objects)用于创建体积特效(雾、云、阳光射线等):
- Volume Box creates a volumetric effect of rectangular shape: fog, clouds, rays of light from the sun.体积盒(Volume Box)创建矩形体积特效:雾、云、太阳光线。
- Volume Sphere creates a spherical or ellipsoidal volumetric effect such as fog, haze, or glow around point light sources (candles, lamps, etc.).体积球(Volume Sphere)创建球形或椭球形体积特效,如点光源(蜡烛、灯具等)周围的雾、薄雾或辉光。
- Volume Omni creates a visible volume of light emitted from a flat surface (e.g. flat wall and ceiling lamps).全向体积(Volume Omni)创建从平面表面(如平板壁灯和吸顶灯)发射的可见光体积。
- Volume Projected creates light rays from directional light sources (car headlights, spotlights).投影体积(Volume Projected)创建定向光源(汽车前灯、聚光灯)的光线效果。
-
Fields – box or ellipsoid-shaped objects that affect certain areas of grass, water, or clouds within their volume in a specific way:场(Field)是盒状或椭球状对象,以特定方式影响其体积范围内特定区域的草、水或云:
- Field Spacer cuts out areas of grass and water geometry.间隔场(Field Spacer)裁切草和水体几何体的区域。
- Field Animation animates grass and water geometry.动画场(Field Animation)为草和水体几何体添加动画。
- Field Height defines areas of Global Water where the water level should change due to external effects (e.g. to create a wake or water disturbance near certain objects).高度场(Field Height)定义全局水体(Global Water)中因外部效应(如在某些物体附近创建尾流或水体扰动)需要改变水位的区域。
- Field Shoreline defines the areas of Global Water where shoreline swash zone should be located.海岸线场(Field Shoreline)定义全局水体中海岸冲刷带应位于的区域。
- Field Weather defines the location of cloud areas within the Cloud Layer. It helps to create a local storm, or clouds of the desired shape.天气场(Field Weather)定义云层(Cloud Layer)内云区的分布位置。可用于创建局部风暴或特定形状的云团。
-
Physicals – objects inside of which there is an invisible force field affecting other objects. These objects allow simulating wind, force fields, floating. We will review them later in detail.物理场(Physicals)是内部含有能影响其他物体的隐形力场的对象。这些对象可模拟风力、力场、漂浮等效果。我们将在后续详细讲解。
Decals贴花(Decal)#
Decal is a material projection on the surface. Decals allow adding details — they help imitating holes, stains, traces, puddles, etc. Decals can also be projected onto the water surface and used to create holes in the landscape.贴花(Decal)是投射在表面的材质。贴花可用于添加细节:帮助模拟孔洞、污渍、痕迹、水洼等效果。贴花还能投射到水面,并用于在地形上创建孔洞。
There are three types of decals in UNIGINE:UNIGINE中有三种贴花类型:
- Orthographic Decal is a decal projected onto a surface using orthogonal projection. Its size is independent of the distance to the surface on which it is projected. This decal follows the shape of any surface, so it looks realistic.正交贴花(Orthographic Decal):使用正交投影投射到表面的贴花。其大小与投射表面的距离无关。这类贴花会贴合任何表面形状,因此看起来十分逼真。
- Projected Decal is a decal projected onto a surface using perspective projection. The decal size increases as the distance to the surface increases. Projected Decal forms a projection pyramid, the size of which can be adjusted using the settings.透视贴花(Projected Decal):使用透视投影投射到表面的贴花。贴花大小会随投射距离增加而增大。透视贴花形成可调节大小的投射棱锥。.
- Mesh Decal is a decal that projects arbitrary geometry onto the surface using orthogonal projection. This type of decal is suitable for creating large objects with complex shapes (e.g. an entire airfield).网格贴花(Mesh Decal):使用正交投影将任意几何体投射到表面的贴花。适合创建具有复杂形状的大型物体(如整个机场)。
正交贴花 | 透视贴花 |
---|---|
![]() |
![]() |
网格贴花 | |
![]() |
World Nodes世界节点(World Nodes)#
Nodes from this group are invisible and are used to control the virtual world:该组节点不可见,用于控制虚拟世界:
- World Trigger activates certain events when any objects enter or leave its bounds.世界触发器(World Trigger):当任何物体进入或离开其边界时触发特定事件。
- World Clutter manages a large number of Node Reference nodes as a single object. Nodes in the clutter are scattered randomly and cannot be edited individually.世界散布(World Clutter):将大量节点引用(Node Reference)作为单个对象管理。散布中的节点随机分布且无法单独编辑。
- Switcher enables or disables its child nodes at a certain distance from the camera, allowing you to implement distance-based switching between two objects, disabling an object when it is far away from the camera and enabling it when it is close.切换器(Switcher):根据与摄像机的距离启用或禁用其子节点,可实现基于距离的对象切换(远距离禁用/近距离启用)。
- Occluder is used to cut off geometry that is not visible behind it. Surfaces behind the Occluder (simple or complex shapes) are not rendered, and this allows you to optimize rendering of complex scenes with a large number of objects that overlap each other.遮挡器(Occluder):用于剔除其后不可见的几何体。遮挡器后方的表面(简单或复杂形状)不会被渲染,可优化具有大量重叠对象的复杂场景渲染。
- Transform Path is a sequence of transformations along an arbitrary path. It defines a trajectory along which objects can move.变换路径(Transform Path):沿任意路径的变换序列。定义对象可移动的轨迹。
- Transform Bone is a sequence of transformations based on skeletal animation and is used together with Mesh Skinned: it receives the transformation of a particular bone, and all its child nodes move according to this transformation.骨骼变换(Transform Bone):基于骨骼动画的变换序列,与蒙皮网格(Mesh Skinned)配合使用:接收特定骨骼的变换,其所有子节点按此变换移动。
- World Expression is a node that executes custom scripts as long as the camera is within a set distance from it.世界表达式(World Expression):在摄像机处于设定距离内时执行自定义脚本的节点。
- World Spline Graph is a node used to place various nodes at points and along the segments (linear or curved) of a spline graph. It can be used to create roads, pipelines, chains, etc.世界样条图(World Spline Graph):用于在样条图点段(直线或曲线)上放置各种节点的工具。可用于创建道路、管道、链条等结构。
In addition, there are Lights, Sounds, GUI Objects, Pathfinding nodes, and Players, which will be introduced in this course.此外,本课程还将介绍灯光(Light)、声音(Sound)、GUI对象(GUI Object)、寻路节点(Pathfinding node)和玩家(Player)等节点类型。
本页面上的信息适用于 UNIGINE 2.20 SDK.