This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
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
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

植被:创作技巧

This article describes principles of modeling and configuring plants and ways to achieve the best performance in scenes with dense vegetation in UNIGINE.本文介绍了在 UNIGINE 中对植物进行建模和配置的原理以及在植被茂密的场景中实现最佳性能的方法。

Polygon Plants多边形植物#

Models of plants based on polygon meshes should be used for close-ups and middle distances for the most realistic representation of real-life greenery. It is crucial to use optimized 3D models of trees in real-time projects.基于多边形网格的植物模型应用于特写镜头和中距离镜头,以最真实地呈现现实生活中的绿色植物。在实时项目中使用优化的 3D 树木模型至关重要。

This section will introduce you to some vegetation authoring tips in UNIGINE and third-party Digital Content Creation software.本节将向您介绍 UNIGINE 和第三方数字内容创建软件中的一些植被创作技巧。

Modeling造型#

When preparing a 3D model of a tree with dense foliage, avoid creating topology for all branches and leaves; instead, it is much more efficient performance-wise to simulate fine details with textures. The main rule of models optimized for use in real-time is "the fewer polygons — the better". Following this rule is much more critical for rendering a dense forest filled with multiple types of plants and grasses.在准备树叶茂密的树的 3D 模型时,避免为所有树枝和树叶创建拓扑;相反,使用纹理模拟精细细节在性能方面要高效得多。为实时使用而优化的模型的主要规则是“多边形越少越好”。遵循这条规则对于渲染充满多种植物和草的茂密森林更为关键。

Therefore, it is highly recommended to prepare several levels of detail (LODs) for a plant to be used at different distances from the camera.因此,强烈建议准备几个层次的细节(细节层次) 用于在距相机不同距离处使用的植物。

The overall workflow of modeling a tree is as follows:树建模的整体工作流程如下:

  1. Model several small branches with leaves and bake the models into texture atlases — the obtained textures are going to be your foliage textures. Here are examples of such textures:用树叶为几个小树枝建模并将模型烘焙到纹理图集中——获得的纹理将成为你的树叶纹理。以下是此类纹理的示例:

  2. Create low-poly meshes that will represent foliage chunks, map UVs for proper texturing. The chunks do not have to be flat, you can experiment with the shape and bend of meshes. It is also important to prepare at least 3 LODs, so make sure to optimize the meshes of LODs to the full extent:创建将代表树叶块的低多边形网格,映射 UV 以获得适当的纹理。块不必是平的,您可以尝试网格的形状和弯曲。准备至少 3 个 LOD 也很重要,因此请确保将 LOD 的网格优化到最大程度:

    Branches

    Foliage LODs植被 LOD
  3. Create the trunk with large branches and levels of detail for it. Prepare and assign necessary textures and materials.创建具有大分支和详细级别的树干。准备和分配必要的纹理和材质。

    Trunk LODs主干 LOD

    Also, it is recommended to transfer normals from the trunk to the adjoined vertices of branches to make a more natural look of joints:此外,建议将法线从树干转移到分支的相邻顶点,以使关节看起来更自然:

    Adjusted normals of branches at joints provide a more natural look调整关节处的分支法线提供更自然的外观
  4. Scatter the LODs of foliage chunks over branches of the corresponding trunk LODs forming the tree crown:将树叶块的 LOD 散布在形成树冠的相应树干 LOD 的树枝上:

    Tree LODs

    The fact that the same number of chunks is used on all LODs may result in a higher polygon count. However, this approach has a number of advantages:在所有 LOD 上使用相同数量的块这一事实可能会导致更高的多边形数量。但是,这种方法有很多优点:

    • High diversity of branches makes it possible to create more realistic plants.分支的高度多样性使得创建更逼真的植物成为可能。
    • A better, almost seamless transition between LODs. All elements can be adjusted at any time to get rid of any inconsistencies.LOD 之间更好的、几乎无缝的过渡。所有元素都可以随时调整,以消除任何不一致。
    • A more permissive art pipeline enables the artists to collect trees of different sizes and ages out of the same chunks.更宽松的艺术管道使艺术家能够从相同的块中收集不同大小和年龄的树木。
    • Accurate work of post effects even on the lowest LODs (SSAO, SSGI, etc.).即使在最低 LOD(SSAO, SSGI 等)上也能准确处理后期效果。
  5. It is also recommended to create a separate low detail foliage LOD to simplify shadow casting. You can duplicate the lowest LOD and optimize it even more for this purpose and configure shadow casting in UNIGINE.还建议创建单独的低细节植物 LOD 以简化阴影投射。为此,您可以复制最低的 LOD 并对其进行更多优化,并且配置阴影投射在 UNIGINE 中。
  6. For better blending with terrain, prepare a separate bottom part of the trunk with a new material assigned. You can merge it to the mesh of the highest LOD for convenience:为了更好地与地形融合,请准备一个单独的树干底部并分配新材质。为方便起见,您可以将其合并到最高 LOD 的网格中:

    Bottom part of the tree for blending with terrain

  7. Orient the model so it will be imported in UNIGINE appropriately, reset all transformations.定位模型因此它将适当地导入 UNIGINE,重置所有转换。

    Pay attention to the correct position of the mesh's pivot point (apparently, all the LODs must have the same position). As a rule, the pivot is placed at the bottommost point of the plant for ease of world design. However, you can alter the position of the pivot if this is needed for stem animation.注意网格的枢轴点的正确位置(显然,所有 LOD 必须具有相同的位置)。通常,枢轴放置在工厂的最底部,以便于世界设计。但是,如果需要,您可以更改枢轴的位置茎动画.

  8. As a result, the model has the following content:因此,该模型具有以下内容:

    For convenience, it is recommended to add postfixes to the names of levels of detail that will be used later during import.为方便起见,建议为稍后将在导入期间使用的详细级别的名称添加后缀。

  9. Consider further adjustment of vertex normals and vertex colors and UVs for leaves animation.考虑进一步调整顶点法线和顶点颜色和UV叶动画.
  10. Export the model to the recommended FBX format.导出模型到推荐的 FBX 格式。

