Abstract
In the Unity workflow, terrain is an indispensable and important element. Games and virtual reality all use various types of terrain effects, in this tutorial, we need to understand the basic concepts and concepts of terrain creation. A large number of operations are required for the terrain operations of Unity. after familiarizing yourself with these functions, I believe that you will be more comfortable with the creation and use of game terrain.
First look at the final result:
Environment: windows7 64bit Unity3d4.2.1
Required resources: terrain. raw
Create a project
File-> New project
Select the location where the project is stored, and import Skyboxed. unityPackage (sky box), Terrain Assets. unityPackag (Terrain), and Tree Creator. unityPackage (Tree ).
Import another package. You need to import an official tree and lawn package,
Create terrain
In Hierarchy, creatte-> Terrain. The scene automatically generates a plane, which is the basic prototype used by the Terrain by default. The attributes of the terrain are in the inspector on the right.
Generally, heightmap is used for Terrain creation. In unity3d, It is a. raw file. The Raw file records the level map of the gray scale, and the level of the terrain is generated by the gray scale gap. Of course, you can also use the built-in terrain tool to create it.
In inspector, click Import Raw... and select the downloaded attachment terrain. raw. Without changing any settings, press Import to Import the terrain Height map.
After the texture is imported, the original plane is converted to a high-low terrain, and then we can start to plot the texture effect on the terrain.
Terrain texture
Now we need to draw some textures for the mountain, which is the fourth tool. First, we need to import four types of textures: the basic ground, the grass, the stone texture on the top of the hill, and the texture of the mountain foot.
It is best to import a variety of textures, set the brush, first brush a rough, then Brush some details, the effect is as follows:
Foot
Mountain Top
Planting trees and grass
The fifth tool in Terrain (Script)
Because we have previously imported the Terrain Assets package, we can directly import some trees here. The parameters are set in Setting.
Then, we will choose various trees and brush them everywhere!
Similar to the operations on flowers and plants, the sixth tool can start refreshing after importing some models!
Several parameters of the brush, such as Brash Size, Opacity, and Target Strenth, can be adjusted by yourself. It is easy to understand. Click shift while refreshing to delete the image.
Light, sky box, fog, and wind
Although the last part does not belong to the creation of the terrain, it increases the authenticity of the integrated scenario.
Create a directional light directly in Hierarchy and adjust the intensity.
By default, the camera background is dark blue, and the following is to add the sky box to the camera. Select main camera and set the following in inspector on the right:
At this time there is a sky.
Here we use the simplest global fog effect. Edit-> Rendering Setting settings are as follows:
The setting of the wind can be directly set in the attributes of the terrain. After adding the wind, the plants can swing with the wind.
Here, a cool terrain is complete, and the final scenario effect is displayed after compilation and running.
Reference
Ultimate Unity terrain making-go to create gorgeous game terrain-http://www.narkii.com/club/thread-260061-1.html
Unity3D game essential