Landscape Materials

Setting up materials to work with Landscape terrains.

Windows
MacOS
Linux

Although any random Material can be used with a Landscape Actor, the Material system inside Unreal Engine 4 (UE4) does provide some special Landscape specific material nodes that can help improve the textures for your Landscape. In the following document, we will be taking an in-depth look at these nodes, how they function, and how you can use them in your Landscapes materials.

You modify Materials for use with Landscapes the same way you modify other Materials, in the Material Editor.

Layer Weights and Ordering

Landscapes use weight blending rather than alpha blending, so the blend factors for all layers at any location will add up to 1.0. Alpha blending is useful because it is not order dependant, so you can paint any layer at any time. Additionally, the alpha layer weight is increased while other existing layer weights are decreased.

A disadvantage to using alpha blending is that when one layer is painted to 100%, the weight value for all other layers will be 0%. This is evident when using the Paint tool to remove a layer already at 100%. Because the other layers are at 0%, the tool has nothing to replace the 100% layer you are removing, so it appears as if the layer was not changed.

Landscape Specific Material Nodes

Inside of the Material editor, you will find that there are six special nodes that can be used with the Landscape system. You can find all the nodes in the Palette menu under the Landscape category.

Material Editor Context Menu

Landscape Layer Blend Node

The LandscapeLayerBlend node enables you to blend together multiple Textures or Material networks so that they can be used as Landscape layers. The LandscapeLayerBlend uses an array to store information about the Landscape layers. To add layers to this array, select the plus sign icon.

Layer_Blend_arrayelements.png

When you add multiple layers to the LandscapeLayerBlend node, the Layer Names populate in the LandscapeLayerBlend node.

LandscapeLayerBlend Mode

Number

Property

Description

1

Layers

The list of layers the node contains. You can add layers by clicking the plus icon (Plus Sign).

2

Additional Layers

These are what additional layers look like when they are collapsed.

3

Layer Name

The unique name that you give the layer. The Layer Name corresponds to the layer name used in Paint mode in the Landscape tool window.

4

Blend Type

Either LB_AlphaBlend, LB_HeightBlend, or LB_WeightBlend. See Landscape Layer Blend Types on this page.

5

Preview Weight

This is the weight value for the layer to preview the blending in the Material Editor.

6

Const Layer Input

This is for supplying a numeric value as a color to use in case you do not want to use a texture. This is mainly used for debugging a layer if there is an issue.

7

Const Height Input

This is for supplying a numeric value as a height in case you do not want to use a texture.

The following table details the Layer Blend node inputs and outputs.

layer_blend_node.png

Number

Item

Description

1

Layer *LayerName

Each layer adds an input for the layer to blend together. This input is only available after layers are added and named in the Details panel.

2

Height *LayerName

This is where you supply a height map to blend with. This input is only visible on layers that have their Blend Type property set to LB_HeightBlend.

3

Unlabeled Output

The result of the layers blended together.

Blending Layers

When using certain combinations of layer blend modes you could end up with black spots all over your Landscape where different layers meet. This problem is especially prevalent when using the LB_HeightBlend mode for multiple Landscape layers. LB_HeightBlend works by modulating the blend factor, or weight, for the layer using the specified height value. When you have multiple layers painted on an area and they all are set to LB_HeightBlend, it is possible that all the layers painted in a particular area will simultaneously have a 0 height value, so the desired blend factor for each layer becomes 0.

Because there is no implicit or explicit ordering, the result will be black spots because no layers will have any contribution to that area. The situation is worse when you are blending a Normal map, because it results in a Normal value of (0,0,0) which is not valid and will cause rendering problems with the lighting. The solution to this problem is to use LB_AlphaBlend for one of the layers like in the example below.

In the left image, all layers are LB_HeightBlend, causing some areas to be black. On the right, the red "1" layer has been changed to use LB_AlphaBlend, which solves the problem.

LB_HeightBlend Problem

Below is an example of the properties of the Landscape Layer Blend node for all the layers being blended together. Make sure to note how the Soil layer has its blend mode set to LB_AlphaBlend while the other layers have theirs set to LB_HeightBlend. This is to stop the issue mentioned above (having black spots where layers meet) from happening.

Layer Blend Properties

If you need to delete a layer, click the drop-down arrow to the right of the layer's element number to open the menu, and select Delete.

Delete Layer

Landscape Layer Coords Node

The LandscapeLayerCoords node generates UV coordinates that can be used to map Material networks to Landscape terrains.

LandscapeLayerCoords Node

Number

Property

Description

1

Mapping Type

The ELandscapeCoordMappingType that specifies the orientation to use when mapping the Material (or network) to the Landscape.

2

Custom UVType

The mapping place to use on the terrain. The CustomUVType outputs the UV coordinates to map the Material to the Landscape based on the given property values.

3

Mapping Scale

Applies uniform scaling to the UV coordinates.

4

Mapping Rotation

Applies the rotation, in degrees, to the UV coordinates.

5

Mapping Pan [U]

Applies the offset in the [U] direction to the UV coordinates.

6

Mapping Pan [V]

Applies the offset in the [V] direction to the UV coordinates.

7

Unlabeled Output

Outputs the UV coordinates to map the material to the Landscape based on the given property values.

Landscape Layer Switch Node

The LandscapeLayerSwitch node allows you to exclude some Material operations when a particular layer is not contributing to a region of the Landscape. This allows you to optimize your Material by removing calculations that are not necessary when a particular layer's weight is zero.

LandscapeLayerSwitch Node

Number

Property

Description

1

Parameter Name

The unique name that you give to the parameter.

2

Preview Used

If checked, uses a preview.

3

LayerUsed

When the layer specified in the node's properties is in use by the current region of the Landscape.

4

LayerNotUsed

When the layer is not used by the current region of the Landscape and has a weight of zero.

5

Unlabeled Output

Either the LayerUsed or LayerNotUsed inputs, depending on whether or not the layer contributes to the particular region of the Landscape.

Landscape Layer Weight Node

The LandscapeLayerWeight expression allows Material networks to be blended based on the weight for the associated layer obtained from the Landscape the Material.The weight for this layer is used as the alpha value for blending the two input networks.

LandscapeLayerWeight Node

Number

Property

Description

1

Parameter Name

The unique name that you give to the parameter.

2

Preview Weight

The weight to use for preview purposes in the Material Editor.

3

Const Base

You can specify a base color here that you would like for your Landscape to have

4

Base

The network to blend this layer with. This is generally the result of any previous layer blending, but can be empty if this is the first layer.

5

Layer

The network to blend together to create this layer.

6

Unlabeled Output

Outputs the result of the blending between the Base and Layer inputs based on the layer weights of the layers involved.

Landscape Visibility Mask Node

The LandscapeVisibilityMask node removes visible parts of your Landscape, so you can create holes in your landscape to, for example, create caves.

LandscapeVisibilityMask Node

Number

Property

Description

1

Unlabeled Output

Outputs the visibility mask properties.

Make sure the output is connected to the Opacity Mask slot of your Material and that the Materials Blend Mode is set to Masked. Otherwise the node may not work correctly.

layer_visibility_mask_opacitymask.png

Landscape Layer Blend Types

The Landscape Layer Blend material node has three different blend modes that you can choose from. Each different Layer Blend type is used when you are trying to achieve a different result.

Blend Type

Function

LB Weight Blend

Use if you have layers coming in from an external program, like World Machine, or if you wanted to be able to paint any layer independent of one another without worrying about layer order.

LB Alpha Blend

Use if you want to paint in detail and if you want a defined layer order. For example, painting snow over rock and grass will occlude them, but erasing snow will reveal rock and grass beneath it.

LB Height Blend

This is the same as LB_WeightBlend but also adds detail to the transition between layers based on a height map. This allows, for example, dirt to appear in the gaps between rocks at the layer transition point, instead of just smoothly blending between rock and dirt.

Here is an example of the LB Height Blend in action. As you can see, the dirt to appears in the gaps between rocks at the layer transition point. This way you get a nice transition where layers meet.

LB_HeightBlend.png

Landscape Layer Blend Technical Information

Under the hood, these layer nodes behave like a Static Switch Parameter node, which enables you to switch from using one part of the Material to using another. Each component of the Landscape has its own MaterialInstanceConstant created from the main Landscape Material, which is applied to just that component. If a particular layer is not used on a specific Landscape component, the subtree of nodes connected to the layer will be discarded. This reduces overall Material complexity, enabling the Material applied to the Landscape to contain any number of texture samples as long as the number of samples being used on any individual component never exceeds the maximum set by the shader model specifications (16 for SM 3.0).

This means it is possible to set up a master Material that contains every texture or network used anywhere on the Landscape. This can end up being a very complex collection of networks, while still keeping the final Materials applied to the components of the Landscape within the parameters allowed by the hardware.

Any network of material expressions can be connected to the Layer inputs in place of a simple TextureSample. This makes it possible to do more complex effects such as transitioning from detail textures to larger macro textures depending on the distance the layer is being viewed from.

Tessellation and Displacement

The Tessellation Multipliers and World Displacement channels of the Material can be used in conjunction with Landscape terrains to provide additional detail and deformation when the Landscape is close to the camera. These work exactly as they would with any other standard Material, and the layer blending can be used in conjunction with these just as with the Base Color, Normal, or any other channel. The Landscape will also only render hardware tessellation on the highest level-of-detail(LOD) which will fade out as the Landscape approaches the second LOD. Subsequent LODs will no longer have tessellation enabled, which will significantly improve performance when enabling tessellation for displacement on your Landscape Terrain.

These features are limited for use with DirectX 11 enabled. As such, they should be used as secondary polish effects unless you are targeting DirectX 11 hardware specifically. You can read more about how to enable and use tessellation in your project by reviewing the Tessellation Multiplier page.

Landscape_HW_Tess.png

In the visualization above, the highest LOD (white) is rendered with tessellation enabled, while the other LODs (colors) are rendered without tessellation.

Mobile Landscape Materials

Mobile landscapes are no longer limited to just three Landscape layers. While three is still an optimized case, any number of layers are supported provided there are sufficient Texture Samplers. The Landscape layer allocation now takes Feature Level Switch material node allowing a single PC or Console Landscape Material to also have a Mobile version. The following image shows how the Landscape used in the PC and Console versions of Fortnite Battle Royale looks when used for mobile devices.

MobileLandscape_FeatureLevel.png

Using Layer Blending

The ability to blend multiple textures and materials networks into paintable Landscape layers is the basis for texturing Landscape terrains. In order to blend layers together, you can use either multiple LandscapeLayerWeight nodes or one to two LandscapeLayerBlend nodes depending on if you are using a Normal Map or not.

Using Landscape Layer Weight Nodes

Setting up and using LandscapeLayerWeight nodes is a quite easy process for which will be outlined below.

All layer names must be unique, so we recommend naming your layers with a descriptive name that indicates what the layer contains. This will help you remember where content is in your layer and help you navigate through layers faster.

  1. In the Material Editor, add a LandscapeLayerWeight node to the Material Graph. By default, it will have the Parameter Name "None."

  2. In the Details panel, change the Parameter Name to a descriptive name for the layer, for example, "Rock". After you enter a **Parameter Name**it will be updated on the node itself.

    Layer Name

  3. Add additional LandscapeLayerWeight nodes, until you have one for each layer that you want your Material to have. In this example, we are going to be using just two LandscapeLayerWeight nodes.

  4. Add and connect Texture Samples, or other material network expressions, to your LandscapeLayerWeight nodes.

  5. Add a LandscapeLayerCoords node, set its UV titling to what you want, and connect it to the Texture Sample nodes.

  6. Drag from each Layer node's output pin to the Base pin of the next layer node to connect them with a wire (leaving the first layer node's Base pin unconnected).

  7. Drag from the final Layer node's output pin to the Base Color input of the Material's Base node.

