This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

地形优化

Landscape Terrain Optimization
景观地形优化#

Performance of the Landscape Terrain depends on the data streaming that lies behind its operation: only graphic data of areas that are visible by the camera at a moment is loaded and destroyed when it is no longer needed. Unoptimized streaming settings cause noticeable loading of areas when the camera moves.Landscape Terrain 的性能取决于其操作背后的数据流:仅在不再需要时加载和销毁相机此刻可见区域的图形数据。未优化的流媒体设置会在相机移动时导致明显的区域加载。

Visible streaming issues.可见的流媒体问题。

The overall life cycle of graphic data can be thought of as follows:图形数据的整体生命周期可以这样想:

  1. The system determines the tiles that are currently visible in the viewport, their spatial size and their highest available mip-level depending on the distance, terrain density limits and streaming settings.系统根据距离、地形密度限制和流设置确定当前在视口中可见的图块、它们的空间大小和最高可用 mip 级别。
  2. The required graphic data of requested tiles of base textures is loaded from .lmap assets in chunks of 128×128 pixels and cached in the RAM (CPU cache) to be used in intersection calculations and physics.请求的基础纹理图块所需的图形数据从 .lmap 资源以128×128 像素的块加载,并缓存在 RAM(CPU 缓存)中,以用于相交计算和物理。
  3. The acquired data is uploaded to the GPU and cached in the video memory, if necessary (GPU cache).获取的数据会上传到 GPU 并在必要时缓存在视频内存中(GPU 缓存)。
  4. The data of several Landscape Layer Maps (Albedo, Height and Mask textures) is blended according to the Blending Settings.几个 Landscape Layer MapsAlbedo, HeightMask 纹理)的数据根据混合设置.
  5. The base textures are blended with textures of the details (if any).基础纹理与细节(如果有的话)。
  6. The final textures for each of three Landscape Terrain components (Albedo, Normal and Height) are written into the Virtual Texture replacing the oldest chunks.三个 Landscape Terrain 组件(Albedo, NormalHeight)中每一个的最终纹理都被写入虚拟纹理中,替换最旧的块。
  7. The result is rendered in the viewport with due regard for Adaptive Hardware Tessellation and displacement.结果在视口中渲染,并适当考虑了自适应硬件细分和置换。
  8. The textures are replaced by newer data in the cache when no longer needed.当不再需要时,纹理会被缓存中的较新数据替换。

The life cycle of Landscape Terrain graphic data.Landscape Terrain 图形数据的生命周期。

Profiling
剖析#

The camera behavior in a project that utilizes a Landscape Terrain object plays an important role. A static camera implies a single load of data, provided all textures fit in the video memory. When the active camera significantly changes its position and orientation while unveiling unloaded areas, streaming may hit hard on performance. Therefore, performance and memory consumption should be considered and tuned for the final set of cameras and screen resolution of the target platform.使用 Landscape Terrain 对象的项目中的相机行为起着重要作用。如果所有纹理都适合视频内存,则静态相机意味着单个数据加载。当活动相机显着改变其位置和方向,同时揭示未加载区域时,流式传输可能会严重影响性能。因此,应根据目标平台的最终相机集和屏幕分辨率来考虑和调整性能和内存消耗。

For convenient profiling, you can animate the camera movement via Tracker and run animations for tests.为了方便分析,您可以通过 Tracker 为相机移动设置动画并运行动画进行测试。

It is recommended to use the Microprofile tool for detailed in-depth estimation for the performance of a Landscape Terrain object.建议使用 Microprofile 工具对 Landscape Terrain 对象的性能进行详细深入的估计。

Stages of Landscape Terrain operation in the output of the Microprofile tool.Microprofile 工具输出中的 Landscape Terrain 操作阶段。

By using the Rendering Performance Profiler, you can estimate the memory consumption.通过使用 Rendering Performance Profiler,您可以估计内存消耗。

Landscape Terrain-related section of the Rendering Performance Profiler output.Rendering Performance Profiler 输出的 Landscape Terrain 相关部分。

Hardware Recommendations
硬件建议#

Streaming implies continuous data loading from disk storage. If your project requires a highly-detailed landscape of large size (several kilometers across), it is recommended to consider using an SSD as slower HDDs may not be capable of providing enough throughput capacity.流式传输意味着从磁盘存储连续加载数据。如果您的项目需要大尺寸(数公里宽)的高度详细景观,建议考虑使用 SSD,因为较慢的 HDD 可能无法提供足够的吞吐能力。

At that, multi-core processors have an advantage here enabling you to distribute the load without bottlenecks.在那一点上,多核处理器在这里有一个优势,可以让您在没有瓶颈的情况下分配负载。

Landscape Layers
景观层#

