Let’s assume that you’ve read my previous article and made a landscape for UE4. Sometimes it’s enough to start adding details, especially if you have a big landscape. But in most cases, you have a small playable landscape and it’s a good idea to add additional background landscapes to enhance visible borders of a level. In this article, I will try to explain my workflow and tell you how to make distant landscape meshes for UE4. Let’s start.
1. For the sake of simplicity, we will use an 8 km core landscape with 2 layers and we will make only 1 level of distant landscapes.
To achieve better results, you can make multiple levels. For example, the first level of distant landscapes will be 16km in size and has more details than the second level, which will be 64km in size. Because the second level uses the same heightmap resolution, it has fewer details than the first level, which is fine, because it will be far away from the player.
First, you need to export your core landscape as a mesh, which will be used later to cut a piece from distant landscape mesh. You need to use Mesh Output node to do this. Select a proper number of tris for your landscape. Because landscape mesh will be cut into 4 pieces and only some of them will be visible simultaneously, I prefer to set a higher resolution for output mesh (for example 64k tris).
Also, you need to use channel combiner node to combine all outputs from splat converter and get a proper splat map. Splat map will be used as a container of masks to texturing our distant landscapes. Because we have only 2 layers in this example and channel combiner requires 3 inputs, you can put the random output from splat converter into third input of channel combiner.
In normal map maker node, you should select “Flip Y” to get a proper normal map for UE4.
Export all maps (splat and normal) as a .PNG files.
2. After you’ve made all required setups, you can build your world with high resolution (4033×4033 for example) and copy mesh.obj, splat and normal maps to a separate folder. Now you have a core landscape mesh. It’s time to make a distant landscape mesh in the same way.
Open “World Extents and Resolution” window in World Machine. Set width and height to 32 km. Now the trickiest part: you should set a proper offset for distant mesh so in the center you can put your core landscape and cut a hole for it. After some experiments, I found a formula, which was tested successfully for 8km core landscape and 32-64km distant landscapes:
Offset = – ((DistantLandscapeSize / 2) – CoreLandscapeSize + (CoreLandscapeSize / 2))
We have a 8 km core landscape and 32 km distant landscape.
Offset = -((32/2) – 8 + (8/2)) = -12 km.
If we have a 64km distant landscape, then offset will be -28 km.
Now set the calculated offset to Lower Left Coordinates and click ok. After that, you need to build the world and copy mesh.obj, splat and normal maps to a separate folder again.
3. Now you should import created landscape meshes into 3d modeling software. I will show you how to process them in Maya LT, but you can achieve the same result in other apps, like Blender, Modo or 3ds Max.
First, you need to rotate meshes to -90 on the X-axis. Then you need to use “Center pivot” on each of them and put them into the origin(use snap to grid). For distant landscape mesh, you should change scale according to its relative size to the core landscape. We have 32 km distant landscape, so we need to scale it by 4 on all axis. After that, you can freeze transformations for all meshes and scale them again by 100, so it will be easier to work with them. You will get something like in the picture below.
4. Now you should move your core landscape up a little bit. Then go to the top view and select distant landscape. You will see something like this.
5. Your goal is to cut a hole in distant landscape, where core landscape will be placed later. Just go to the face selection mode, make a proper selection and delete polygons in the center. Then hide core landscape mesh, you won’t need it anymore. You will get something like in the picture below.
6. Next, you need to cut distant landscape into 4 pieces. Go to the top view and select multicut tool. Go to the vertex mode and cut lines to define borders of the pieces.
7. We’re almost done with mesh preparations. Now you should split working area and open UV editor in the second window. Select all borders, which you’ve cut in the previous step, and click on the button “Separate UVs along the selected edges” on the toolbox. Then you can go to UV shell selection mode, select each piece of landscape and use “Edit Mesh -> Extract” to get separate pieces of landscape. Then for each piece use “Mesh Display -> Softer Edge”. Now it’s time to give them proper names and export them to UE4. Don’t forget to delete history and freeze transformations. Also, you can apply Stingray PBS material on your distant landscape, set correct name for it and add a normal map to see a proper preview of it in Maya LT.
8. Import your meshes, normal and splat maps into UE4. Then make a material for our distant landscape meshes. The main idea is that you should use your splat map as a mask container and apply certain materials on certain layers of a landscape by using lerp nodes. You can use the same textures like you’re using in your core landscape. Don’t forget to disable sRGB checkbox for splatmap texture. You can see an example of material setup in the image below.
9. Next, you should select all your 4 pieces of distant landscape in Content Browser and put them on the level at once. Then you should scale them properly. In our case 8250 on all axis will be enough. Then you need to place those pieces correctly, so your core landscape will be in the center with minimal visible seams. You can put distant landscape a little below the core landscape. To add more visible space, you also can create a cylinder with flipped normals, which doesn’t have top and bottom caps. Then you can apply a 360-angle panoramic texture to it, import into UE4 and scale it to the high values to get a distant background image. In the pictures below you can see a landscape without and with distant landscape meshes. Even for plain landscape, they will give you a better result. And if you have a lot of mountains as a background, then you definitely should try this method to enhance the look of your level.
P.S. I wrote this article for 80.lvl some time ago (Distant Landscape Meshes for UE4). Now I decided to publish it on my own website.