When completed, you should have something that looks like the following example using LandscapeLayerWeight nodes:

Landscape Layer Nodes

You can preview the effects of different weights on the Material by changing the Preview Weight properties of the LandscapeLayerWeight nodes.

Using Landscape Layer Blend Nodes

As an alternative to manually blending layers together with the LandscapeLayerWeight node, the LandscapeLayerBlend node blends multiple layers together using either alpha blending or alpha blending with a height-based offset. The height-based offset allows a layer to blend with other layers based on a heightmap input.

  1. In the Material Editor, add a LandscapeLayerBlend node.

  2. In the Details panel, next to Layers, click the plus icon (Plus Sign) to add a layer.

    Layer_Blend_arrayelements.png

  3. Expand the layer to view its properties.

  4. Change the Layer Name to a descriptive name for the layer, for example, "Snow".

    Layer Name

  5. Determine whether you want the layer to be alpha blended or height blended, and set the Blend Type accordingly.

  6. Add as many additional layers as you want for your Landscape Material. Rename them and set their Blend Types appropriately.

  7. Connect the LandscapeLayerBlend node's output to the Base Color input of your Material's base node.

  8. Add Texture Sample nodes, and connect their main outputs to the Layer inputs of the LandscapeLayerBlend nodes. Alternatively, you can create a more complex material network and connect it to the Landscape Layer Blend Layer input. For any height-blended layers, connect the Texture Sample's alpha output to the LandscapeLayerBlend's Height input.

When you are done, your Landscape Material network will look something like this:

Landscape Blend Node

You can preview the effects of different weights on the Material by changing the Preview Weight properties of the LandscapeLayerBlend nodes.

Creating Landscape Hole Materials

Creating holes in your Landscape is something that you can do in Manage Mode but only by deleting entire Landscape components at a time. To get around this, you can use a Landscape Hole Material to mask out the visibility and collision of a certain location on your Landscape. This is great if you want to make something like an entrance to a cave in the side of a mountain.

You can use the same Material for your Landscape Material and your Landscape Hole Material, but be aware that Materials that use opacity masks are more costly performance-wise, than Materials that do not. This is why you have the option of creating a separate Landscape Hole Material.

  1. Open the Material Editor, and in the Details panel set the Blend Mode to Masked.

    layer_visibility_mask_opacitymask.png

  2. Next, add a LandscapeVisibilityMask node to the Material Graph and connect its output to the Opacity Mask input.

    Landscape_VisibilityMaskNode.png

  3. Once the material has been compiled, it is now time to assign it to the Landscape so that it can be used. This can be done in the Landscape Hole Material section in the Details panel.

    landscape_holematerial1.png

  4. Now you can set up the rest of your Landscape Material like you normally would and when completed, you should have something that looks similar to this.

    Landscape_VisibilityMaskSetup_In_Material.png

You should now be able to mask and unmask the visibility of your terrain, like in the video below.

For information about using the painting tools to create a Landscape hole, see Using Opacity Masking to Create a Hole.

Assigning Materials to Landscapes

After creating a Material for a Landscape, you need to assign the Material to a Landscape Actor in your level to use the Material.

  1. Find the Landscape Material that you want to use in the Content Browser.

  2. Select the Landscape, either in the viewport or in the World Outliner.

  3. In the Level Editor's Details panel for the Landscape, in the Landscape section, next to Landscape Material, click the Assign arrow (Assign arrow) to assign the selected Material.

    Assigned Material

Assigning a Landscape Hole Material to a Landscape

You can assign different Material to act as the Landscape Hole Material, which is a Material with specific opacity settings.

See the section on Landscape Hole Materials for general information on hole materials. For information on opacity masking, see Using Opacity Masking to Create a Hole.

  1. Find the Landscape Hole Material that you want to use in the Content Browser and select it.

  2. Select the Landscape, either in the viewport or in the World Outliner.

  3. Navigate to the Level Editor Details > Landscape > Landscape Hole Material. Select the arrow (Assign arrow) to assign the selected Material.

    landscape_holematerial1.png

Tags
Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback