Blend Seamlessly with Landscape using Normals

Post from the LinkedIn article of mine…try-ryan-gadz/

The Landscape Editor in Unreal Engine 4 facilitates the building of a terrain but sometimes intersecting geometry that is meant to create special features like roads or the bottom of a dried up lake will create an undesired seam. This article outlines the steps erase the seams of intersecting geometry.

(special note: make sure that the size of the heightmap equals the overall resolution of the Landscape in UE4)

The normal vector tells the renderer which direction to render the lighting, so if the intersecting geometry gradually blends the normals of the landscape it should appear seamless. There are several ways to get a normal map from the heightmap, but Substance Designer seems to work the best. The Landscape Editor in UE4 at default Z scale of 100 will limit the range of the geometry from -256 to 256 for heightmaps that use -1 to 1. This example uses a Z scale of 50 and the map is 0 to 1, so the range will be 128 units total. This is the “Intensity” value needed when creating normals from heightmap in Substance Designer.

Import the newly created normal map into UE4 to start work on the material. To avoid interference from other textures and channels set the landscape to a pure white material. The material for an intersecting plane will also be white to make sure things are as seamless as possible before adding textures. Get the “Absolute World Position” node for use in the material of the intersecting plane. Mask out the R and G channels from and append then to a float 2. The Landscape is centered in the level so that value needs to be subtracted from the world coordinates so that the UVs start at (0.0, 0.0). These then need to be divided by the entire dimensions of the landscape so that previous offset value can be multiplied by 2. Plug this into the UVs of the normal map from Substance Designer.

Throw the white material with normal map on a plane and intersect it with the mountains of the terrain.
It should be close to seamless. If not, the scaling of the normal map is incorrect. The “FlattenNormal” node can be added after the normal texture and ‘flatness’ value can be assigned to a parameter to adjust it for the perfect blend.


Since the entire intersecting object shouldn’t only have the normals of the landscape but also its own normals a blend can be used where it intersects. To do this add in a “Distance to Nearest Surface” node connected to the “Absolute World Position” previously used in earlier steps. Divide by 100-500 or so depending on the size of the object being used. It is important to clamp these outputs from 0 to 1 to avoid negative numbers and high values. This will be the ‘Alpha to a “Lerp” node where the normal texture from the landscape is ‘A’ and ‘B’ will be the object’s normals, or in this case it can be set to blue (0.0, 0.0, 1.0).