Unreal Engine Terrain Art

General / 18 April 2018

A few months back I worked a freelance job where I made some terrain art for an open-world game. Unfortunately, it was never used, but was a lot of fun to make and helped me delve deeper into understanding Unreal and it's terrain system. 

I was tasked with creating a forest/mountain range environment that would be covered with winding roads and plenty of trees. Instead of painting the height map within Unreal itself, a friend of mine Randal Gitautis, showed me a very cool website where I could take snapshots of small portions of the earth. 

From those images, I was able to convert them into heightmaps using Photoshop. It's not just a point and click system though, often times the heightmap would come in a little too strong and cause a lot of noise in the terrain. It was a lot of back and forth between tuning down the intensity of the heightmap in Photoshop and checking the result in engine. But after all is said and done, with a few minor manual adjustments using the terrain brushes, I achieved the overall look of what I was going for.

The next step is to start texturing and this is where things got tricky. 

In the final result, I used 13 textures in total to texture the landscape consisting of albedo, metallic, roughness, normal, and ao maps each. But before I could get up to that, this is what the basic material build looked like when I started out. Simple textureCoordinate hooked into textures, which then hooked into layerBlend nodes that I specified for each type of texture, and finally plugged into the appropriate inputs of the master node:

However, Unreal would only allow me to use 5 of the 13 that I wanted to use, saying that I had capped myself out. It took a lot of searching and sifting through forums and testing out different things, but in the end, I found that it was one simple setting that I had to change to give me the ability to use unlimited textures. The Sampler Source.

By default, the sampler source of every texture you bring into a material is set to "From texture asset," but if you want to use many, many textures in your landscape material, you must change it to "Shared: Wrap" instead. The only tedious part about this is the fact that you have to change this setting on every texture you bring into your material, but once you change it, you never have to touch it again.

Now, here is what the final landscape material ended up looking like after adding all the materials in (with some extra parts that I'll go over further on):

I know this looks overwhelming from far away, but don't worry, I'll break it down in a second but first I want to talk about another part of this material. 

Once I figured out the texture issue, another popped up which was icky-obvious tiling that you could see from far away. 

To fix this, I found two different methods after searching through forums and combined them into one to achieve the effect that I wanted.

The first method is to duplicate your texture maps and rotate them using the main Landscape Coordinate and a CustomRotator node, then blend them together using a lerp node (with an expression constant in the alpha to conrtol the blend) to try and reduce the tiling effect.

However, while this reduced the effect of the repeating pattern, it still wasn't fully taking care of it.

The second method was to bring math into the equation and work with the Camera/World Position. I relied heavily on forums for this one and it took some trial and error to translate this into working with my first method, but here's what all the pieces put together look like and how I got it all to work.

Let's break down what we're looking at first. 

The first image shows the math that dictates what the camera sees based on its position in the world and we can control the radius of the effect using the 1,000 component attached to the Divide node. The higher the component number the larger the radius and the larger the circle around the camera/player.

What effect are we controlling though? 

In the second image, you will see that I have a second landscape coordinate set up attached to duplicates of the original textures. This second landscape coordinate enlarges these duplicates and then those duplicates are blended in with rotated lerp node, using the math Clamp node as the alpha channel. 

But still, what are we controlling?

We are controlling which texture size the player sees within a certain radius. Within the 1,000 radius, the player will see the normal sized tiled texture, but outside of the radius of influence, the player will see the enlarged texture over the landscape.

This ensures that not only will the textures look more accurate from farther away, but will also reduce the amount of noticeable repeating and will allow for a more believable experience for the player.

Put it all together and you get that giant map that I showed you earlier, and you get your landscape to look a little something like this:

And once you spiff it up with all the fixins like trees, foliage, roads, props, and animals, it'll look a little something like this. 

So that about wraps everything up! As I said earlier, sadly none of this was used but it did end up teaching me a great deal about the Unreal Engine and its terrain system. If anything, I hope this offers some insight into what the Unreal terrain editor can do, and may even help you out in the future!

And if you took the time to read this entire post, I thank you from the bottom of my heart, you are a super trooper.

Until next time!