Landscapes - Nanite Tessellation
Tessellation is the ability to displace the surface of a mesh or landscape as it is rendered to create the appearance of more detail than the mesh contains. Nanite tessellation requires Unreal Engine 5.4 or higher.
Background
This is part of a series of articles about landscapes, other articles are:
Landscapes - Building GDAL
Landscapes - Material Concepts
Landscapes - Nanite Tessellation
Landscapes - Using Real Location Data
Landscapes - World Partition and Tiling
Setup
The plugin "Nanite Displaced Mesh" need to be enabled for nanite tessellation to work.
Edit DefaultEngine.ini and add these settings:
[/Script/Engine.RendererSettings]
r.Nanite.ProjectEnabled=1
r.Nanite.AllowTessellation=1
r.Nanite.Tessellation=1
Material Setup
Make a new material then in the details panel:
- set "Use Material Attributes" to true
- set "Enable Tessellation" to true
- set "Used with Nanite: to true
Use a texture set which has a displacement channel or texture. Here I used the Quixel Soil Clay surface with High Quality - the medium and low quality versions of this surface (and maybe most Quixel surfaces) do not contain a displacement texture.
To get a similar texture search Fab for quixel "rocky soil"
and make sure
it has Displacement listed in the Maps:
Drag the textures onto the material and connect them to make a material like this:
Texture Setup
Open the displacement texture.
If it is completely white like this:
Change the "Compression Settings" property to "Grayscale (G8/16, RGB8 SRGB)" and it should now look more like a height map:
As you change the compression setting the "Sampler Type" property on the Texture Sample node which reads this texture will automatically change to "Grayscale".
Depending on the texture, the material might have an error saying:
[SM6] (Node TextureSample) Sampler type is Grayscale, should be Linear Grayscale for /Game/Fab/Megascans/Surfaces/Soil_Clay_pjEm30/High/T_pjEm30_4K_H.T_pjEm30_4K_H
If this happens change the "Sampler Type" property on the Texture Sample node to "Linear Grayscale".
Landscape Setup
In the landscape details panel set "Enable Nanite" to true and then press the "Build Data" button, this might take 10-20 seconds to complete:
The landscape should now show the texture with too much displacement like this:
This can be fixed by editing the material or material instance and changing the Displacement Scaling | Magnitude property to a lower value:
This makes the landscape look more sensible:
Viewing Tessellation
If we switch to the wireframe view of the landscape we see this:
If we turn the "Enable Tessellation" property off in the material instance and look at the Nanite Visualization | Triangles view we see that the triangles which get rendered correspond to the triangles in the landscape:
If we turn tessellation on, we see all the triangles created by the tessellation process: