#8 Create Mountains with Unity. Build the Labyrinth


In this article we are going to see how to create a terrain in Unity using its own tools and we are going to create a labyrinth using the prefabs that were configured in the second article of the project, click here to download the files and to see how to configure the prefabs.

Go to the project’s Main Page

Before we begin, I invite you to watch the following video.

Description of the objective

Create the labyrinth

To create a model of the labyrinth we are going to use the prefabricated ones that we created previously, we will place them in the hierarchy and we will begin to duplicate them and to arrange them in the space, as it is observed in the following figure.

Fig. 1: Setting up the stage using the prefabricated elements shown in video 2.

Create terrain in Unity

To create a terrain in Unity we will use the GameObject “Terrain”, which will allow us to modify its relief and textures in a simple way using different brushes and parameters.

Fig. 2: Using Unity tools we can sculpt relief in the terrain.

Download Files

First we download the next Zip file, extract the folders and take them to Unity.

Fig. 3: Extract the textures from the download file to add them to the project.

Fig. 4: Each texture comes with its Albedo, Metallic and Normal maps.

The next thing we do is remove all the elements belonging to the scenario.

Fig. 5: We start by completely cleaning the stage.

Terrain Component – Unity

As mentioned above we will use the Terrain component to create a mountainous relief for the terrain.

This component uses “Height Maps” or height maps to create reliefs, these maps are grayscale textures in which completely black areas are mapped with minimum height and white areas with maximum height (both heights configured in the parameters), the rest of the gray areas will have a height proportional to its color tone.

We can see this in the following image.

Fig. 6: The terrain works with Height maps.

In the hierarchy right click > 3D Object > Terrain.

Fig. 7: From the hierarchy we create a GameObject type terrain.

In the stage a white plane appears and in the inspector we can see that it has two components that define it, the component Terrain and a Collider type Terrain.

Fig. 8: The terrain appears in the scenario and we can see its properties in the inspector.

Terrain Component Setup

It is important that we first configure the basic parameters of the terrain, such as the dimension and the difference that will exist between the maximum and minimum height. Then we can modify these parameters but we will probably lose the design we had.

As shown in figure 9, click on the gear icon to go to the configuration. Then enter the parameters.

The only thing I’m going to change is the resolution of the land, which will be 1000 x 1000.

Fig. 9: First configure the basic parameters of the inspector.

Fig. 10: We adjust the resolution of the terrain.

Texture Setup

We can paint the terrain using different sets of textures that will consist of Albedo and Normal maps. First we select all the normal maps we have, in the inspector we choose the type of texture as “Normal map” and apply the changes. We do this for all the normal maps we have.

Fig. 11: Select textures such as Normal Map or Normal Map.

Fig. 12: In the inspector we can select the type of texture. Select Normal Map and apply.

Then select the terrain again and click on the brush icon, then on “Edit Textures…”, “Add Textures” (figures 13 and 14).

Fig. 13: Select the brush tool on the ground component.

Fig. 14: We must configure at least one painting for the terrain.

In the pop-up window we can select a texture that represents the Albedo in the RGB channels and its Alpha channel is mapped in the softness. Another texture for the surface Normals. We can also configure the size of the mosaic or TileSize using the fields “Size” and “Offset” that are observed in figure 15.

Fig. 15: In the pop-up window we select an Albedo texture and a normal texture.

Click on Select and choose first the Albedo map and then the normal map.

Fig. 16: We must make sure to select the appropriate maps.

We’ll do this for all the textures we’ll use to paint the terrain.

Figure 17 shows some values that work for TileSizes.

Fig. 17: Working mosaic size values.

Once we set up all the textures, we should have them all available for use in the Textures in Inspector window, as shown in figure 18.

Fig. 18: All the textures of the download have been configured.

Making the labyrinth

First to keep things tidy I’m going to create an Empty GameObject that I call “Maze”, inside which will be all the prefabricated ones that I use to make the labyrinth.

Fig. 19: We create an empty object that will contain all the pieces of the labyrinth.

Then I drag all the prefabs to the stage and start duplicating them and moving them to form the corridors.

Fig. 20: We start by placing all the prefabricated parts on the stage.

To facilitate the positioning of the pieces we can use the orthographic view. In figure 20 at the top right we have what is called a “Gizmo” that shows the axes X in red and Z in blue. By clicking on these arrows we can change the view of the scene and if we click on the cube in the center we can alternate the view from Perspective to Orthographic.

In figures 20 and 21 we can see how this orthographic view is. The effect it produces is as if all the elements were compressed into one plane, so we do not observe the depth.

Fig. 21: Duplicate the pieces and move them on stage to build the labyrinth.

Fig. 22: Using the orthographic view and bringing the camera closer we make sure that the pieces fit together.

We also put some doors on the stage. In video 4 of the series we created the prefabricated door, here is the article.

Fig. 23: We place several doors in the labyrinth.

We go into game mode and go through the labyrinth to detect problems. In figure 5 you can see one of the badly placed doors.

Fig. 24: We test the scene for problems.

Fig. 25: Walking through the labyrinth we found a door that was badly positioned.

Fig. 26: We stopped the game mode to correct the problem.

Relief modeling

Then we’re going to start modeling the mountains. Select the GameObject Terrain from the hierarchy and in the inspector click on the first icon of the component (figure 27).

Then we select some pattern in the section “Brushes” that is observed in figure 28.

Fig. 27: Select the Raise/Lower tool in the terrain component.

Fig. 28: We choose a brush to apply the modification to the terrain.

The next thing we do is paint in the editor and the terrain will gain height.

Fig. 29: We start painting regions of the terrain to produce elevations and create relief.

Another useful tool is the levelling tool (selected in figure 30).

Fig. 30: Select the ground leveling tool.

Fig. 31: We choose the height value at which we want to level the terrain.

This will allow us to establish a certain height and as we pass it over the terrain in the editor, the lower areas will begin to rise and the higher areas will descend, this is illustrated in figures 32 and 33.

Fig. 32: The regions below the level rise and those above descend.

Fig. 33: We can establish zones that will have a certain height in all its extension.

Fig. 34: We go into game mode to observe the mountainous relief from the perspective of the labyrinth.

Fig. 35: The highest part of the relief is in the opposite direction to the sun of the scene.

After playing with the tools for a while, I ended up with something similar to figure 36.

The most important purpose of the relief is to cover the horizon and somehow provide guidance to the player.

Fig. 36: We use the above tools until we are satisfied with the design.

Apply textures to the terrain

In the final phase of this article on how to create a terrain in Unity we will apply the textures configured above.

Select the brush tool in the inspector, a pattern and a texture.

Fig. 37: Select the brush tool, choose the pattern and texture to apply.

Then in the editor we go around the terrain and paint.

We can alternate the textures and with this we can avoid that the ground looks monotonous with an only texture.

Fig. 38: To the base texture we apply another texture in different places to break the pattern of repetition.

The mountains will have a base of earth and then we will be applying in different parts a rock texture

Fig. 39: We give mountains a base with the ground texture.
Fig. 41: We apply the rock texture in different parts of the relief.

Fig. 40: Ground texture in the mountains.
Fig. 42: Rock texture in the mountains.
Fig. 43: Rock texture in the mountains.

From time to time we go into game mode to see how the relief looks from inside the labyrinth.

Fig. 44: We enter the game mode to observe the results.

Fig. 45: Final design of the labyrinth.

Fig. 46: Final design of the mountainous relief seen from the labyrinth.


We’ve seen how easily we can create a piece of land in Unity using the same tools that the engine provides us. We also apply different textures to give it diversity.

The exercise proposed in this article and video is very simple, but with enough time and practice we can build a number of reliefs.

This type of land has the limitation that caverns or caves cannot be built. For that we will have to superimpose another 3D model.

In addition we have created the labyrinth using the prefabricated ones configured in previous entries. Simply by making duplicates and moving in space.

We can make both simple and complex labyrinths and assemble a level selection system if we wish. The possibilities are unlimited.

Let’s bear in mind that this project is only a prototype, in order to achieve a better graphic quality it is necessary to build better 3D models and use a greater diversity of textures and higher quality. It would be nice to add decorative elements such as rubble or trees.

Leave a Comment

Your email address will not be published. Required fields are marked *

Exit mobile version