Unity3D development: Create a mountain terrain map in Unity3D

Source: Internet
Author: User

Step 1: Create a new project.
Open the Unity3D software and it will automatically load the "Bootcamp Demo" project file we opened last time. Don't worry about it. After the software is opened, click -->. In the pop-up dialog box, find and enter the folder address for creating the project, or click "select a folder address" next to it. Note: the folder of the created Unity3D project cannot be used as the folder of the newly created Project. Otherwise, an error is reported because the file cannot be found.) then, select the project file package to be imported in, each package has some plug-in functions. Since we created the project file for the first time, we checked all the check boxes. However, this will slow Unity3D loading. After that, we will all be familiar with the functions of each plug-in package. when creating the Unity3D project file, you only need to select the plug-in package to be used. Option panel 3.1:

After all settings are complete, click Create project.

Step 2: Create a terrain.

After creating a new Project, we can see that only the Project file bar and two folders exist in each panel of the new Project, these two folders contain all the files in the project package imported during project creation. In addition, other la s are empty. Don't worry. We will use the File package and system functions to enrich the content of each layout right away. First, click --> on the menu bar to create a plane with terrain attributes, as shown in Figure 3.2:

Step 3: Add a camera.

After creating the terrain, we will find that there is still no picture in the Game animation panel. In fact, the truth is very simple, just like the live broadcast of the concert. The scenes are all set up, and actors are performing on the stage, but there is no camera. How can the audience in front of the TV see the scene?
Next we will create a camera. Click --> to create a camera in the scenario. You can view the star image observed by the camera on the Game animation panel. 3.3:

Step 4: Adjust the terrain size.

By default, the terrain created by the system is 2000*2000 square meters, which is very large during actual editing and inconvenient to operate. Therefore, we adjusted the terrain area, for further editing.
Click --> on the menu bar to bring up a panel to adjust the size of the ground. Change the number to 500. Then, change the number to 500. click the button to change the original terrain to an area of 500*500.
Step 5: Edit materials for the scenario.
Select the created ground object in the scenario panel, you can also select the desired object in the Hierarchy list, which contains the object objects in all scene panels. After selecting the ground object, we will immediately find the corresponding attributes on the Inspector attribute panel, including Position coordinates, Rotation volume, and Scale scaling ], and the sum inherent in the Ground Object. 3.4:


The button like a paint brush is used to change the texture of the ground. After clicking it, we can find the button below and click --> to go to the page, as shown in Figure 3.5:

Click the circle next to it to add your favorite materials to the ground. After the selection, click the button to fill in the new material. The ground 3.6 After the material is added is shown as follows:

If you think the texture of this terrain is too simple, you can click --> to add the second material, and then select the desired brush shape in 3.7:

Then you can click the area range of the new material on the scene panel. 3.8:

Step 6: Create a mountain.

After the ground material is created, you can create a mountain.
Click one of the three buttons and select the appropriate paint brush. In the topographic map, the shape of the mountain is displayed, as shown in Figure 3.9:

If you think that the mountain we have painted is too high, you can hold down the Shift key and use the selected brush to reverse fl.

Step 7: plant grass and trees.

Next we can plant some grass and trees for the terrain. The specific planting button is, the planting button is. The methods for setting grass and trees are similar to those for setting terrain materials. You need to click the button to add the required flowers and trees, then, fl the required area in the scenario panel. 3.10:


Note that Unity3D adopts the method of removing resources in the editing mode to save resources. If you do not see the grass you planted while using the brush, you only need to zoom in to observe the effect of the grass. 3.11:

Step 8: Set the wind speed and shadow effects on the terrain.

Planting grass and trees makes people feel unnatural if they are still running in the game, so we add wind and shadow effects to the terrain to let the grass swing with the wind, this will become more realistic.
Click the button to set the wind speed, shadow, and other effects on the terrain. 3.12:

Step 9: add the illumination effect.

All the effects related to the terrain have been set, but we found that the screen in the Game animation panel is very dark, because no light is added.
Click --> to create a sunlight effect. 3.13:

The relationship between the sun light and the sun itself is not big, but only from its own perspective. This is consistent with the sun in our daily life. To make the scenario brighter, we need to use the rotate button in the scenario adjustment tool to rotate the sunlight. You can also adjust it in the property panel. According to our common sense, when the sun shines directly on the ground, the light is the strongest. The adjusted effect is as follows:

How is the picture displayed on the Game animation panel?

Step 10: camera observation settings.

To enable the camera to fully observe the scenario we just created, you can find and find the three script files in the Project file bar, and drag them to the camera in the scenario in sequence. 3.15:

If you think there are too many files in the Project file bar, you can enter their names in the search box at the top of the Project file bar. This will soon be able to find the corresponding file. After the placement is complete, click the test button and you will be able to roam in the Game animation panel you just created. Use the mouse to control the Angle of View and the arrow key of the keyboard to control the walk. During the process of roaming, you can clearly see the grass just created gently swinging with the breeze. Result 3.16:

Step 2: add the sky effect.

At this time, we can see from the Game animation panel that the sky does not have any effect. Next we will add a sky box for the scene to make the scene have a blue sky effect.
Select the camera object in the scenario, and click --> in the menu bar to add a sky box to the camera. After the camera is successfully added, we can find the added sky box in the camera property panel.
Go to the Project file bar and find the "Skyboxes" folder in the "Standard Assets" folder. There are many material balls for the sky. You only need to select one of your favorite material balls and drag and drop them to Custom Skybox ], the sky of the scene can be filled with this material effect. 3.17 and figure 3.18 are shown in the following figure:


Select the illumination object in the scene, find "Flare" in its property panel, and click the circle behind it. In the pop-up dialog box, double-click the illumination effect so that you can clearly see the position of the sun in the Animation Mode. Run the animation to see the effect.

Step 2: Add a shadow effect.

Careful friends will surely find that the trees and other objects in the current scene do not have shadows, which is not natural. Therefore, to make the scenario more realistic, we can also add the light shadow effect to the scenario.
The method is as follows: select a light object and find it on its property panel. The default value is (no shadow ), you can change it to Soft Shadows or Hard Shadows hardware shadow ]. "Soft Shadows" Soft rendering shadow: Shadow is generated at the cost of CPU computing. This mode runs slowly, but it is the only choice for users with relatively low machine configurations. Hard Shadows hardware rendering shadow: You can use the graphics card acceleration function of the Next Generation GPU to render the shadow effect for the game. It runs fast and has an ideal rendering effect. However, no matter which option you choose, the animation scene objects will have a longer shadow effect than the sun. 3.19:

Step 2: Save the project.

After debugging is complete, press Ctrl + S to save the scenario file, which is called "text" for future calls. If the file is successfully saved, you will see this file in the Project file bar of your Project.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.