Working with landscapes
I´ve been working with landscapes a lot. Its interesting area and very hard to get right. I´m going to share some things that I have found useful and important to keep in mind. In this case I´m going to use Unreal Engine to showcase some aspects along with various environments ranging from scifi to natural landscapes that I have created. I will focus on the landscape materials and some aspects related to it.
I always plan ahead
It's important to think what kind of environment you are creating. How large that environment will be. What kind of biomes there are. The order of various layers. These are just few aspects that I personally trying to figure out before getting my hands dirty.
Here is an example from our game Planetrism where we are using few landscape layers to create some visual variation and also some gameplay opportunities for players. Game takes place in exoplanet environments but we want to keep landscapes still believable and something that feels immersive. There needs to be some kind of logic and rules why those different layers exist and relations between them. In this case there are certain guidelines where different foliage types are growing, different biomes from dry desert like areas to more wet and lush jungles.
You want to keep the layer amount as minimal as possible because it will make things easier to handle and less expensive to render. I usually go with max 4 layers because that allows me to create interesting locations but still keep performance cost at reasonable amount. This is not that simple and I will go more technical later on what I mean with this.
Smooth to rough
I try to approach landscape layers from smooth to rough or large to small. What I mean by that is usually I start with something like sand or grass because that will cover most of the landscape and it's usually the hardest part to get right. Player will be seeing that layer a lot so it should look interesting enough. It's hard to get enough variation for sand or grass layers in order to avoid visible tiling but still achieve interesting results but if you get this right then you should have a good base for the rest.
Then I will focus to next layer like more rough sand and the last layer will be rock. Again this depends on what kind of environment you are making but I think this makes it easier to handle landscape materials and texturing. In the end, it's just a lot of iterating.
On top you can see a fast test example of this approach. On right you see grass that will be covering most of the landscape. Then there is sand, then rough sand and last layer is the rock.
Micro to macro
So now you have those landscape layers figured out and want to start creating actual textures. This is the part I like the most. I usually like to add a lot of details into my textures but details are also the part that might highlight repetitive parts when tiled. That's why I want to test my textures all the time with different tiling in order to minimize this effect. It's almost impossible to avoid this effect fully but there are ways to hide this. That's why I usually like to say that the best artists are those who knows how to cheat.
I think the best thing for hiding tiling effect is to mix landscape layers in a way that it looks more natural. Don't make large areas that are covered with grass but instead try to mix some sand spots there too. Also when you are using height maps for blending it will create a nice feel to it and add variation.
My personal favorite is to blend “macro” normal maps on top of layers. That will hide tiling and also make the ground looking more bumpy than it really is. I usually have this for every layer and on top of that I will have a distance based macro normal map that will be blended on top for same reasons and this will be a global one but I usually like to exclude rock layer from this blend.
One simple trick that you see above is to use texture masks to add slight color variations for layers. In this case I created a brighter areas to give more variation. This works very well for natural layers like grass and sand but also for things like moon surfaces.
Icing on the cake is the foliage. That will help you to break tiling too, especially up close with landscape grass. In UE4 you have an option to generate foliage based on the layers and I use this a lot for small assets like grass and pebbles, basically models that doesn't have to have collision.
This way player should have always interesting results to look at and have a better illusion of that world.
View distance matters
It might look awesome when you are viewing landscape up close but usually it's getting harder to hide tiling when looking at a distance. There are two ways I use to deal with this problem. First thing is to create a system that is tiling landscape layers based on distance. Usually this means lerping another set of textures on top but lower tiling value so what you see up close is tiled more than what you see further away. This will have a huge visual impact and it also reduce visual noise that might happen when you have too much tiling happening with textures. It adds some complexity to your landscape material but if you can afford it you should put that to your highest priority. Hardest part with this feature is to find out right values where the lerping is happening and also figuring out good tiling values for different layers.
I usually use this same material function for other features too. Sometimes I need to change another normal maps when the camera is far away or even blend that distance macro normal map. This same information can be used for controlling tessellation density based on distance or dial down roughness.
On top you see my approach for handling the distance blend. I use the output for the lerp alpha.
Painting layers
Depending on where you are creating the actual landscape heightmap you might have an option to generate splat maps for different layers. WorldMachine, Houdini, Substance Designer are tools that makes that possible and you have a lot of control for that.
With these maps you can get the heavy work done especially for large environment but usually some manual work is required for key parts or for gameplay reasons. In Unreal Engine this is very simple to do and you even have options to use different brush masks to break the results.
Like the example above, its handy to hand paint small details like water puddles but I do not recommend to paint the whole terrain manually by hands.
Let the machine help you with iteration
You always need to iterate, a lot. That's why I try to find ways that makes it faster and minimize manual work. Usually when I find myself doing a lot of hand painting and repetitive work I´m doing something wrong.
Again I'm using Unreal Engine here as an example. You have the option to start with a plain landscape and then manually sculpt it. You have a lot of control here and it's very artistic approach. There are different brush types that you can use but it's very time consuming. When you find out that for various reasons the landscape doesn't work with the gameplay it hurts to go back and manually start tweaking especially when the landscape is really large. Instead of doing this manually you can use external tool for that. Houdini, WorldMachine even Substance Designer just to name a few.
Usually these tools are “procedural” as well and with various noise types and seed number changes you can find interesting results faster. At the end of day it's just a height map that you are making either by hand or with these tools.
Same goes for landscape layer blending. You have the option to manually paint these or you can generate masks using the height field data as a base. You can even make some functions inside your landscape material that will automatically blend layers based on height/slope etc… Below you can see an example for that. In this case a function that will take rock height value and use that to blend rocks on slopes. Then there is few parameters to fine tune this effect.
Landscape textures are also something that you can do cleverly. Instead of manually modeling the hi-poly model, lets say in ZBrush and then bake that down into maps you can do that with tools like Substance Designer or use Quixel tools. This way you can iterate more freely and find the best possible results.
You can´t fully avoid the manual work and I´m not saying that would be the optimal case either but there are always room for improving your workflows and I truly believe that the iteration is the key for many things related to game development. If you can do things faster then there is a better chance to find good results quicker.
Some things to keep in mind
What I´m going to be covering here is from UE4 landscape system but the main concept should work for other engines too to some degree. At the beginning I mentioned that you should keep landscape layer count as small as possible and here I will tell you why.
Landscapes can be huge and complex. That's why the landscape consist of components. These are sections that are aligned next to each others and forms the actual landscape. This is important to keep in mind because there are a lot of features that are relying on this. This way it's easier to handle landscape LOD changes and most importantly how much the landscape material will cost for each component.
The number of landscape components depends on the landscape resolution and usually the more you have these components the heavier it will be. There is a good documentation that you should read https://docs.unrealengine.com/en-US/Engine/Landscape/TechnicalGuide/index.html
Above you can see how the landscape is working. I selected one component that is appearing as orange and you can also see how landscape LODs are working.
Okay so what makes some landscape components to cost more performance? It all comes down to how many active landscape layers you have painted on that specific component and that's what I meant with the 4 layers I mentioned before. Let's say you have a component that only have grass and next to that you have a component with grass, sand, rock and water puddles. The first component is cheaper because the landscape system can optimize inactive layers off when those are not used but the second one will be more complex. So the rule of thumb here is that the more different layers you painted on one component the more expensive material will be for that component, to some degree. There is also a maximum number of active layers per component that you can have but most of the time that's not an issue.
Your actual landscape master material can have a lot of different layers and UE4 will create a kind of material instance from that for every component and disables unused layers. At first this might feel very limiting but its very crucial for optimization and you can use this as an advantage too when you know what layers are used in those landscape components.
I might go more in-depth in the future with adaptive tessellation, tri-planar mapping, slope based blending and how to use UE4 procedural foliage spawning with landscapes but I wanted to keep this at a basic level so anyone can jump in. Let me know what you want me to cover next.
Until next time,
Kimmo K.
You can also find me in the following places too:
UE Marketplace Artstation Twitter Facebook Youtube