The number and density of different Landscape Layer Maps that define the look of the terrain at the current moment is an important factor — multiple blended layers with high resolution textures might make a significant performance drop. In most cases it is reasonable to combine multiple textures into a single one in a raster graphics editor.定义当前地形外观的不同 Landscape Layer Maps 的数量和密度是一个重要因素——具有高分辨率纹理的多个混合层可能会导致性能显着下降。在大多数情况下,在光栅图形编辑器中将多个纹理组合成一个是合理的。

注意
In contrast, you can use several Landscape Layer Maps that refer to the same .lmap asset without performance drop. You can create a Node Reference containing a Landscape Layer Map to propagate repetitive areas.相反,您可以使用多个引用相同 .lmap 资源的 Landscape Layer Maps,而不会降低性能。您可以创建一个包含 Landscape Layer MapNode Reference 来传播重复区域。

The Current Data Density value for a Landscape Layer Map is calculated based on its spatial size and the resolution of base textures used. It's hard to miss that a decent high-detailed landscape would require a texture tileset of an extremely large resolution.Landscape Layer MapCurrent Data Density 值是根据其空间大小和使用的基础纹理的分辨率计算的。很难错过一个像样的高细节景观需要一个非常大分辨率的纹理图块集。

最佳实践
Use base textures of Landscape Layer Maps to create a coarse look of the Landscape Terrain and refine the surface using details for high-detailed per-pixel quality.使用 Landscape Layer Maps 的基础纹理创建 Landscape Terrain 的粗糙外观并使用细节以获得高细节的每像素质量。

Also, the visibility of layers is taken into account — if a large Landscape Layer Map overlaps other layers (has a higher Order value), only its graphic data will be loaded and rendered.此外,还考虑了图层的可见性——如果大的 Landscape Layer Map 与其他图层重叠(具有更高的 Order 值),则只会加载和渲染其图形数据。

A schematic representation of several Landscape Layer Maps overlapping each other.
The one with the higher Order value overlaps the other ones and only its data will be loaded and visualized.
几个 Landscape Layer Maps 相互重叠的示意图。
Order 值较高的那个与其他的重叠,只有它的数据会被加载和可视化。

Streaming is based on using previously loaded geometry to define the visible areas of terrain. There is no loaded geometry at the very world startup, so the system looks for a Landscape Layer Map that has the Culling flag enabled and loads preliminary low-level data of this layer. If your world contains several layers, one of which represents the basic shape of the terrain, while others are used as insets placed within the bounds of the base layer and having an insignificant height difference from it, it is recommended for you to disable Culling for insets and enable it for the base layer. This is how you can reduce load on CPU at the world startup.流式传输基于使用先前加载的几何图形来定义地形的可见区域。在世界启动时没有加载几何体,因此系统会查找启用了 Culling 标志的 Landscape Layer Map 并加载该层的初步低级数据。如果您的世界包含多个图层,其中一个代表地形的基本形状,而其他用作放置在基本图层边界内的插图,并且与它的高度差很小,建议您禁用 Culling插入并为基础层启用它。这是在世界启动时减少 CPU 负载的方法。

Tiles Loading
瓷砖加载#

Each frame the Landscape Terrain system checks which tiles are to loaded and updated. Increase the Tiles Update Per Frame parameter to ensure that all necessary tiles are updated on time. However, if this value is too big, it may cause a performance drop during data streaming.Landscape Terrain 系统每帧都会检查要加载和更新哪些图块。增加 Tiles Update Per Frame 参数以确保按时更新所有必要的图块。但是,如果这个值太大,可能会导致数据流时性能下降。

The loading speed of chunks of graphic data depends on the Tiles Load Per Frame value. Higher values imply faster multi-threaded loading of tiles but more performance-consuming data streaming. Note that it is pointless to set this value higher than the Tiles Update Per Frame.图形数据块的加载速度取决于 Tiles Load Per Frame 值。较高的值意味着更快的多线程切片加载,但更消耗性能的数据流。请注意,将此值设置为高于 Tiles Update Per Frame 是没有意义的。

Thus, it is necessary to find a trade-off when tweaking these parameters.因此,在调整这些参数时有必要进行权衡。

Use the Landscape Terrain VT Streaming helper (or the render_show_landscape_terrain_vt_streaming 1 console command) to enable visualization of tiles being streamed. In this mode colored areas show the tiles that are currently being rendered in a lower resolution until the highest mip-level is loaded and rendered. The faster the colored tiles disappear, the better.使用 Landscape Terrain VT Streaming 帮助程序(或 render_show_landscape_terrain_vt_streaming 1 控制台命令)启用正在流式传输的切片的可视化。在此模式下,彩色区域显示当前以较低分辨率渲染的图块,直到加载和渲染最高 mip 级别。彩色瓷砖消失得越快越好。

