When creating a Scene, the geographical features such as the ground, sea, mountains, are essential.
You can get them from Asset Store, but you can also create your own world by using a function ‘Terrain Engine’ available in Unity.
In this article, I will show how to create terrain with ‘Terrain Engine’.
- 1 Create terrain
- 2 Set up textures
- 3 Create forest
- 4 Create a lake
- 5 Upload the terrain to STYLY
In the menu bar, select ‘GameObject > 3D Object > Terrain’.
Now, a ‘planar’ terrain model has been created.
We make it look more realistic.
Create upheavals and depressions
Since the created terrain is flat, we are going to add realistic upheavals and depressions.
In the Inspector window of ‘Terrain’, there is a group of icons (tool buttons).
Those are the tools to edit terrain.
Select the leftmost tool button ‘Raise/Lower Terrain’ to display the items for editing, at the bottom of the window.
With a brush in the ‘Brushes’ palette selected, click or drag the mouse to add irregularities to the terrain.
When moving the mouse pointer to the Scene window, it changes into a blue shadow-like pointer. Then place it where you want to add irregularities and click the mouse to add them.
In ‘Settings’, ‘Brush Size’ defines the size of the brush and ‘Opacity’ defines ‘variation width’.
The word ‘variation width’ might not describe how ‘Opacity’ works very well, so let’s compare the actual results with Opacity set to 10 and 100. In both cases, I draw in the same way with the same settings except for Opacity.
I think the above animations gives you an idea of what ‘variation width’ is.
Next, create plateaus.
Click the second tool button ‘Paint Height’ to display the settings below.
‘Brush Size’ and ‘Height’ work in the same way as those for ‘Raise/Lower Terrain’.
By setting the ‘Height’ value, you can create the plateaus with the specified height.
Then, in the Scene window, draw in the same way as ‘Raise/Lower Terrain’ to create plateaus.
Now, you have added some plateaus.
Set up textures
Next, apply textures to the terrain.
Prepare the materials for texture
Firstly, import a free texture asset for the terrain.
Download and import the ‘Terrain Textures Pack Free’ asset from Asset Store.
Add texture to Terrain
Select the ‘Paint Texture’ tool button and press the ‘Edit Texture’ button to attach a texture to Terrain.
It displays a pop-up window, so select ‘Add Texture’.
Then the ‘Add Terrain Texture’ window pops up, so click ‘select’ in the ‘Non (Texture 2D)’ box on the left.
It brings up a list of textures. You can choose any, but let’s select ‘GrassUV01’ this time.
Close the window and click ‘Add’.
Now, grass-like texture has been applied to the terrain.
Add the second texture
Currently, the whole terrain has a single texture, so it’s not suitable for the world with multiple colour tones such as grass and rocks.
Therefore, in addition to the grass-like texture above, add wasteland-like texture to the terrain.
As with the first texture, select ‘Edit Textures > Add Textures’.
It brings up the window to select texture again, so select a texture with grey-ish colour.
Close the window. Now, you can paint the terrain with the specified texture by clicking or dragging the mouse.
You can change the texture from ‘Edit Texture’.
Next, plant the terrain with trees to create woods or forest.
Prepare the material for forest
Firstly, import a free asset of trees.
From Asset Store, download and import the ‘Free Trees’ asset.
Add trees to the Scene
Click the ‘Paint Trees’ tool button and select ‘Edit Trees > Add Trees’.
Then the following window pops up, so click the button on the right.
It brings up the list of the imported trees, so select your favourite one.
With a tree selected, move the mouse on to the Scene window. Then the pointer will change into a light-blue marker. Click the mouse to place trees.
Trees are added automatically by dragging the mouse.
Create a lake
Next, create a geographical feature like a pond or lake on the terrain.
Unity doesn’t have a pond or lake-like feature by default, so make a basin on the terrain and pour water into it to make a similar feature.
Import the ‘water’ material
Let’s import the ‘water’ material first.
In the manu bar, select ‘Assets > Import Package > Environment’.
It brings up a pop-up window to import packages, so press ‘Import’ with all the packages selected.
After importing the packages, in the Project view, check if there is ‘WaterProDaytime’ in Assets/Standard Assets/Environment/Water/Water.
This is the material of water we use this time. By the way, ‘WaterProNight’ is the water for a night scene, as the name suggested. So, use it if you place water in a dark scene.
Make a basin
Next, make a basin on the terrain.
In the Inspector of Terrain, set up the parameters for ‘Paint Height’ as follows.
Draw a circle with upheavals by dragging the mouse in the Scene, shaping a basin.
Place ‘WaterProDaytime’ in the Scene
Drag ‘WaterProDaytime’ from the Project view and place it so that it fits into the basin on the Scene.
If the size doesn’t fit, adjust the ‘WaterProDaytime’ by scaling and moving it.
Upload the terrain to STYLY
You can also upload the created terrain to STYLY.
However, if you upload the terrain created with Unity to STYLY as it is, it will cause some problems, for example, you won’t be able to scale or rotate it. In the worst case, you can’t even upload it due to the file size. So, please refer to the following two methods to upload a terrain to STYLY.
The first one can be used for free, but it has drawbacks; only one main texture can be applied and trees cannot be reproduced, requiring another method to place trees in the STYLY’s scene.
The second one can’t be used for free, but you can apply multiple textures and it can reproduce trees.
Congratulations. This is the end of the introduction to the basics of Terrain Engine.
If you can handle the terrain as you like, you will make more variations for your VR-space design.