Advanced Git, Second Edition

Git is key to great version control and collaboration on software projects.
Stop struggling with Git and spend more time on the stuff that matters!

Home Unity Tutorials

Using the Terrain Tools in Unity

Learn to create and manage a wide range of terrains in your apps by using Unity’s powerful Terrain Tools and the all new Terrain Toolbox API.

5/5 1 Rating

Version

  • C# 7.3, Unity 2020.3, Unity

For some time now, Unity has been changing its APIs to use a data-oriented model, as Scriptable Objects and Addressables clearly demonstrate. The main idea is to rely on data rather than systems. That data is an asset in your project — a file on your hard drive.

In the past, working with terrains was a nightmare if you had too many scenes. Now, however, Unity has improved the Terrain Tools to use the same architecture. This tutorial is about the new Terrain Toolbox API and new features in the Terrain component.

By the end of this tutorial, you’ll:

  • Know how to install the Terrain Tools API and understand its user interface.
  • Understand the new Terrain Toolbox workflow.
  • Be able to create new terrains.
  • Learn about Heightmaps and Splatmaps.
  • Learn about layers and painting terrains.
  • Discover all of the new brushes and some masks.
  • Create your own landscapes.
Note: This tutorial assumes you already have basic experience with Unity. If you’re new to the subject, check out this Unity for Beginners series first. Additionally, this tutorial assumes you’re using Unity 2020.3 (LTS).

You’ll get plenty of practice creating peaks and valleys, culminating in a full mountain scene.

So what are you waiting for? Dive in!

Getting Started

Download the sample project by clicking the Download Materials button at the top or bottom of this tutorial.

Unzip the files to a convenient location. After extracting, you’ll see the Starter and the Final project folders. Feel free to explore these projects to familiarize yourself with their contents.

When you’re ready, open the Starter project in Unity and buckle up.

The project contains some folders to help you get started. Open Assets/RW, and you’ll see the following:

Folder structure and assets in your project

Here’s what each contains:

  • Scenes: The scenes you’ll work on and the related assets you’ll use. Each scene is specific to one part of the tutorial, and the final one brings everything together.
  • Scripts: A premade script to control the Camera.
  • Skyboxes: The skyboxes used in the project.
  • Terrain Assets: Terrain brushes, layers and textures.
  • Terrains: The terrains you’ll create. As you’ll see later, these form your TerrainData Directory.
  • Unity Settings: The Universal Render Pipeline settings this project uses.

All the necessary assets and scenes are arranged and numbered inside the Scenes folder.

The starter project already contains the packages you need to get started. However, you’ll still need to import two additional packages: the new Terrain Tools and an Asset Sample Pack. These will let you use the Terrain Tools at maximum power.

Installing the Terrain Editor

First, go to Window ▸ Package Manager and select Unity Registry in the Packages drop-down menu in the upper left corner. Select the settings gear in the top right, then select Advanced Project Settings. Make sure the Enable Preview Packages option is checked.

Now, in the search box in the upper right corner, enter Terrain Tool. The Install button will appear in the bottom right corner. Press it and wait until the download completes.

How to install Terrain Tool

One package down, one more to go!

Installing the Terrain Tools Sample Asset Pack

At this point, you’ve installed the Terrain Tools. To get the most out of them, however, you’ll need some brushes and textures.

Next, you’ll download the free Terrain Tools Sample Asset Pack by clicking the Download Asset Samples from Asset Store button, which is also in the Package Manager.

The button to download the sample asset pack

Once you do this, a browser window opens showing the Unity Asset Store. Click Open in Unity, as shown below. Finally, back in Unity, press the Import button in the Terrain Tools Sample Asset Pack window, and you’re good to go. Make sure to check all the boxes!

How to download an additional package of tools for the Terrain Tool

Note: There are two things to watch out for here:
  • If you see an Add to My Assets button instead, you might have to sign in to your Unity account. Remember to sign in to the same account as you did in the Editor.
  • If Unity hangs on Update, press the Open in Unity button in the website again.

Finally, you’re done. Now, tighten that seat belt because the ride’s about to begin!

