可可西

UE4地形系统(Landscape)

地形Landscape) 系统使您能够为您的世界场景创建地形 - 山脉、山谷、起伏或倾斜的地面,甚至洞穴的开口(Sculpt 模式中选择 Visibility 工具)。并通过使用一系列工具轻松修改地形的形状和外观。

 

概述

 

一个关卡中可以有多个地形Actor对象(ALandscape)。

一个场景世界中只有一个小工具Actor对象(ALandscapeGizmoActiveActor),用于编辑时的地形的拷贝。

 

通过obj list class=Actor -alphasort命令查看场景中Landscape个数和大小

 

地形结构组成

边框颜色

地形单元

包含

黄色

地形Actor边缘

包括2x2个Components

浅绿色

组件(Component)边缘

① 对应ULandscapeComponent类型

② 是裁剪、渲染及碰撞检测的基本单元

③ 每个组件(Component)都会创建一个FPrimitiveSceneProxy

④ 地形顶点信息保存在成员变量UTexture2D* HeightmapTexture中

包括2x2个Sections

中绿色

分段(Section)边缘

Section是LOD的基本单位

包含7x7个Quads

深绿色

四边形(Quad)

Quad是地表最小构成单元,由两个三角形组成

每个Quad被缩放100倍,即长宽为100uu(虚幻单位),为1m

 

更多信息请参考:地形技术指南创建地形创建和使用自定义高度图和图层

 

LOD

地形的LOD级数 = Section中log2(x方向Quad个数+1)

 

滚轮缩放时,网格的插值情况:

 

创建地形

点击Create按钮创建地形

注:7条鲜绿的横线和7条鲜绿的竖线将地块划分成8x8个Components

 

 

去掉Component之间的缝隙印记

方法①:将场景中的Directional Light设为Movable后,再设回Stationary

方法②:执行Build Lighting Only

 

 

 

地形系统有三种模式:Manage(管理模式)、Sculpt(塑形模式)Paint(绘制模式)

 

 

Manage(管理模式)

用Select工具来选择地块

点击地块即可选中所在的Component,按Shift键点击则会取消Component的选择

注1:Brush Size为1表示选择面积为1个Component大小

注2:点击Clear Component Selection按钮,可取消掉所有选中的地块

 

用Add工具来添加地块

点击地块即可在绿色方块光标处添加Component。绿色方块光标的大小即为Brush Size指定的值。

注:Brush Size为1表示选择面积为1个Component大小

 

用Delete工具来删除地块

点击地块即可将橙色实心方块光标处的Component删除。橙色实心方块光标的大小即为Brush Size指定的值。

注:Brush Size为1表示选择面积为1个Component大小

 

用Move工具将点中的地块移动到当前关卡中

 

查看Persistent Level关卡中的地块

 

查看LandScapeLevel关卡中的地块

 

用Resize工具来调整地形的所有地块

① Expand模式

 

 

② Clip模式

 

 

③ Resample模式

 

 

地形样条线

Ctrl键,在地形上点击来添加样条线控制点

注:勾选Use Auto Rotate Control Point(使用自动旋转控制点),释放光标后样条点会自动旋转,使样条保持平滑。更多信息参见:地形样条线

 

更多快捷键:

鼠标左键 选择控制点或分段。
Shift+鼠标左键 选择多个控制点或分段。
Ctrl+A 选择所有连接到当前选定控制点的控制点和/或所有连接到当前选定分段的分段。
Ctrl+鼠标左键

① 添加新控制点,并自动连接到任何选定的控制点。

② 在选定一个或多个控制点的情况下,创建分段将所有选定的控制点连接到新的控制点。

③ 在选定一个分段的情况下,在该点拆分分段并插入新的控制点。

ALT+鼠标左键拖动

① 在选定一个控制点的情况下,添加新控制点并将它朝拖动方向平移。

② 在拖动穿过现有分段时拆分路径。

③ 在从样条任一端拖开时添加新分段。

Delete 删除选定的控制点或分段。
R 自动计算选定样条控制点的旋转。
T 自动翻转选定控制点/分段的切线。
F 翻转选定的样条分段(仅影响样条上的网格体)。
End 将选定控制点对齐到下方的地形。

 

 

选中某个控制点来调整位置

 

 

 

 

