Setting up a new mesh partition requires a few different assets that work together to make the development process more efficient with a higher level of control. Mesh terrain is designed with the idea that a core technical artist or lead will define a number of files like the mesh partition definition data asset, transformer pipeline data assets, material, weight channels, and priority layers. This structure minimizes the number of shader permutations, incompatible layer structures, unnecessary weight channels, and more.
Naming Conventions and Standards
| Asset | Asset Type | Prefix |
|---|---|---|
Mesh Partition Definition | Data Asset | MPD_<Name> |
Mesh Partition Transformer Pipeline | Data Asset | TP_Compiled_<Platform>_<Name> TP_Preview_<Platform>_<Name> |
Create a Mesh Partition Definition
The mesh partition definition defines numerous core aspects of the mesh terrain including the material, priority layers, and weight channels, among others. You can use the same definition on multiple mesh partitions.
Create a new Data Asset and select the Mesh Partition Definition class.
Name it
MPD_<name>(MPD_is for MeshPartitionDefinition).
Set Up a Mesh Partition Definition
Once created, open the new Mesh Partition Definition data asset. There are 4 main sections:
Material
Modifiers
Build
Preview
Mesh Partition Definition - Material
The Material settings are where you can define the materials and associated channels used for your mesh partition definition.
| Parameter | Description |
|---|---|
Material | This is the material applied to Mesh Partition geometry. |
Channel Texel Size | This controls the resolution of the baked textures for runtime use of the attribute channels (see Channels below). |
Physical Material Channels | This defines the available physical material channels for the mesh partition actor. The physical material channels are a way to map areas with a given attribute data to specific physical materials. |
Default Physical Material | This is the default physical material applied to the mesh partition. |
Channels | This is user defined attributes that are available on the mesh partition geometry. The data in these channels can then be painted or injected from various modifiers or PCG. Modifiers can write channels that are not defined in the definition, however they remain editor only and don't get converted to textures for the runtime compiled sections. These channels remain available for other modifiers that might read them and also to PCG. You can use them for a variety of purposes. For example:
|
Mesh Partition Definition - Modifiers
In the Modifiers settings, you can find the Modifier Layer Priorities which define the order in which modifiers are built.
Create your desired priority layers here.
Modifiers assigned to Index[0] will be built first.
Modifiers assigned to Index[1] will be built second, and so on.
You can assign several modifiers to a single layer.
Modifiers have a sub-priority you can use to manually order their effects on a given layer. For more information, see the Modifiers section in the Crafting Mesh Terrain documentation.
Mesh Partition Definition - Build
You can use the Build settings to set up the geometry generation of compiled sections for various platforms. Compiled sections are serialized for runtime.
Here is what you can find in the build section:
| Compiled Sections Build Variants | |
|---|---|
Name | Name of the build variant |
Max Section Complexity | Maximum vertex count for a section |
Transformer Pipeline | Select a transformer pipeline data asset here. Refer to the Transformer Pipeline section below for more details. |
| Platforms - Per Platform Runtime Settings | |
| Default | |
Build Variant Names | Select a build variant defined in the Compiled Section Build Variants settings as the default build variant, which is the variant used when the cooked platform name isn't matching any defined platform entry below. |
| Per Platform | |
Name | Give a name to this platform element. |
Build Variant Names | Select a build variant defined in the Compiled Section Build Variants above as the build variant assigned to this platform. |
Mesh Partition Definition - Preview
Preview sections are for the editor only and are decoupled from compiled sections used at runtime. Preview sections are optimized for build time, invalidation, and iteration. Compiled sections are optimized for rendering for the target platform.
Here is what you can find in the preview section:
Max Section Complexity | Maximum vertex count for a section. |
Transformer Pipeline | Select a transformer pipeline data asset here. Refer to the Transformer Pipeline section below for more details. |
Transformer Pipelines
Transformer pipelines are data assets that provide a way to create and configure various features for the preview sections and compiled sections.
They provide for a user-programmable pipeline which defines what happens after the mesh data is built for a mesh partition and how that transforms into persistent data (actors and components).
Because the transformer pipeline is a separate asset from the mesh partition definition, it is convenient to reuse project or platform defined configurations quickly on different mesh partition definitions.
To create a transformer pipeline asset, create a new data asset and select the Transformer Pipeline class.
Inside of your transformer pipeline data asset you can then add various transformers.
The types of transformers available are:
Collision Transformer
Far Field Transformer
RVT Transformer (RVT = Runtime Virtual Texture)
Skirt Transformer
Static Mesh Transformer
Subsection Transformer
WP Actor Properties Transformer (WP = World Partition)
Collision Transformer
The Collision transformer enables and defines the generation of collision geometry which is decoupled from the visual mesh.
If you need to simplify the collision geometry, adjust the Error Tolerance setting.
Far Field Transformer
The Far Field transformer enables and defines a special mesh generation which is used for Lumen’s internal representation for far field.
Far Field Mesh Edge Length | This is the target edge length for the generated far field mesh. |
RVT Transformer
The RVT transformer controls the availability of runtime virtual textures (RVT) for the mesh partition.
Skirt Transformer
The Skirt transformer enables the generation of skirts between sections to help prevent LOD or Nanite seams at section boundaries.
Static Mesh Transformer
The Static Mesh transformer enables and defines the static mesh component of the compiled and preview sections. It makes it possible to set up LODs and enables Nanite.
Subsection Transformer
The Subsection transformer subdivides sections into small components.
Sub Section Size | Represents the target vertex count for each sub section. |
The index of the subsection transformer in the stack is important and affects the following transformers (with higher index).
WP Actor Properties Transformer
The WP Actor Properties transformer controls the world partition runtime grid, data layer assignment, and HLOD layer of the mesh partition.
Building Mesh Partition Runtime Sections
Once your mesh partition definition build variants are set up, you can manually build the compiled sections from the Build menu / Build Mesh Partition option.
Showing Mesh Partition Compiled Sections
The base and compiled sections are hidden by default in the outliner.You can display them from the outliner filter menu and toggling ON:
Show Mesh Partition Bases
Show Build Mesh Partition Sections
The sections are then displayed under your Mesh Partition actor.