Understanding the Terrain Toolbox as a Toolbox

Before diving in, take a moment for some necessary theory. There’s no way to emphasize enough the importance of understanding the core concept behind the new Unity Terrain Toolbox. If you’re a Lord of the Rings fan, you can think about the Terrain Toolbox like this:

One API to rule them all,
One API to find them,
One API to bring them all
And in the Terrain Toolbox bind them.

All terrain interconnects through the new Toolbox

(Un?)fortunately, there are no rings, no darkness and no Lord of the Terrains in here — but the Terrain Toolbox does bring all your terrains together and rules them all.

Following this metaphor, the Terrain Toolbox is a real toolbox. This API is an interface between all your scenes and your Project files. If you need to do anything with terrain, the Terrain Toolbox is your one-stop destination.

Note: Remember, terrains are assets stored in your project.

So how does the Toolbox look? Go to Window ▸ Terrain ▸ Terrain Toolbox and open it.

How to open the Toolbox

Basically, it’s a window containing a toolbar with some buttons on the top. Those four buttons are the main Toolbox tabs.

The Toolbox and its toolbar

And that’s all you need to know to get started! Next, you’ll create your first terrain and start using the toolbox.

Getting to Know the “Create New Terrain” Tab

First, look at the Create New Terrain tab. It goes without saying that this is the tab where you create terrains. However, since Unity has added so many new features, you’ll get to know them one by one. Remember, the new Toolbox handles not just one, but lots of terrains at a time.

To start, open Scene 0 located in RW/Scenes/Scene 0.

Note: As you can see, the name of the scene is Creating New Terrain because that’s what you will do. But, for the sake of simplicity, in the future this tutorial will just call them Scene N, with N being its number.

Notice that this tab has five sections:

  1. General
  2. Import Heightmap
  3. Gizmo
  4. Preset
  5. Options

The New Terrain Tab with its different sections highlighted

Next, you’ll examine the most common and useful options of each section.

Creating Your First Terrain

The options section is the last on the page, so it may seem strange to start with it. However, TerrainData Directory is where Unity will store all of the terrain assets you create. You’ll want to set this up first to make sure everything is saved in the same place.

Click the Ellipsis icon. In Explorer, select the existing folder, Terrains, from the path: Using the Terrain Tools in Unity Starter/Assets/RW/Terrains.

Next, in the General section, enter the following values:

  • Total Terrain Width(m): 8000
  • Total Terrain Length(m): 8000
  • Terrain Height(m): 3000
  • Group Settings ▸ Tile Height Resolution: 1025

You’ll learn more about these options in the next section.

Finally, set the material to use for the generated terrain. In the General section, under Group Settings, find the Material Override and select the TerrainLit material from Packages/Universal RP/Runtime/Materials, like this:

How to recover the TerrainLit material for the terrain

Now, click Create.

Lo and behold… congratulations on your first terrain!

Looking Over Your First Terrain

The new terrain looks like this:

A Terrain consisting of a black background with a gray trapezoid on it

Notice that there are three toggles at the bottom of the Options section:

The three toggles in the Options menu

Here’s what they do:

  • TerrainData Name Enable Guid: Appends a GUID to the name of the terrain, ensuring each terrain asset is named uniquely.
  • Replace Terrains: Keeps the TerrainData file intact, but updates the values and mesh.
  • Enable Auto Generate Lighting: Enables that option in the Lighting tab by default.

Now, for the next step in the tutorial!

Understanding the General Section

The General section might seem daunting at first sight, but if you scan the text, you’ll notice it’s just a specialized Transform Component.

You’ve already used Height, Width and Length components. They do just what they describe — set the height, width and length of the terrains you create.

Among others, Tiles and Grouping ID are new features.

Grouping ID is just a number for making groups of terrains that are located near each other. Imagine, for instance, that you need to create distant mountains. You’d create a new group to keep those mountains together, and to ease distancing them from your other terrain in the scene.

Keep an eye on Tile Height Resolution. Very often, people overexaggerate the polygon count. In this tutorial, you’ll use 1025.

Also, for brevity, this tutorial will abbreviate Tile Height Resolution as THR or, simply, Resolution.

Note: The available values for THR may look strange at first, but these are all just (power of 2) + 1. Working in powers of 2 is common when dealing with textures and tiles, as it helps these values fit nicely into a computer’s memory.

What? You don’t believe people overexaggerate? Feel free to change the THR values and see for yourself!

THR 33:
A picture showing a wireframe version of a terrain at 33 THR

THR 65:
A picture showing a wireframe version of a terrain at 65 THR

THR 129:
A picture showing a wireframe version of a terrain at 129 THR

THR 257:
A picture showing a wireframe version of a terrain at 257 THR

THR 513:
A picture showing a wireframe version of a terrain at 513 THR

If you spend too many triangles on terrain, your computer won’t have any time left over to render your other models, like your wizards and hobbits. As a rule of thumb, if your mesh looks solid green and you can’t see its triangles, you probably have the resolution too high and can lower it down!

Now, you’ll learn about another cool feature.

Introducing the Cool New Gizmo Feature

At last! Unity added a terrain gizmo. Activate it by clicking the checkbox next to Gizmo in the Create New Terrain tab.

How to activate the terrain Gizmo

With this tool, it’s easy to check the boundaries and overall height of your terrains. It also gives you an intuitive idea of the extension a terrain has. Unfortunately, you can only use it on one terrain at a time.

What’s it good for? For example, say you want to raise your overall terrain height by 50%. The gizmo will clearly show you both positive and negative headroom, like this:

Gizmo tool showing the headroom of a terrain

Take some time to play around with all the features. Create as many terrains as you want. When you’re ready, go to the next part… where the real fun begins.

Importing Heightmaps

Heightmaps are among the most important and fun tools at your disposal.

Before you begin, switch to Scene 1, located in RW/Scenes/Scene 1.

You’ll notice every folder has a number. That’s because they follow an asset-oriented pattern that relies on instances of objects, so it’s useful to know which scene they belong to.

Now, go to the Terrain Toolbox. Select the Create New Terrain tab and click the Import Heightmap toggle to activate it.

Import Heightmap box of the Toolbox

Inside Scene 1, there’s a heightmap that’s ready for you to use.

How to set up the heightmap to a 16 bit red channel

Note: Although the heightmap is a grayscale image, Unity uses the red channel for it. It’s important to make sure to verify its format in the inspector before proceeding. Otherwise, it won’t work.

Now, make sure the texture format of Heightmap 1 is R 16 bit, then drag and drop it inside the empty box on the Toolbox’s Import Heightmap section (the Select Texture field).

How to drag and drop a texture to the Heightmap in the Toolbox

Now, go back to the General section and use these values:

  • Width: 8000
  • Length: 8000
  • Height: 2500
  • THR: 1025

Finally, take a deep breath and press Create. Behold!

A mountain created from heightmaps

Note: If you don’t see the whole mountain, tweak the values of the camera on the Scene View.

Your Hierarchy will now have a parent GameObject showing the terrain group and the terrain you’ve just created as a child.

Hierarchy of the Terrain GameObject

Look at the name and you’ll see it’s a little… long. Again, Unity appended this name with a GUID to keep your terrain names unique. For the sake of this tutorial, rename it to Terrain_1.

Select it and you’ll see the same old Terrain component in the inspector along with Terrain Data.

As a mental note, Terrain Data is an asset. It’s inside your project, located in the TerrainData Directory you selected earlier. Click it so you can rename it to Terrain_1, too.

Renaming the Terrain GameObject and the Data

Terrain Textures

Is that it? Of course not. Just for a little taste, do this:

  1. Select the Terrain_1 GameObject.
  2. Go to the Terrain component.
  3. Select the Paint Terrain tab.
  4. In the first dropdown below the row of tabs, select Paint Texture.
  5. Find the Layers section.
  6. Click Add Layer.
  7. Find TextureMountainLayer 1 and select it.

Boom!

This PNG explains how to assign a layer texture to terrain

Wait, it doesn’t look so good? Gotcha. Go to the Terrain Settings tab in the same component and adjust Base Map Distance to maximum.

This GIF shows how to adjust the Base Map Distance.

This is the final result:

an image showing a mountain with the texture applied

And there you go. Next, you’ll take a look at the Terrain Settings tab.

Exploring the Terrain Settings Tab

The Terrain Settings tab on the Toolbox is exactly the same as the Terrain Settings tab on the Terrain component… but you can only apply the former, as you’ve read before, to all terrains.

So this…

Terrain Settings Tab

Is the same as this:

Terrain Settings in the inspector

The difference is that, now, you can apply changes locally to each terrain, through the Terrain component, or globally to all terrains in the scene, through the Terrain Toolbox.

If you want to know more about basic settings, please also check this amazing tutorial by Brian Moakley Introduction to Unity: Terrain Generation.

Terrain Utilities Tab

Welcome to one the most important tools. Terrain Utilities is where the Toolbox really exploits its “one-for-all” power.

As a quick introduction, this tab allows you to safely erase terrains. No more lost terrains cluttering your project. Also, you can manage all your layers and splatmaps from here.

Looking at the Terrain Edit Section

In the past, it was common to forget about your terrains and end up having lots of unused files. The worst-case scenario was to erase an important terrain. As you know, they’re assets, so if you erase them… there’s no undo.

Finally (!), you can get rid of unneeded terrains safely. Just select a terrain and click Erase. Unity will take care of the TerrainData for you.

Reviewing the Terrain Layers Section

To begin afresh, open Scene 2. It’s your turn to practice. Your goal is to repeat the process of creating a terrain using a heightmap texture.

Use the values below in the General settings, then add the heightmap located in Assets/RW/Scenes/Scene 2/Heightmap 2. As always, remember to rename the GameObject and the linked TerrainData object, like you did before. This helps you keep track of them.

  • Width: 8000
  • Length: 8000
  • Height: 2500
  • Resolution: 1025
  • Base Map Distance: 20000

How to create a mountain using a heightmap.

Remember, practice makes perfect!

Next, it’s time to look at terrain layers.

Examining the Layers

Before you continue, try to wrap your head around this: A Terrain Layer is an asset. It’s a file in your project that holds textures to paint Terrains. Textures are also assets. Terrains are assets. Palettes are assets. Material Palettes are assets. You are an asset. The writer of this tutorial is an asset. Ray Wenderlich himself is an asset… the whole world is an asset! :]

Joking aside, you have to be extra careful about which asset’s values you’re changing. Otherwise, if you’re looking at a global asset, you’ll end up changing global values. The solution to this is to learn to properly use and edit Layers.

Navigate to Assets/RW/Scenes/Scene 2/TerrainLayers 2 to explore the layers you need for this part of the tutorial.

You can always create new layers by right-clicking in the Unity Editor window and selecting Create and then Terrain Layer. You’ll then add the relevant Diffuse, Normal Map and Mask Map textures.

Now that you have an overview of layers, you can create palettes.

Creating Palettes

Layers in the Toolbox work exactly as they do in popular programs like GIMP, Substance Painter and Photoshop. They stack on top of each other and blend according to alpha values:

How layers stack to make a texture

A palette is just a group of layers. It’s a key element in the hierarchy of tools in your toolbox:

How textures, layers and palettes relate to each other

To create one, go back to the Toolbox, navigate to Terrain Utilities and, in the Terrain Layers section, click the Plus button to add a new layer.

How to create a new palette

Select snow 2 from the assets you just saw, then drag and drop it into your new layer slot.

Order matters here (the top layer will be rendered over all of the others), so repeat this process with dirt 2, then moss 2, and finally rock 2 to complete your palette.

This GIF shows how to add four layers to the Terrain Layers to create a New Palette

Finally, press the Save button in the top right of the Terrain Layers section to save this group of layers as a palette preset. You will be prompted to create a new palette; press OK. For easy reference, you can save it to the same path as the layers: Assets/RW/Scenes/Scene 2/TerrainLayers 2. Name this palette something comfortable, like PaletteScene 2.

Adding the Palette to the Terrain

Done! Now, you’re ready to add the palette to your terrain. Select your terrain in the Scene view and click the Add to Terrain button.