选中一个样条控制点,然后在Details面板中点击Segments来选中整个样条,然后在Landscape Spline Meshes中为整个样条添加StaticMesh资源

 

 

Sculpt(塑形模式)

 

常用快捷键

鼠标左键 通过笔划将所选工具的效果叠加应用至高度图。
鼠标左键+Shift 通过笔划将所选工具的效果删减应用至高度图。
Ctrl+Z 撤销。
Ctrl+Y 重做。

 

属性说明

属性

说明

Tool Strength(笔刷强度,绿框中)

决定使用造型工具时升高或降低的量。

Brush Size(笔刷尺寸,篮框中)

决定着笔刷的尺寸(为320个虚幻单位)

Brush Falloff(笔刷衰减,白框中)

决定了衰减开始处笔刷范围的百分比。本质上来说,它决定着笔刷边缘的硬度。

0.0的衰减意味着笔刷拥有硬边,整体皆拥有完整的效果。1.0的衰减意味着笔刷只在中心拥有完整效果,效果将从其所在的整个区域到边缘逐渐减弱。

Use Clay Brush(使用泥浆笔刷)

可以用一种有机的、叠加的方法雕刻地形

 

笔刷形状

形状 Circle(圆形) Alpha(透明度) Pattern(图案) Component(组件)
设置项

 

 



Circle(圆形)形状画刷周围衰减

类型 Smooth(平滑) Linear(线性) Spherical(球形) Tip(尖端)
呈现效果

更多请参考:地形笔刷

 

塑形工具

工具 说明
造型(Sculpt) 以当前选中笔刷和衰减的形状升高和降低地形高度图的高度。
平滑(Smooth) 能够柔化高度图绘制值,消除使用造型或侵蚀工具后有时会出现的锯齿穿帮,使地形的外观平滑流畅。
平整(Flatten) 将把高度图的所有部分推拉至鼠标之下的水平线上。 这样便可将周围的高度图数值升高或降低到相同的数值。
斜坡(Ramp) 可在地形上选择两个位置并在两个点之间创建一个平板斜坡,并在侧边指定衰减。
侵蚀(Erosion) 利用热力侵蚀模拟调整地形高度图的高度。它模拟土壤被自然力量从高处移动向低处的效果。 高低落差越大,产生的侵蚀效果越强。该工具还可在侵蚀上应用 noise 效果,呈现出自然真实的随机外貌。
水力侵蚀(Hydro Erosion) 利用水力侵蚀模拟(由水流形成的侵蚀)调整地形高度图的高度。Noise 过滤器用于决定模拟中初始降雨的出现位置。 计算出的模拟将确定初始降雨的水流,以及消融、水流迁移和蒸发。 计算结果将产生实际用于降低高度图的数值。
噪点(Noise) 应用一个噪点过滤器,在地形高度图表面生成各种变化效果。
拓扑(Retopologize) 通过 X/Y 偏移贴图自动调整地形顶点,改善所需区域中的顶点密度(如陡峭悬崖)。它将顶点分散到这些密度较低的区域中, 从而减少这类区域中的纹理拉伸。
可视性(Visibility) 用于在地形部分上如洞穴之类的区域进行遮罩(创建洞窟)。
蓝图笔刷(Blueprint)

提供了一套用户自定义造型笔刷堆栈,其支持非破坏性操纵。因此,若堆栈中的低层笔刷若发生变化,变化也将自动流到堆栈上方的笔刷上。

该笔刷可用于将多个地形操纵彼此叠加,同时让各个操纵相互分离,必要时用户可以围绕地形重新排列或移动地形操纵。

镜像(Mirror) 可沿 X 轴或 Y 轴镜像或旋转现有的地形高度图几何体。

 

使用编辑层(Edit Layers)来管理塑形修改

首先在创建地形时,需要勾选Enable Edit Layers,以层编辑模式来创建

 

创建地形之后,就可以在如下Edit Layers中用Layer来管理对地形的修改了

 

创建并选中RampLayer编辑层,然后选择Ramp工具,在场景中点击来添加控制点,选中控制点来调整位置

 

点击Add Ramp来修改地形

 

隐藏SculptLayer编辑层后,之前所做的修改没有应用到地形上(地形变平了)

 

区域选择

注:点击Clear Region Selection可以取消所有区域选择    更多信息请参考:区域选择

 

区域拷贝与粘贴

点击Fit Gizmo to Selected Regions,可快速将Gizmo移动到选择区域

注:可自由拖动Gizmo到目标位置

 

点击Copy Data to Gizmo按钮,来拷贝Gizmo所在的地形数据

 

拖放Gizmo选择Cube到新的位置之后,按Ctrl + V来粘贴

 

得到最终的结果:

 

更多信息请参考:复制与粘贴区域地形小工具

 

Paint(绘制模式)

常用快捷键

鼠标左键 将选中Layer的颜色应用到地形。
鼠标左键+Shift 将擦除应用到地形特定部分的选中材质。
Ctrl+Z 撤销。
Ctrl+Y 重做。

 

属性说明

下面属性的含义与Sculpt模式是一致的:

①  Tool Strength(笔刷强度)、Brush Size(笔刷尺寸)、Brush Falloff(笔刷衰减)、笔刷形状【Circle(圆形)、Alpha(透明度)、Pattern(图案)和Component(组件)】

② Circle(圆形)形状画刷周围衰减【Smooth(平滑)、Linear(线性)、Spherical(球形)和Tip(尖端)】的含义同Sculpt(塑形模式)中一样。

更多信息请查看:绘制模式

 

绘制工具

工具 说明
绘制(Paint) 以当前选定的笔刷和衰减的形式,增加或减少应用于地形的材质图层的权重。
平滑(Smooth) 平滑受其影响的地形范围内的图层权重。强度决定平滑量。
平整(Flatten) 将选定图层的权重设置为 工具强度(Tool Strength) 滑块的值。
噪点(Noise) 将噪点滤波器应用于图层权重。强度决定噪点量。
蓝图笔刷(Blueprint) 提供了一套用户自定义绘制笔刷

 

地形材质节点

地形材质也是一个普通的材质球。只是在材质中使用了一些地形节点的功能。这些节点如下:

更多请查看:地形材质

 

制作带颜色的地形材质

创建一个材质,然后在LandscapeLayerBlend节点上新建如下4个Layer(Grass、Flower、Rock、Ground),并分别为它们赋不同的颜色值

 

为地形设置材质

 

为地形层创建LayerInfo文件

注1:地形材质(Landscape Material )中定义的图层将自动在地形工具的 绘制(Paint) 模式下填充 目标图层(Target Layers) 列表中。

注2:地形图层决定纹理(或材质)如何应用于地形Actor。地形可以使用多个具有不同纹理的图层来创建最终的纹理地形。

 

注:选择保存LayerInfo文件的目录,然后点击OK按钮。

 

用选择的地形图层进行绘制

 

制作带纹理的地形材质

 

制作带植被的地形材质

创建LandScape Grass Type资产

 

设置LandScape Grass Type资产的StaticMesh

 

在地形材质中添加LandscapeGrassOutput结点和LandscapeLayerSample结点,并配置LandScape Grass Type资产

 

带颜色的材质效果

 

带纹理的材质效果

 

带植被的材质效果

 

孤立图层

如果一个图层在填充了一个地形的 目标图层(Target Layers) 列表后被从地形材质中移除,并且它已经在此地形上绘制了数据,那么它在此列表中将显示一个 ? 图标。这表示一个孤立图层。

 

控制台命令