Configuring the Look of the Plant配置工厂的外观#

Import the created model to UNIGINE following the FBX Import Guide and add the plant to the scene.将创建的模型导入 UNIGINE FBX 导入指南将植物添加到场景中.

To make all separate objects surfaces of the single Mesh Static, enable Merge Static Meshes in the import settings.要使单个 Mesh Static 的所有单独对象表面,启用合并静态网格体在导入设置中。

Setting Up LODs设置 LOD#

Set the visibility distances for LODs by enabling the Combine By Postfixes option and adjusting values in the import settings.设置可见距离细节层次通过启用 Combine By Postfixes 选项并调整导入设置中的值。


Shadow LOD阴影细节层次#

When dynamic shadow casting is used, all polygons are rendered one more time for each light source with shadows enabled. World light sources can have up to 4 shadow cascades, so the number of polygons rendered into shadow maps can be tremendous, leading to a strong performance hit. You can estimate this number by using the Rendering Profiler.什么时候动态阴影投射使用时,启用阴影的每个光源都会再渲染一次所有多边形。 World 光源最多可以有 4 个阴影级联,因此渲染到阴影贴图中的多边形数量可能非常巨大,从而对性能造成很大影响。您可以使用渲染分析器.

That is why it is a best practice to use a low-poly mesh for foliage shadows. Perform the following steps:这就是为什么对树叶阴影使用低多边形网格是最佳实践的原因。执行以下步骤:

  1. Disable shadow casting for all foliage LODs except the Shadow LOD. You can do it in one of the following ways:禁用除阴影 LOD 之外的所有植物 LOD 的阴影投射。您可以通过以下方式之一执行此操作:

  2. Hide the shadow LOD for any camera by toggling off all bits of its Viewport Mask.通过切换所有位来隐藏任何相机的阴影 LOD视口蒙版.

See the demonstration of configuring a shadow LOD in the Bit Masking video tutorial.请参阅配置阴影 LOD 的演示位掩蔽视频教程。

Materials Adjustment材质调整#