Where the Add to Terrain button is

Your mountain will now be snow-tinted, like this:

A mountain tinted white

Note: Remember, the order of layers in a palette matters. You can play around with changing this order to see how the terrain textures change.

Next, you’ll learn how to use splatmaps to make this mountain more awesome!

Introducing Splatmaps

A splatmap is a texture that uses its own color channels as layer masks. Normally, a splatmap uses four channels: green, blue, red and alpha.

That means, instead of painting snow, rocks and grass directly, you paint green, blue, red and alpha. This decouples the painting process from the chosen textures.

Suppose tomorrow, you decide to change the snow texture to… er… lava. You’d only need to change the texture, not the paint strokes.

In practical terms, you could have:

  • Snow on the green channel.
  • Rocks on the blue one.
  • Grass on the red one.
  • Dry grass on the alpha.
Note: URP supports up to four layers per splatmap.

So, how can you apply a splatmap to your mountain?

Applying Splatmaps

Inside your toolbox, go back to Terrain Utilities and locate Terrain Splatmaps.

Where the Terrain Splatmaps tab is

Click the Plus button to add a new splatmap, just like you did to add a new layer. Drag and drop RW/Scenes/Scene 2/SplatMap 2 into your new splatmap slot, then click Apply to Terrain.

One more step for the magic: Make sure your Terrain object is selected in the Hierarchy, then click Apply to Terrain… and marvel!!

How to apply a splatmap to a terrain with layers.

To recap, each layer in your palette corresponds to a color in the splatmap: Unity paints snow everywhere it’s red, moss everywhere it’s blue, etc. Once again, order matters here. Feel free to reorder the layers in your palette to swap the channels in your splatmap.

The final result:
A mountain after applying splatmaps to it

Experimenting on Your Own

In many ways, creating terrain is an organic process; sometimes great results come from randomly tweaking numbers and painting Picasso-esque heightmaps/splatmaps.

Before proceeding, you can take some time to practice and strengthen your knowledge. Scene 3 is your playground. Try out everything you’ve learned and experiment. Remember to check the terrain values, especially the height, and combine layers to get different results.

Once you’re ready, you’ll learn tools for adding more detail and create an entire scene you can explore!

Importing and Saving Presets

Hope you loved that last mountain! The toolbox has another superpower: You can save pretty much everything as a… can you guess? Yes! An asset. You can save almost any change you make in the Toolbox as a Preset.

For instance, your palette for Scene 2 is a preset. If you go back to Terrain Settings, you’ll also notice a Preset section. The process is the same as before: click Save to convert that preset into an asset. Don’t repeat yourself!

Exploring the Terrain Visualization Tab

Terrain visualization uses the same concept as splatmaps. Unity lets you tint different heights so you can visualize them better. For example, it could help you select better heightmaps or check the overall height of different parts of your terrain.

Also, remember this tool is relatively new; Unity will surely expand on it.

To enable altitude visualization, in the Terrain Toolbox, go the the Terrain Visualization tab. In the Visualization Modes dropdown, select Altitude Heatmap. You can use the Levels slider and list of levels to adjust the bands of color to your liking.

Heatmap function of the Terrain Visualization

Revisiting the Old Terrain Component

The Terrain Toolbox is the new, shiny terrain utility from Unity. But it’s not the first time they’ve added features to create terrain, and many of the previous tools are still accessible alongside the new terrain system.

In this section, you’ll learn the fundamentals to create terrain by hand — particularly, the fundamentals for painting.

Open Scene 4. This scene has six terrains, which were created with just one click using Tiles. Each one has an array of signs with titles. The signs along the X axis represent tools, and the Z axis has an empty space for you to use.

Note: It’s important you go through the list. This will help you know which tool serves you better in the future.

Select Terrain_4 inside of TerrainGroup_0; you’ll see the Terrain Component.

The Terrain Component

There is a row of tabs inside of the Terrain component. These tabs are, from left to right:

  • Create Neighbor Terrains
  • Paint Terrain
  • Paint Trees
  • Paint Details
  • Terrain Settings

Now, you’ll explore each section in more depth.