grass.CullDistanceScale Multiplier on all grass cull distances.
grass.CullSubsections 1: Cull each foliage component; 0: Cull only based on the landscape component.
grass.densityScale Multiplier on all grass densities.
grass.DisableDynamicShadows 0: Dynamic shadows from grass follow the grass type bCastDynamicShadow flag; 1: Dynamic shadows are disabled for all grass
grass.DisableGPUCull For debugging. Set this to zero to see where the grass is generated. Useful for tweaking the guard bands.
grass.DiscardDataOnLoad 1: Discard grass data on load (disables grass); 0: Keep grass data (requires reloading level)
grass.DumpExclusionBoxes Print the exclusion boxes, debugging.
grass.Enable 1: Enable Grass; 0: Disable Grass
grass.FlushCache Flush the grass cache, debugging.
grass.FlushCachePIE Flush the grass cache, debugging.
grass.GuardBandDiscardMultiplier Used to control discarding in the grass system. Approximate range, 1-4. Multiplied by the cull distance to control when we discard grass components.
grass.GuardBandMultiplier Used to control discarding in the grass system. Approximate range, 1-4. Multiplied by the cull distance to control when we add grass components.
grass.IgnoreExcludeBoxes For debugging. Ignores any exclusion boxes.
grass.MaxAsyncTasks Used to control the number of hierarchical components created at a time.
grass.MaxCreatePerFrame Maximum number of Grass components to create per frame
grass.MaxInstancesPerComponent Used to control the number of hierarchical components created. More can be more efficient, but can be hitchy as new components come into range
grass.MinFramesToKeepGrass Minimum number of frames before cached grass can be discarded; used to prevent thrashing.
grass.MinTimeToKeepGrass Minimum number of seconds before cached grass can be discarded; used to prevent thrashing.
grass.PrerenderGrassmaps 1: Pre-render grass maps for all components in the editor; 0: Generate grass maps on demand while moving through the editor
grass.TickInterval Number of frames between grass ticks.
grass.UseHaltonDistribution Used to control the distribution of grass instances. If non-zero, use a halton sequence.
grass.UseStreamingManagerForCameras 1: Use Streaming Manager; 0: Use ViewLocationsRenderedLastFrame
landscape.BrushFramePadding The number of frames to wait before pushing a full Landscape update when a brush is calling RequestLandscapeUpdate
landscape.BrushOptim This will enable landscape layers optim.
Landscape.ClearDirty Clears all Landscape Dirty Debug Data
Landscape.Combine Set landscape component combining mode : 0 = Default, 1 = Combine All, 2 = Disabled
Landscape.DebugViewMode Change the view mode of the landscape rendering. Valid Input: 0 = Normal, 2 = DebugLayer, 3 = LayerDensity, 4 = LayerUsage, 5 = LOD Distribution, 6 = WireframeOnTop, 7 = LayerContribution
Landscape.DumpLODs Will dump the current status of LOD value and current texture streaming status
Landscape.FixSplines One off fix for bad layer width
landscape.Optim This will enable landscape layers optim.
landscape.OutputDiffBitmap This will save images for readback textures that have changed in the last layer blend phase. (= 1 Heightmap Diff, = 2 Weightmap Diff, = 3 All Diffs
landscape.OutputLayersDebugDrawCallName This will output the name of each draw call for Scope Draw call event. This will allow readable draw call info through RenderDoc, for example.
landscape.OutputLayersRTContent This will output the content of render target. This is used for debugging only.
landscape.OutputLayersWeightmapsRTContent This will output the content of render target used for weightmap. This is used for debugging only.
Landscape.Patches Show/hide Landscape patches
Landscape.ShadowMapWorldUnitsToTexelFactor Used to specify tolerance factor for mesh size related to cascade shadow resolution
landscape.ShowDirty This will highlight the data that as changed during the layer blend phase.
landscape.SimulatePhysics This will enable physic simulation on worlds containing landscape.
landscape.SplineFalloffModulation Enable Texture Modulation fo Spline Layer Falloff.
Landscape.Static Enable/disable Landscape static drawlists
landscape.TrackDirty This will track the accumulation of data changes during the layer blend phase.
r.LandscapeLOD0DistributionScale Multiplier for the landscape LOD0DistributionSetting property
r.LandscapeLODBias LOD bias for landscape/terrain meshes.
r.LandscapeLODDistributionScale Multiplier for the landscape LODDistributionSetting property
r.Mobile.CompressLandscapeWeightMaps Whether to compress the terrain weight maps for mobile.
r.Mobile.LandscapeHoleMesh Set to 0 to skip loading of landscape hole meshes on mobile.

 

扩展阅读

视频:A Boy & His Kite: An Animated Short | Unreal Engine        marketplace

草地工具快速入门 

程序化植被工具快速入门

开放世界场景工具提示和技巧

ContentExamples中的LandScape示例

Landscapes | 5-Minute Materials [UE4]

Landscape Grass | 5-Minute Materials [UE4]

Quick Unreal Engine 4 Grass Tutorial

UE4移动端地形理解 - 高度LOD(知乎)

UE4移动端地形理解 - 高度LOD(博客)

posted on 2023-07-16 23:28  可可西  阅读(1956)  评论(0编辑  收藏  举报

导航