The Landscape Terrain VT Streaming helperLandscape Terrain VT Streaming 助手

Cache
缓存#

The default values of the Cache settings are suitable for the most cases.Cache 设置的默认值适用于大多数情况。

If you modify a layer map by using Brush Editor or your project implies run-time terrain modification, increase the GPU Cache Size limit and GPU Cache Life Time for better performance.如果您使用修改图层图画笔编辑器或者您的项目意味着运行时地形修改,增加 GPU Cache Size 限制和 GPU Cache Life Time 以获得更好的性能。

When it comes to optimizing intersection and collision detection performed on the CPU side, increase the CPU Cache Size for better performance.在优化 CPU 端执行的交叉和碰撞检测时,增加 CPU Cache Size 以获得更好的性能。

Run-Time Modification
运行时修改#

When something changes a loaded area of the Landscape Terrain, the affected tiles are to be restreamed with the changes taken into account.当某些东西改变了 Landscape Terrain 的加载区域时,受影响的图块将在考虑到这些变化的情况下重新流式传输。

Increase the Tiles Reload Per Frame parameter—the number of reloaded tiles per each frame—to make the changes be committed faster.增加 Tiles Reload Per Frame 参数(每帧重新加载的切片数)以更快地提交更改。

However, be careful not to exceed the bandwidth of the system with too many tiles reloaded at the same time; otherwise, the performance may drop a lot. It is therefore very important to monitor the streaming settings and dynamics of layers and avoid per-frame changes of large areas that cause many tiles to reload.但是,请注意不要超过系统的带宽,同时重新加载过多的图块;否则,性能可能会下降很多。因此,监控层的流设置和动态并避免导致许多图块重新加载的大区域的每帧更改非常重要。

For more details, please refer to the Make It Run-Time section.更多详情,请参阅使其运行时部分。

Details
细节#

The Landscape Terrain enables you to add up to 1024 details to a mask making it possible to create a pretty detailed and diverse look of the landscape. In terms of optimization, minimizing the number of details and textures is a way to faster rendering.Landscape Terrain 使您最多可以添加1024细节一个面具,可以创建一个非常详细和多样化的景观外观。在优化方面,尽量减少细节和纹理的数量是加快渲染速度的一种方式。

The textures of details are loaded at the world startup and kept in the video memory to be blended with the base textures of the Landscape Terrain when rendering. You can specify a lower resolution for the corresponding textures of all detail materials by tweaking the following parameters:细节纹理在世界启动时加载并保存在显存中,以便在渲染时与地形地形的基础纹理混合。您可以通过调整以下参数为所有细节材质的相应纹理指定较低的分辨率:

Virtual Texture
虚拟纹理#

The final textures for tiles of the Landscape Terrain are written to the Virtual Texture components (Albedo, Normal and Height). Increase the Texture Memory Size value to ensure that the Virtual Texture provides enough capacity to store the loaded high-detail texture chunks.Landscape Terrain 的瓦片的最终纹理被写入虚拟纹理组件(Albedo, NormalHeight)。增加 Texture Memory Size 值以确保虚拟纹理提供足够的容量来存储加载的高细节纹理块。

The components of the Landscape Terrain Virtual Texture.Landscape Terrain 虚拟纹理的组件。

With a lower size the Virtual Texture requires less video memory but doesn't provide enough capacity to store all the required data resulting in poor performance, low detail level and fast flickering of the Landscape Terrain surface due to continuous reloading of tiles.由于尺寸较小,虚拟纹理需要较少的视频内存,但无法提供足够的容量来存储所有需要的数据,从而导致性能不佳、细节水平低以及由于连续重新加载瓷砖而导致景观地形表面快速闪烁。

Rendering
渲染#

Polygons of the Landscape Terrain surface are adaptively tessellated on the fly and displaced based on the Heightmap component of the Virtual Texture. The polygon mesh is split up to multiple levels of detail of various density depending on the distance from the camera. The Geometry settings provide much room for rendering optimization.Landscape Terrain 表面的多边形会根据虚拟纹理的高度图组件在运行中自适应地细分并移位。根据与相机的距离,多边形网格被分成不同密度的多个细节层次。 Geometry 设置为渲染优化提供了很大的空间。

Levels of Detail of tessellated geometry.镶嵌几何体的细节层次。