Create Neighbor Terrains

The first button on the list lets you create neighbor terrains intuitively. When you click it, Unity will display squares to show you where to create one.

The New Neighbor Icon

Just click where you want your new terrain to be and that’s it. You can rename the new terrain and the related TerrainData component as Terrain_4_1. Make it a child of TerrainGroup_0 to better organize the scene.

How to create a new neighbor terrain

Paint Terrain

Now, spoiler alert, this is some heavy-duty stuff. The Paint Terrain has 11 different operations — and four of them have suboperations. That’s why it’s so important to follow along with the examples at least once.

Paint Terrain tools operations

Here are a few useful keyboard shortcuts:

  • A: Brush strength.
  • S: Brush size.
  • D: Brush rotation.
  • Control: On some brushes, this inverts the effect. For others, it works as a modifier.
  • Shift: Enables the smoothing brush.

Next, you’ll find a big list of all brushes with a little example for each.

Reviewing the Brushes

Take into account that most brushes depend on a myriad of tweaks that change the result drastically. So, these examples are just for illustration, but try to follow them.

Height Brushes

The Set Height title

This tool sets an absolute height for the terrain, whether it’s in World or Local space.

How to use the Set Height Brush in Unity

Raise or lower terrain title

Raise or lower the current height of the terrain. Use the Control key to make the value negative and carve the surface.

How to use the Lower or Raise Terrain tool

Paint Brushes

Paint Texture title

Paint textures onto the terrain manually.

How to use the Paint Texture tool

Paint Hole title

Remove chunks of the terrain completely. Use Control to erase holes.

How to use the Paint Hole tool terrain

Stamp Brushes

Mesh stamp title

This tool allows you to select a mesh you like and paint with it. You can use the mesh in Scenes/Scenes 4/Geometry for practice.

How to use the Mesh Stamp tool terrain

Paint Stamp Terrain title

Whereas the Mesh Stamp allows you to stamp with a 3D mesh, Stamp Terrain uses the 2D brush image.

How to use the Stamp Terrain tool

Sculpting Brushes

Sculpt Bridge title

This can create an incline. Control-click the terrain once to start. Click the target once to finish.

How to use the Sculpt Bridge tool

Sculpt Noise title

This tool is awesome! Adding noise into your terrain is an important aspect to making it feel natural. Practice a lot with it.

How to use the Sculpt Noise tool

Sculpt Terrace title

This creates a terraced effect. For when you want to Minecraft your terrain. :]

How to use the Sculpt Terrace tool

Sculpt Clone title

This tool works like the Sculpt Bridge. You click to select an area you want to copy from, then click the part you want to copy to.

How to use the Sculpt Clone tool

Erosion Brushes

Erosion Hydraulic title

Simulates erosion caused by water.

How to use the Erosion Hydraulic tool

Erosion Thermal title

Simulates erosion caused by freezing/thawing temperature cycles.

How to use the Erosion Thermal tool

Erosion Wind title

Simulates erosion caused by wind.

How to use the Erosion Wind tool

So much erosion! Here’s a reminder to conserve and plant some trees. :]

Transform Brushes

Transform Pinch title

Pinches the terrain, excels at creating sharp points. This tool is good for making Italian meringue!

A GIF showing how to use the Transform Pinch tool

Transform Smudge title

Smudges the terrain elevation in the direction of the brush. It’s like kneading the dough for a pizza.

How to use the Transform Smudge tool

Transform Swirl title

Twists the elevation into a swirling pattern. Awesome for swirl lollipops or some cinnamon rolls. :]

How to use the Transform Swirl tool

Effect Brushes

Effect Contrast title

Accents the contrast between lower and higher terrain.

How to use the Effect Contrast tool

Effect Sharpen Peaks title

Sharpens peak features.

How to use the Effect Sharpen Peaks tool

Effect Slope Flatten tool

This flattens terrain while maintaining any slope in the elevation.

How to use the Effect Slope Flatten tool

In the next section, you’ll expand your knowledge about painting terrains by using brush masks.

Introduction to Brush Masks

In this short section, you’ll test brush filters. You already know how to create a new terrain. Open Scene 5 in RW/Scenes/Scene 5.

Import the heightmap from RW/Scenes/Scene 5/Heightmap 5 and use these values as General Settings:

  • Width: 4000
  • Length: 4000
  • Height: 2000
  • Resolution: 1025

As always, remember to rename the TerrainData object, like you did before, to keep track of it. Press Create. The result will look like this:

Terrain on Scene 5 without textures

Now, in the Toolbox, go to the Terrain Utilities tab, open the Terrain Layers section, and select the Palette Scene 5 preset. Then add one more layer using Texture Layer 5 by hand. Finally, move that layer you just added up to the first place and press Add to Terrain.

How to apply layers by hand to the terrain on Scene 5

In this case, you don’t use splatmaps because you’re going to paint by hand.

Brush Mask Filters

What’s new about brushes? Well, they’re now 16-bit. Also, Unity added Filters. You’ll use a couple of them for this tutorial, but you should test them all because they’re super fun.

Note: Remember, heightmaps are textures that use the red channel. Brushes are exactly the same — because they are heightmaps.

How would you go about painting a slope? Nah, it’s easier than that. Unity has a slope filter now.

To use it, select your terrain. Go to Terrain in the Inspector and select the Paint Terrain tool. After that, select Paint Texture in the dropdown.

Below all of the different brush textures, you should see Brush Mask Filters. Click the Plus icon and select Slope.

Notice the Eye icons on the left? They activate and deactivate filters. Your new Slope filter should already be active.

Select the Remap Curve; this is what will be interpreted as a slope. The flatter the curve, the less of a slope there needs to be for the brush to apply the texture. Select the linearly increasing line at the bottom, then right click the green line and select Add Key. Move that key to (0.95, 0.3). This should create a green line with a sudden, sharp rise towards the very end.

Select some material, like snow, and test it.

How use brush filters

Nice, huh? Try one more. Deactivate Slope and add a Concavity filter. This will only paint surfaces that are concave or convex, depending on if you select Recessed or Exposed. Now, give it a try.

How to use filters on brushes to paint terrains

Combining Everything

You’ve made it this far. Guess what? It’s challenge time!! In Scene 6, you can apply everything you’ve learned so far. Practice everything. Try everything. Try different lighting setups to get different moods. You can also try varying camera angles. Test masks and different brushes. Experiment!

As usual, you’ll find a heightmap, a splatmap and lots of other things inside the Scene 6 folder.

When you finish, take a screenshot and post it on social media. Don’t forget to tag us! It would be awesome to see what you’re capable of.

Painting Details and Trees

As a final touch, you can add details and trees to add some flavor to the scene.

You’ll find a tree mesh in RW/Scenes/Scene 6/Tree/Tree and a detail sprite in RW/Scenes/Scene 6/Grass.

At this point, you know how to create your terrains. Remember to use both heightmaps at hand. Combine and create!

To add trees, simply select a terrain, then go to Paint Trees in the Terrain component. Select Edit Trees, then Add Tree and drag and drop the prefab Tree 2 where it says Tree Prefab. Finally, click Add.

Now, you can paint trees.

How to add trees to terrains

To add some details, just select a terrain and go to Paint Details in the Terrain component. Select Edit Details, then Add Grass Texture and select Brush_Grass_01. Finally, click Add.

Now, you can paint grass.

How to add details to the Terrain

Finally, here you have two screenshots for inspiration!

Mountains with a single, bare tree

Mountains with two trees with leaves on them

Where to Go From Here?

You can download all the project files by clicking the Download Materials button at the top or bottom of the tutorial.

In this tutorial, you learned to create and manage your own terrain landscapes using the new Terrain Toolbox API from Unity.

To further detail your landscapes, you can use these assets for free from the Unity Asset Store:

For more information, see this video about the Terrain Tools from Using Terrain Tools Tutorial from the official Unity YouTube channel.

We hope you enjoyed this tutorial. If you have any questions or comments, please join the forum discussion below. Don’t forget to share your own terrains on social media and tag us!

Average Rating

5/5

Add a rating for this content

1 rating

More like this

Contributors

Comments