If the Import Materials flag was enabled in the import options, all necessary materials are already generated and assigned to the surfaces of the tree. Let's consider material parameters that worth being noted:如果在导入选项中启用了 Import Materials 标志,则所有必要的材质都已生成并分配给树的表面。让我们考虑一下值得注意的材质参数:

  • Make the leaves material Alpha-Test to cut out texels according to the Alpha channel of the Albedo texture.使叶子材质为 Alpha-Test,以根据 Albedo 纹理的 Alpha 通道切出纹素。
  • If specular highlights are incorrect, it is recommended to set the Specular value to 0.如果镜面高光不正确,建议将 Specular 值设置为 0

    Incorrect lighting on flat leaves

    Incorrect lighting on the Reflections Rendering Debug preview (left) and the result image (right)反射渲染调试预览(左)和结果图像(右)上的照明不正确
  • Consider enabling the Two Sided option for the material to make the foliage denser. Be careful, as it may significantly affect performance if there are too many polygons in the scene.考虑为材质启用 Two Sided 选项以使树叶更密集。请小心,因为如果场景中的多边形过多,可能会显着影响性能。

    It may be better to switch the Backside Normal mode to the To Front Side option since it usually provides more realistic results for foliage.Backside Normal 模式切换到 To Front Side 选项可能会更好,因为它通常会为植物提供更真实的结果。

  • If textures make it evident that foliage is made of flat chunks, a great solution to this is the Angle Fade feature that cuts out polygons faced to the camera at extreme angles.如果纹理表明树叶是由扁平的块组成的,那么一个很好的解决方案是 Angle Fade 功能,它以极端角度切出面向相机的多边形。

    注意
    This feature may work incorrectly for meshes that have modified normals.对于已修改法线的网格,此功能可能无法正常工作。
  • Adjusting translucency for the foliage material is necessary for a better look. Increase the Translucent value to permit light to pass through the object.调整树叶材质的半透明度对于更好的外观是必要的。增加 Translucent 值以允许光线穿过对象。

    You can also enable the use of the Translucent Map in the States tab to specify a single-channel texture that will define parts of the object that aren't translucent (such as branches).您还可以启用在 States 选项卡中使用 Translucent Map 来指定单通道纹理,该纹理将定义对象的非半透明部分(例如分支)。

    注意
    There is no need to paint fibers and small features of leaves on the Translucent texture if the Normal map is used and defines such surface irregularities.没有必要在半透明纹理上绘制纤维和叶子的小特征,如果普通的使用地图并定义此类表面不规则性。
    Albedo texture反照率纹理
    Translucent texture半透明纹理
  • Enable the Terrain Lerp flag for the material of the bottom part of the tree to blend your tree with a Terrain in your scene.为树底部的材质启用 Terrain Lerp 标志,以将您的树与地形在你的场景中。

Vertex Normals Adjustment顶点法线调整#

The fact that foliage is composed of flat chunks results in inaccurate shading. To counteract this and hide the flatness of the mesh, adjust vertex normals and affect the foliage is shaded.树叶由扁平块组成的事实导致不准确的阴影。要抵消这一点并隐藏网格的平整度,请调整顶点法线并影响树叶的阴影。

The following solutions are possible:以下解决方案是可能的:

  • Enable the Normals Rotated To Camera option so all surface normals will be oriented towards the camera, ignoring the geometry normals. This feature checks out as a quick solution, although it makes all polygons shaded the same way.启用 Normals Rotated To Camera 选项,以便所有表面法线将朝向相机,忽略几何法线。此功能作为一种快速解决方案进行了检查,尽管它使所有多边形都以相同的方式着色。

  • Edit vertex normals manually in your modeling software. Transfer vertex normals from a boundary cage to make the foliage look like a smooth and dense tree crown.在建模软件中手动编辑顶点法线。从边界笼子转移顶点法线,使树叶看起来像一个光滑而密集的树冠。

    注意
    It is recommended to use a dome-like boundary cage with the sides elongated to the ground to avoid shading errors on lower polygons.建议使用圆顶状的边界笼,边向地面拉长,以避免较低多边形上的着色错误。

    Transferring normals from a boundary cage

    Transferring normals from a boundary cage从边界笼转移法线

    As a result, the flatness of foliage geometry is less evident (on the right):结果,树叶几何形状的平整度不太明显(右侧):

MIP MapsMIP 地图#

The MipMapping technique, supported by UNIGINE renderer, implies sampling lower textures for smaller and distant polygons. At that, minor features of foliage start wiping away with the distance. In some cases, branches and leaves look thicker when far from the camera than on a close-up view.UNIGINE 渲染器支持的MipMapping技术意味着对较小和较远的多边形采样较低的纹理。那时,树叶的次要特征开始随着距离而消失。在某些情况下,远离相机时树枝和树叶看起来比近距离观察时更粗。

MIP maps

MIP mapsMIP 映射

This issue can be resolved via these approaches:可以通过以下方法解决此问题:

  • Engage the Mip Bias feature to shift the distance at which the switch between MIP-levels is performed. This option significantly affects the performance.使用 Mip Bias 功能来移动执行 MIP 级别之间切换的距离。此选项会显着影响性能。
  • By default, MIP maps for a texture are generated automatically on import using the Box filtering that may provide too blurred results. Consider switching to the Point filtering type to get sharper MIP maps.默认情况下,纹理的 MIP 贴图在导入时使用 Box 过滤自动生成,这可能会提供过于模糊的结果。考虑切换到 Point 过滤类型以获得更清晰的 MIP 映射。
  • You can also prepare custom MIP maps in third-party software. For example, here is a comparison between MIP maps generated using the Box filtering and the sharper Kaiser filtering:您还可以在第三方软件中准备自定义 MIP 映射。例如,下面是使用 Box 过滤和更清晰的 Kaiser 过滤生成的 MIP 图之间的比较:

    To import a texture with custom MIP-levels, use the Combine option for a texture with laid out MIP-levels or save them to a .dds format and import the texture with the Unchanged option enabled.要导入具有自定义 MIP 级别的纹理,请对具有布局 MIP 级别的纹理使用 Combine 选项,或将它们保存为 .dds 格式并在启用 Unchanged 选项的情况下导入纹理。

Animation动画#

Enable the Vegetation state to activate a set of animation-related parameters.启用 Vegetation 状态以激活一组动画相关参数。

Vegetation options

Vegetation animation consists of Stem and Leaves animation. To enable both of them, set Animation to the Default or Field option.植被动画包括树叶动画。要同时启用它们,请将 Animation 设置为 DefaultField 选项。

At that, Field Animation makes the plant be affected by Field Animation volumes enabling you to override animation parameters locally (e.g., simulation of rotor downwash effects in close proximity to a rotorcraft).在那, Field Animation 使植物受到影响现场动画体积使您能够在本地覆盖动画参数(例如,在旋翼飞机附近模拟旋翼下洗效果)。

Stem Animation茎动画#

Stem animation applies vertex movement based on spatial 3D noise to simulate bending of the plant's trunk or stem caused by wind. The mesh's pivot point is considered fixed, and the further the vertex is along the Z axis, the stronger movement is applied to it.茎动画应用基于空间 3D 噪声的顶点运动来模拟由风引起的植物树干或茎的弯曲。网格的枢轴点被认为是固定的,顶点沿 Z 轴越远,对其施加的运动就越强。

Thus, it is necessary to place the pivot point at the correct position (usually, it is the bottommost point of the stem) and orient the model, so the Z axis goes upwards.因此,需要将枢轴点放置在正确的位置(通常是杆的最底部)并定位模型,使 Z 轴向上。

Stem animation preview

Stem animation example茎动画示例

A set of Parameters controls the animation.一套参数控制动画。

Animation parameters

Please make note that all surfaces of the plant must have identical stem animation parameters in order to synchronize their movement.请注意,植物的所有表面必须具有相同的茎动画参数才能同步它们的运动。

Different stem animation parameters result in not synchronized parts of the tree

Different stem animation parameters result in not synchronized parts of the tree不同的茎动画参数导致树的部分不同步

Leaves Animation树叶动画#

The Leaves animation is another layer of vertex shader animation mainly applied to foliage, providing additional detail bending. Using this type of animation requires preliminary adjustment to geometry on the modeling stage.树叶动画是另一层顶点着色器动画,主要应用于树叶,提供额外的细节弯曲。使用这种类型的动画需要在建模阶段对几何形状进行初步调整。

Several approaches of leaves animation are available out of the box. Choose the type of animation using the Leaves option.几种方法叶子动画开箱即用。使用 Leaves 选项选择动画类型。

Geometry Vertex Color Based基于几何顶点颜色#

This recommended approach providing the best control over foliage implies that leaves are rendered as polygons, and vertex colors are used for animation.这种提供对树叶的最佳控制的推荐方法意味着树叶被渲染为多边形,并且顶点颜色用于动画。

Vegetation movements are defined by RGB channels of vertex colors as follows:植被运动由顶点颜色的 RGB 通道定义,如下所示:

Red channel is used for animation of smaller or peripheral parts of vegetation (leaves). Bright parts are animated, and dark parts are stiff.红色通道用于植被(叶子)的较小或外围部分的动画。明亮的部分是动画的,而黑暗的部分是僵硬的。
Green channel is used to define the movement order for branches in order to desynchronize them. The movement sequence starts from the brightest element to the darkest.绿色通道用于定义分支的移动顺序,以使它们不同步。运动顺序从最亮的元素开始到最暗的元素。
Blue channel is used to define which parts of branches can be bent. Brighter parts indicate bendable portions, and darker parts — stiff portions.蓝色通道用于定义分支的哪些部分可以弯曲。较亮的部分表示可弯曲部分,而较暗的部分   -   较硬的部分。

The animation parameters control vertices movement:动画参数控制顶点移动:

It is also a regular practice to animate branches using this technique even if they are attached to the trunk:即使分支连接到树干,使用此技术为分支设置动画也是一种常规做法:

The Green and Blue channels define the movement of vertices; the Red channel is not used for branches绿色和蓝色通道定义顶点的移动;红色通道不用于分支

At that, related surfaces must have the same vertex colors on adjacent vertices and identical animation parameters in order to synchronize their movement:此时,相关曲面必须在相邻顶点上具有相同的顶点颜色和相同的动画参数,以便同步它们的运动:

The colors of adjacent vertices of the trunk and foliage are the same, so the geometry stays connected when animated树干和树叶相邻顶点的颜色相同,因此动画时几何体保持连接

Geometry Vertex Color Based leaves animation基于几何顶点颜色的叶子动画
Geometry UV-based几何基于 UV#

This is a rather legacy approach when leaves are rendered as standard polygons. It requires the UV Channel 2 to be defined for the mesh.当叶子被渲染为标准多边形时,这是一种相当传统的方法。它需要为网格定义 UV 通道 2。

Geometry UV-based animation基于 UV 的几何动画
UV Channel 2: the stiffest vertices are in the top left cornerUV 通道 2:最硬的顶点在左上角

Animation uses UV channel 2 of an object as follows: in the UV grid, [0,1] is the pivot point for the object's movements and the stiffest part of the object, and towards [1,0], the object becomes more flexible.动画使用物体的UV通道2如下:在UV网格中,[0,1]是物体运动的轴心点,也是物体最硬的部分,朝向[1,0],物体变得更加灵活.

Control the vertices movement via the same Animation Parameters.通过相同的控制顶点移动动画参数.

BillboardBillboard#

Billboard is the most performance-friendly way of animating distant vegetation: all quads are rendered as billboards that always face the camera; the UV Channel 2 defines the size and movement of polygons. Hence, the foliage mesh should contain only quad polygons for leaves.Billboard 是对远处植被进行动画处理的最性能友好的方式:所有四边形都被渲染为始终面向相机的 billboards; UV 通道 2 定义了多边形的大小和运动。因此,树叶网格应该只包含树叶的四边形。

A billboards-based bush基于广告牌的灌木
The mesh of the bush灌木的网格

Animation uses UV channel 2 of an object as follows: in the UV grid, [0,1] is the pivot point for the billboard's movements, and the billboard's size can be changed by scaling the polygon in the UV channel.动画使用对象的UV通道2如下:在UV网格中,[0,1]是广告牌运动的轴心点,可以通过缩放UV通道中的多边形来改变广告牌的大小。

UV Channel 1紫外线通道 1
UV Channel 2紫外线通道 2
Mesh (above) and the result (below)网格(上)和结果(下)

Control the polygons movement via the same Animation Parameters.通过相同的控制多边形运动动画参数.

Global Animation Options全局动画选项#

Stem and leaves animation are also controlled by the global Vegetation Animation Parameters. Via these settings, you can adjust stem and leaves animation intensity, speed, and wind effect globally and control the weather conditions per world.茎叶动画也由全局控制植被动画参数.通过这些设置,您可以全局调整茎叶动画强度、速度和风效果,并控制每个世界的天气状况。

Note that the global parameters are just multipliers for the per-material animation parameters.请注意,全局参数只是每个材质动画参数的乘数。

Scattering Plants散射植物#

To randomly scatter a significant number of identical meshes across the terrain, Mesh Clutter is used. Mesh Clutter scatters objects procedurally and renders only those objects which are in the viewing frustum. The typical workflow is as follows:为了在地形上随机散布大量相同的网格,使用 Mesh ClutterMesh Clutter 按程序分散对象并仅渲染位于视锥体中的对象。典型的工作流程如下:

  1. Click Create -> Clutter -> Mesh and specify the .mesh asset to be used as the source mesh for the Mesh Clutter. Click within the viewport to place the new node in the world.单击 Create -> Clutter -> Mesh 并指定要用作 Mesh Clutter 的源网格的 .mesh 资源。在视口中单击以将新节点放置在世界中。

    注意
    .fbx assets are containers for .mesh assets, right-click on the asset and choose Open or double-click on it to access its content..fbx 资源是 .mesh 资源的容器,右键单击资源并选择 Open 或双击它以访问其内容。
  2. If you already have a configured tree in your world, you can copy all materials and parameters from surfaces of the configured tree and paste them sequentially or by surface names to Mesh Clutter.如果您的世界中已经有一个配置树,您可以从配置树的表面复制所有材质和参数并粘贴它们按顺序或按表面名称Mesh Clutter

  3. Place the node in the scene and set the Size to cover the whole playable area.将节点放置在场景中并设置 Size 以覆盖整个可玩区域。

    注意

    The operation of Mesh Clutter objects is float-based, so it is not recommended to use Sizes bigger than 10000 units lengthwise and widthwise. If you need to fill areas beyond this limit, you will need to manually split the single Mesh Clutter object into a grid of several clutters.Mesh Clutter 对象的操作是基于浮点的,所以不建议使用大于 10000 单位的 Sizes 纵向和横向。如果您需要填充超出此限制的区域,则需要手动将单个 Mesh Clutter 对象拆分为由多个杂物组成的网格。

    The Sandworm Tool does the slicing automatically when generating terrain.Sandworm 在生成地形时自动进行切片。

  4. Adjust the scattering parameters: set the desired Density in meshes per square unit; diversify the appearance of the forest by randomizing the Scale, Offset, and Rotation parameters.调整散射参数:设置所需的密度每平方单位的目数;通过随机化使森林的外观多样化缩放、偏移和旋转参数。
  5. Make the clutter object child to the terrain and enable the Intersection flag to make trees follow the surface.使杂波对象成为地形的子对象并启用路口旗帜使树木跟随水面。

    注意
    If the Intersection flag is enabled, toggle it off and on to forcefully re-generate the Clutter object.如果启用了 Intersection 标志,请将其关闭再打开以强制重新生成 Clutter 对象。
  6. Adjust the Visibility and Fade distances. Given the number of polygons that might come into play in a dense forest, it is recommended to make Mesh Clutter visible at as short distances as possible and use the Impostor objects at further distances.调整能见度褪色距离。鉴于可能在茂密的森林中发挥作用的多边形数量,建议使 Mesh Clutter 在尽可能短的距离可见,并在更远的距离使用 Impostor 对象。
  7. By default, trees are scattered across the whole area. You can mask areas with vegetation via the following approaches:默认情况下,树木散布在整个区域。你可以用植被遮盖区域通过以下方法:

    • By using a single-channel texture. You can prepare a texture in third-party software or create a new one and draw the mask from scratch. All Mesh Clutter and Grass objects that use that texture are updated on the fly.通过使用单通道纹理。您可以在第三方软件中准备纹理或创建一个新的,然后画面具从头开始。所有使用该纹理的 Mesh ClutterGrass 对象都会即时更新。

    • By using Landscape Terrain masks. You can use the data of Landscape Terrain masks to define the density of the vegetation, provided your world contains Landscape Terrain with configured masks: select the desired mask in the Mask Terrain parameter:通过使用景观地形蒙版.您可以使用 Landscape Terrain 蒙版的数据来定义植被的密度,前提是您的世界包含 Landscape Terrain 并配置了蒙版:在 Mask Terrain 参数中选择所需的蒙版:

      Landscape Terrain景观地形
      Mask preview of Landscape Terrain蒙版预览景观地形
      Vegetation is scattered according to the terrain mask植被根据地形掩码散布

      You can also edit the mask by using the Brush Editor and have the Mesh Clutter updated on the fly.您还可以使用画笔编辑器并即时更新 Mesh Clutter

      注意
      All Landscape Terrain data, including masks, is subject to data streaming. If you have unoptimized streaming settings, there might be a bottleneck in mask data loading on world startup and changing the camera position, affecting the performance of Mesh Clutter generation.所有景观地形数据,包括蒙版,均受制于数据流.如果您有未优化的流设置,则在世界启动和更改相机位置时加载掩码数据可能会出现瓶颈,从而影响 Mesh Clutter 生成的性能。
    • As an additional feature, masking by a mesh is also available:作为附加功能,用网格遮蔽也可用:

    • Cutout by intersection with objects:通过与对象相交的剪切:

      1. Create Mesh Static or Decal representing a bounding cutout volume. Enable the Clutter Interaction flag for it.创建代表边界切割体积的 Mesh StaticDecal。为它启用 Clutter Interaction 标志。
      2. Choose and enable a bit of the Intersection mask of the object that will be used for the cutout feature.选择并启用将用于剪切功能的对象的一些 Intersection 掩码。
      3. Enable the same bit of the Cutout Intersection mask of the Clutter object.启用 Clutter 对象的 Cutout Intersection 掩码的相同位。
      4. Hide the visual representation of the object from the camera by disabling all bits of its Viewport mask and disabling shadow casting for it.通过禁用其 Viewport 掩码的所有位并禁用阴影投射为了它。

      Cutting out trees within a box在盒子里砍树
  8. Keep the optimal Step value for the best performance.保持最佳 Step 值以获得最佳性能。

    The Clutter is rendered as a 2D grid, in each cell of which meshes are randomly scattered depending on the density and probability of appearing. Generation of meshes in the cells is time-sliced starting from the nearest cells to reduce the load on the CPU.Clutter 被渲染为 2D 网格,在每个单元格中,网格根据出现的密度和概率随机散布。从最近的单元开始,单元中网格的生成是时间分片的,以减少 CPU 的负载。

    Cell division细胞分裂

    The Step value defines the cell size in units. Thus, this value specifies the resulting number of cells along each axis (the size divided by the step). It is highly recommended to choose the values that are divided with no remainder.Step 值以单位定义像元大小。因此,该值指定沿每个轴生成的单元格数(大小除以步长)。强烈建议选择除以无余的值。

    注意
    Each cell requires 1 DIP call, so the higher the number of cells (i.e., the smaller the step), the more reduced the performance is. However, creating a large cell takes a longer time. When the camera moves fast enough, small cells are created one by one very fast and smoothly, but large ones can noticeably pop into sight and cause a slight rendering lag.每个cell都需要1 DIP调用,所以cell的数量越多(即step越小),性能下降越多。但是,创建大单元格需要更长的时间。当相机移动得足够快时,小单元会非常快速且流畅地逐个创建,但大单元会明显出现并导致轻微的渲染延迟。

You can scatter bushes and chunks of polygon grass across the terrain the same way.您可以以相同的方式在地形上散布灌木和多边形草块。

A chunk of optimized polygon-based grass一大块优化的基于多边形的草

Finally, by combining several clutters for different types of trees, bushes, and grass, you get a diverse look of vegetation.最后,通过为不同类型的树木、灌木和草组合多种杂物,您可以获得多样化的植被外观。

Combination of several Mesh Clutter objects for diverse vegetation多种植被的几个 Mesh Clutter 对象的组合

Manual Placement手动放置#

As a finishing touch, you can place trees as Static Mesh where needed. It is efficient performance-wise to collect a significant number of identical meshes into a Mesh Cluster object in order to treat and render a bunch of meshes as one object.作为画龙点睛的一笔,您可以在需要的地方将树放置为 Static Mesh。将大量相同的网格收集到一个 Mesh Cluster 对象中,以便将一堆网格视为一个对象并进行渲染,这在性能方面是有效的。

注意
In terms of performance optimization, Mesh Cluster objects have an advantage over Mesh Clutter objects as meshes baked into clusters support culling by Occluders, making it possible to improve performance when some geometry occludes them (e.g., a building).在性能优化方面,Mesh Cluster 对象比 Mesh Clutter 对象具有优势,因为烘焙到集群中的网格支持通过遮挡物,当某些几何图形遮挡它们(例如,建筑物)时,可以提高性能。

You can bake identical meshes of their hierarchy or collect all similar meshes in the world. Refer to the dedicated article for more details on the ways of collecting a cluster.您可以烘焙其层次结构的相同网格或收集世界上所有相似的网格。有关方法的更多详细信息,请参阅专用文章收集集群.

The other convenient approach to quickly scatter clusters of grass, bushes and trees across the scene is using the mesh placement brush tool:另一种在场景中快速散布草丛、灌木丛和树木的便捷方法是使用网格放置画笔工具:

  1. Switch to the Cluster Editor mode:切换到Cluster Editor模式:

  2. Select one or several Mesh Cluster objects in the scene or create a new one by using the Create button in the Active Tool window.在场景中选择一个或多个 Mesh Cluster 对象,或使用 Active Tool 窗口中的 Create 按钮创建一个新对象。
  3. Paint areas with brush, scattering meshes across the scene:用画笔绘制区域,在场景中散布网格:

  4. If needed, edit the cluster manually to reposition or remove some meshes.如果需要的话,编辑集群手动重新定位或删除一些网格。

BillboardsBillboards#

Billboard is a flat rectangular object that always faces the camera. Using billboards instead of fully functional objects that are barely seen from far off significantly simplifies and speeds up rendering.Billboard 是一个始终面向相机的平面矩形对象。使用 billboards 而不是从远处几乎看不到的功能齐全的对象可以显着简化并加快渲染速度。

ImpostorsImpostors#

In terms of UNIGINE, Impostor is a billboard-like object capable of mimicking the appearance of polygon meshes by displaying different areas of textures depending on the angle of view. Impostor objects serve to speed up geometry rendering by reducing the number of polygons while saving visual fidelity.就 UNIGINE 而言,Impostor 是一个类似于 billboard 的对象,能够通过根据视角显示不同区域的纹理来模仿多边形网格的外观。 Impostor 对象通过减少多边形的数量同时节省视觉保真度来加速几何渲染。

Albedo texture for a tree impostor树冒名顶替者的反照率纹理

The built-in Impostor Creator tool makes it easy to generate Impostors for single meshes and Mesh Clutters.内置的 Impostor Creator 工具可以轻松生成单个网格的 ImpostorsMesh Clutters

For a forest based on Mesh Clutter, the Grass object with the grass_impostor_base material will be used as a low-poly LOD. At that, the Clutter and grass parameters must match to make sure the position and orientation of all LODs are the same.对于基于 Mesh Clutter 的森林,具有 grass_impostor_base 材质的 Grass 对象将用作低多边形 LOD。那时, Clutter和草参数必须匹配以确保所有 LOD 的位置和方向相同。

Mesh Clutter and Impostors网格混乱和冒名顶替者
Meshes' and Impostors' Wireframes网格和冒名顶替者的线框

Grass objects are also rendered as a 2D grid to optimize performance. The Step parameter defines the cell size. Usually, impostors are visible much further than meshes, and the Step value is to be chosen respectively. You can use the Subdivision parameter that subdivides large grass cells so that they match smaller cells of a Mesh Clutter to make positions of randomly scattered objects coincide with positions of grass-based impostors. Therefore, the Clutter Step must match the ratio of Step/Subdivision values of the grass.草对象也被渲染为 2D 网格以优化性能。 Step 参数定义像元大小。通常,冒名顶替者比网格更远可见,并且要分别选择 Step 值。您可以使用细分大草细胞的 Subdivision 参数,使它们与 Mesh Clutter 的较小细胞相匹配,以使随机散布对象的位置与基于草的冒名顶替者的位置一致。因此,杂波 Step 必须与草的 Step/Subdivision 值的比率相匹配。

Grass#

The Grass object with the grass_base material can fill empty spots on the terrain and increase the overall density of lower vegetation in the scene. The grass_base material is intended to represent the basic features of grass. It has a lower visual fidelity compared to the mesh_base material, so Grass should be thought of as an additional filling layer of grass.具有 grass_base 材质的 Grass 对象可以填充地形上的空白点,并增加场景中较低植被的整体密度。 grass_base 材质旨在代表草的基本特征。与 mesh_base 材质相比,它的视觉保真度较低,因此应将 Grass 视为草的额外填充层。

First, you need to prepare a Diffuse texture with chunks representing small grass tufts:首先,您需要准备一个 Diffuse 纹理,其中的块代表小草丛:

Diffuse Texture for Grass of Various Types各种草的漫反射纹理

Chunks are to be placed in the texture as follows:块将按如下方式放置在纹理中:

  • Vertical columns represent different grass species, each of which will be distributed according to the corresponding channel of the Mask texture. Therefore, the number of columns must match the number of channels of the Mask texture; otherwise, grass tufts will be sliced incorrectly.垂直的柱子代表不同的草种,每一个都会根据 Mask 纹理的对应通道进行分布。因此,列数必须与Mask纹理的通道数相匹配;否则,草丛将被错误地切割。
  • Horizontal rows represent variations of grass of the particular species (thinner, thicker, tangled, etc.). There can be from 1 to 4 rows, and this number must coincide with the Num Textures value.水平行表示特定物种的草的变化(更薄、更厚、缠结等)。可以有从 14 行,并且这个数字必须与 Num Textures 值一致。

For the grass texture with 4 columns, a mask with 4 channels should be used:对于具有 4 列的草纹理,应使用具有 4 个通道的遮罩:

RGBA Image Mask for Grass of 4 Various TypesRGBA 4种不同类型草的图像蒙版

Refer to the Texture Slots section for more details.有关详细信息,请参阅 Texture Slots 部分。

Visually attractive grass, however, may reduce performance if rendered as a whole. All computations are time-sliced and performed per cell of a 2D grid to allow rendering at interactive frame rates. So choosing the optimal Step for cells is crucial for better performance.但是,如果将草作为一个整体进行渲染,则具有视觉吸引力的草可能会降低性能。所有计算都是时间切片的,并按 2D 网格的每个单元执行,以允许以交互式帧速率进行渲染。因此,为细胞选择最佳的 Step 对于更好的性能至关重要。

For more details on creating and configuring grass, refer to the in-depth tutorial: Adding Grass.有关创建和配置草的更多详细信息,请参阅深入教程:添加草.

See Also也可以看看#

最新更新: 2023-06-23
Build: ()