Level Requirements
You must use Mesh Partition in a World Partition level. When creating a new level make sure to select an Open World level.
Create Mesh Partition Actor
To create the base of a mesh partition actor you have 3 options available:
Create Rectangle
Import Heightmap
Convert Mesh
Create Rectangle
The Create Rectangle tool establishes a flat grid as the base for your mesh partition, making it the approach most similar to creating a conventional landscape.
| Setting | Description |
|---|---|
| Mesh | |
Size | Size in default units (cm). |
Resolution | Number of quads created on each XY axis. |
| Sections | |
Generation | Automatic (based on max triangles) Explicit (based on Layout and Resolution) |
Max Triangles | Maximum number of triangles allowed per section. This controls the automatic partitioning of the imported mesh into manageable sections. You can later combine and split these sections manually as desired using the Split and Merge tools. This is only available if the Sections Generation is set to Automatic. |
Layout | Defines the number of sections on the X-Y axis. |
Resolution | Defines a specific resolution for each section (the number of quads on the X-Y axis). |
Save and Unload | When enabled, automatically unloads created base sections in the world partition when created. This is useful when creating a very large mesh partition that is difficult to load all at once. |
| Add | |
Existing Mesh Partition | Gives you the option to add the new rectangle grid to an existing mesh partition actor instead of creating a new one. |
New Mesh Partition Definition | Select a mesh partition definition to assign to the newly created mesh partition. |
Import Heightmap
The Import Heightmap tool gives you a way to create a grid deformed by a selected heightmap as your mesh partition base.
| Setting | Description |
|---|---|
| Heightmap | |
Filename | Browse to the desired heightmap file. |
| Mesh | |
Resolution | Number of quads created on each XY axis. |
Size | Size in default units (cm). |
Convert Mesh
Convert Mesh gives you a method to turn a static mesh actor into a mesh partition actor and split it into base sections.
| Setting | Description |
|---|---|
| Split | |
Number Of Sections Per Side | This controls how many sections the mesh is split into. For example, a value of 3 means splitting the grid into 9 (3x3) sections. |
| Add | |
Existing Mesh Partition | If selected, the convert operation adds the new mesh to an existing mesh partition instead of creating a new one. |
New Mesh Partition Definition | Select a mesh partition definition to assign to the newly created mesh partition. |
Assign a Mesh Partition Definition
As explained in the Mesh Partition Definition documentation, a definition holds an important configuration setting for your mesh partition actor. Here is how to assign one to your actor:
In your level, select your mesh partition actor.
In the Details panel, find the Mesh Partition Definition setting, then assign your MPD_<name> asset from the Content Browser.
Using Mesh Terrain Modifiers
Now that you have a base mesh partition actor you can start to shape up your world. Open the Mesh Terrain Mode from the editor toolbar, then go to the Modifiers tab. There are a lot of different modifiers that you can use. Depending on the type of input you want to provide you can select a different modifier. Most of the modifiers move the vertices of the terrain based on an input.
A texture modifier uses the values of the texture to displace the terrain.
Splines, noise, sculpt, and mesh also use different inputs to displace the terrain.
There are additional modifiers that alter the topology of the terrain, they can remesh or subdivide the terrain to provide additional resolution for finer detail.
A boolean modifier adds or subtracts a section of the mesh and merges the triangles from the source.
You can combine the different methods in a variety of ways to achieve different terrain structures and optimize topology. Modifiers are added by a drag and drop from the toolbar.
Modifier Basic Parameters
Parameter | Description |
Affected Mesh Partition | The affected mesh terrain is normally automatically set but you can adjust it if you want to disconnect a modifier or wish to reassign it to a different mesh terrain. |
Priority Layer | The priority layer is the primary layer that impacts the build order. The layers are defined in the mesh partition definition. |
Layer Sub-Priority | You can define a sub-priority if needed. For example, if two modifiers need to exist on a specific layer but you need one to build after another you can set the value to a higher number. |
Projection Plane | The projection plane shows the primary plane size and orientation of the modifiers projection. |
Local Bounds | Displays the local bounds in yellow (like a volume) of the modifier component. |
World Bounds | The world bounds displays the complete world space bounds of the component; this can be helpful to see the area being evaluated for any particular modifier. |
Disabled in Editor | Disabling the modifier in editor effectively turns the modifier off in the current session. It will be active in the build. |
Disabled in Build | Disables the modifier both in editor and in build. |
Base Growth | When the Mesh Partition builder builds modifiers, it initially only considers modifiers whose bounding boxes overlap the original base bounds (known as "bases") that contribute to that section. Base growth enables a modifier to conceptually "grow" the original base bounding box in a specified direction. This enables following modifiers to intersect the updated base bounds. |
Coverage and Extent
Just like the Modifier settings, there is a general set of coverage values that define the size and coverage area of the modifier. Modifiers can have slightly different options for coverage depending on the functionality.
Adding Weight Channels
Most modifiers have the additional option to write data to weight channels. You can use weight channels defined in the mesh partition definition in the material setup for blending texture sets, other rendering attributes, or use them in PCG.
For example, here we show a Patch modifier writing into the Gravel weight channel defined in this specific mesh partition definition, and used by the mesh partition material to apply gravel texture on the terrain.
Adjusting Priorities
The build priority is important to remember when crafting your terrain. The ability to layer different modifiers makes complex terrain development possible while maintaining flexibility for changes. The mesh partition definition defines a desired order that you can assign modifiers to. In addition to the priority layers you can also set a sub-priority. You can use the sub-priority to control the build order of all the modifiers set on a specific layer.
Understanding the build priority and layers can improve the development process by giving you a way to control how the world is built, meaning you can hide complex local details in a different layer from larger structural changes.
To understand priority layers, here's an egg-shaped Boolean modifier assigned to the first priority layer. Then we assigned a texture modifier using the Unreal Engine logo to a second priority layer. The order is important otherwise the texture modifier wouldn't have mesh partition geometry to affect.
Controlling Mesh Resolution
Mesh terrain is not constrained to uniform resolution. There are two major concepts to remember when setting up your mesh terrain.
The number of sections. In general, you do not want the sections to be too large. Large sections mean that any change to a modifier can have a larger impact since the mesh terrain builder recalculates the entire section even if it is a small change.
The resolution of the section. The resolution you define when you create or convert to mesh terrain is the base resolution you are working with. You can modify this resolution, and it does not have to be a uniform change in resolution, meaning you can easily change resolution locally to the point of interest that needs it.
You can change the resolution in a number of ways, either directly on the base mesh if desired or more often using modifiers.
You can control local resolution using the remesh modifier, or the spline remesh modifier. Both of those modifiers have the additional ability to switch between Remesh mode and Tessellate mode.In addition to modifying the resolution with modifiers, you can adjust the number of base sections by using either the section merge tool or split tool from the edit tab.
Remesh vs Tessellation
You can use the remesh modifier in either Remesh mode or Tesselate mode.
Remesh generates new uniform triangles, tesselate subdivides existing triangles.
In most cases, and depending on the settings, tesselate is faster and remesh is slower.
Remesh
Remesh creates new triangles uniformly, or non-uniformly if you use a density mask. Target Edge Length is the main parameter to adjust in Remesh mode. It also has an additional option to use a weight channel to control the remesh density.
Tesselate
Texture Modifiers
Another way to control the mesh resolution is using a texture modifier that has an Adaptative Tessellation option.
Sculpting and Painting
The Sculpt modifier gives you a way to both sculpt and paint the mesh partition.
Selecting a Sculpt modifier provides you access to use the Sculpt and Paint tab.
Sculpt modifiers also support having local mesh layers within the modifier itself, which you can use to organize your work.
Rendering Material Modes
Various material modes are available in the Sculpt and Paint tools.
Using Water Body Tools
Mesh terrain is compatible with the water system, but requires you to do a quick setup by adding a Mesh Partition component to the actor.
Lake and River
When you use a WaterBodyLake or WaterBodyRiver actor, add a corresponding LakeModifier or RiverModifier, then configure the modifier component by assigning the affected mesh partition and setting a priority layer.
Water Body Terraforming
Find the terrain section in the Water Body component to configure the terraforming effect of your lakes and rivers.
Not all the terrain carving functionality from the water landscape integration has been translated yet.
Weight Channels
e Water Body tools can also affect mesh partition weight channels in order to apply materials or other effects if needed.
When you select the Water Body component, you find a Layer Weightmap Settings section where you can add specific weight channels. Weight channels need to be present in the mesh partition definition to be rendered.
Island
The regular Island Water Body tool is not needed for mesh partition. You can instead replace it with a regular spline modifier, as the Island doesn't affect the water itself, only the terrain.
Here is an example of how to set this up:
Set a Lake Water Body on the Water priority layer (defined in this specific mesh partition definition) with a sub-priority of 1.
Add a regular spline modifier to shape the island set on the same Water priority layer with a sub-priority of 2.
Ocean
You don't need any specific setup for the Ocean Water Body tool, it does not require any mesh terrain modifier as you don't need it to affect the terraforming. The ocean spline is only used to crop the ocean water underneath the terrain.
Creating Terrain Holes
To create holes on the terrain, you can use a Boolean modifier set to Trim.
Proceed as follows:
Drag and drop a Boolean modifier on your mesh terrain.
Set Mesh Source Mode to StaticMesh.
Select a StaticMesh from the Content Browser (for example, EditorSphere).
Set Boolean Op to Trim.
If you get jagged triangles like in the image below, it is because these triangles are not fully within the modifier bounds.
To fix this, increase the value of the Expand Operator Bounds setting. On vertical surface cases like this example, increasing only the Z axis is sufficient, as it is the longer vertically stretched triangles that are problematic.
Blueprints and Mesh Terrain
You can build a wide variety of tools with Blueprints to work on mesh terrain.
Above is a simple example of a dynamic mesh Blueprint using a spline and a Boolean modifier. In the Blueprint event graph, the spline is used to create a dynamic mesh, then that dynamic mesh is used by the Boolean modifier.
You can use this to create either tunnels or arches. For example: