How to realistically blend multiple textures (e.g. sand, rock, pebbles)

Hi all

I am generating terrain using a ProceduralMeshComponent. For every vertex in the mesh, the vertex may either be rock, sand, mud, gravel or a mix e.g (50% rock, 50% sand). The terrain including the vertices and their type is generated randomly in C++.

How could I show the terrain type using a material? I have a texture for each terrain type but not sure how to blend them together.

It would be great if I could do something like this but not sure how to achieve it in UE4: Advanced Terrain Texture Splatting

The technique you’re looking for is called a height lerp. Lots of tutorials on YT about using HeightLerp with vertex paint if you need, but it uses your textures heightmap to drive the blend and get a natural looking transition.

Thanks mate! Some useful direction.

I can use the colour of each vertex to represent the terrain profile e.g. RGBA maps to rock, sad, mud and gravel respectively.

Height lerp seems to work well for 2 textures but I can’t think how I could use it to blend 4 textures together.

It works the same, you just lerp more than once. Here’s an example that includes a 4 way blend: Surviving Your First Year in a Games Company - Part 2