Pay attention to the following parameters:注意以下参数:

  • With lower values of Geometry Progression less polygons are generated at a distance.使用较低的 Geometry Progression 值,在远处生成的多边形更少。
  • By configuring the Geometry Polygon Size parameter you can define the minimum spatial size of polygons in case of excessive detail level.通过配置 Geometry Polygon Size 参数,您可以在细节级别过高的情况下定义多边形的最小空间大小。
  • Geometry Subpixel Reduction parameter determines the minimum ratio of polygon size (in the screen space) to the area seen in the viewport. This parameter enables you to quickly decrease the number of polygons or simply remove too small polygons that are barely visible, in order to increase performance.Geometry Subpixel Reduction 参数确定多边形大小(在屏幕空间中)与在视口中看到的区域的最小比率。此参数使您能够快速减少多边形数量或简单地删除几乎不可见的太小多边形,以提高性能。
  • Set a lower Visibility Distance to discard rendering of too remote polygons.设置较低的 Visibility Distance 以放弃渲染太远的多边形。

You can decrease the maximum allowed level of detail for the albedo, normal and height textures of the Landscape Terrain by increasing the Texel Size parameter. 您可以通过增加 Texel Size 参数来降低 Landscape Terrain 的反照率、法线和高度纹理的最大允许细节级别。

Decrease Target Resolution—the resolution of the screen buffer for the Landscape Terrain renderer—to gain more performance at a cost of visual quality.降低 Target Resolution(Landscape Terrain 渲染器的屏幕缓冲区的分辨率)以牺牲视觉质量来获得更高的性能。

You can also reduce the detail level of polygons facing the camera at oblique viewing angles (Detail Level By Angle) to optimize streaming load and memory consumption.您还可以降低以倾斜视角 (Detail Level By Angle) 面向相机的多边形的细节级别,以优化流加载和内存消耗。

Different mip-levels of landscape textures are used at different distances. Switch to the Low or Medium Texture Filtering quality to improve performance at a cost of a slightly visible edge between adjacent mipmap levels.在不同的距离处使用不同的 mip 级别的景观纹理。切换到 LowMedium Texture Filtering 质量以提高性能,但代价是相邻 mipmap 级别之间的边缘略微可见。

Culling Optimization
剔除优化#

The polygons of the Landscape Terrain surface are subject to frustum culling optimization. If a polygon falls out of the camera frustum (i.e. its screen position is outside the viewport bounds), it is culled out for rendering. You can enable the Aggressive Frustum Culling mode that implies more strict requirements for polygons to be rendered and, therefore, higher performance.Landscape Terrain 表面的多边形经过平截头体剔除优化。如果一个多边形掉出相机平截头体(即它的屏幕位置在视口边界之外),它会被剔除以进行渲染。您可以启用 Aggressive Frustum Culling 模式,这意味着对要渲染的多边形有更严格的要求,因此性能更高。

Tweak the Culling settings for more optimizations:调整 Culling 设置以获得更多优化:

Global Terrain Optimization
全局地形优化#

The terrain_global_base material provides several parameters for fine tuning of terrain geometry optimization, shadows and LOD blending:terrain_global_base 材质为微调地形几何优化、阴影和 LOD 混合提供了几个参数:

  • Subpixel Polygons Reduction parameter determines the minimum ratio of polygon size (in the screen space) to the area seen in the viewport. This parameter allows you to remove too small polygons that are barely visible, in order to increase performance.Subpixel Polygons Reduction 参数确定多边形大小(在屏幕空间中)与在视口中看到的区域的最小比率。此参数允许您删除几乎不可见的太小多边形,以提高性能。
  • Back Face Culling parameter is used for culling of the tessellation patches that have their back faces turned to the camera. The number of polygons can be significantly reduced (e.g. culling back faces of a large mountain) and increase performance.Back Face Culling 参数用于剔除背面转向相机的曲面细分补丁。可以显着减少多边形的数量(例如剔除大山的背面)并提高性能。
  • Frustum Culling Padding parameter is used to control culling of the tessellation patches outside the viewing frustum.Frustum Culling Padding 参数用于控制对视锥体之外的细分面片的剔除。
  • Shadow Offset parameter enables to adjust the look of shadows in cases low-poly LODs cast shadows on high poly LODs in areas, where there should be no shadows should.Shadow Offset 参数可以调整阴影的外观,以防低多边形 LOD 在不应该有阴影的区域在高多边形 LOD 上投射阴影。
  • LOD Padding parameter can be used to adjust smooth transitions between terrain LODs and increase performance.LOD Padding 参数可用于调整地形 LOD 之间的平滑过渡并提高性能。

In case if your terrain does not require insets, you can disable this option to increase performance. To do so, just uncheck the Use Insets in the States tab.如果您的地形不需要插图,您可以禁用此选项以提高性能。为此,只需取消选中 States 选项卡中的 Use Insets

Also you can use frustum culling optimization to affect performance: enable the Fast Frustum Culling option in the States tab. This option increases the number of culled polygons.您也可以使用截锥体剔除优化来影响性能:在 States 选项卡中启用 Fast Frustum Culling 选项。此选项会增加剔除多边形的数量。

最新更新: 2024-12-13
Build: ()