"Unity 3D" Learning Note 30: Game elements--game terrain

Source: Internet
Author: User

Game Terrain

In the game world, there is bound to be a lot of colorful game elements in the fusion.

They are of a wide variety. The effect is not the same. There are generally two types of game elements: often used. Not used frequently. Frequently used elements are the more important elements in the game. Scripting is generally required to implement certain special functions. For example: The player controls the protagonist object, the enemy needs to attack and so on.

So often the elements that are used directly affect the execution of the game, not often. Let's say the sky, the clouds, etc. in the game. Does not affect the main line of the game. Only improves the overall effect of the game.


Create Terrain

In 3D games, there are often undulating terrain.

This article summarizes how to create the game terrain in the game.

First, select terrain----Create terrain in the navigation menu bar to make a game terrain. Appearance of the selected chart:


(After I turn the closer, convenient and more intuitive to watch)



Terrain parameters

Terrain parameters include terrain width, height, length, resolution, height map, etc. After the terrain has been created. will be able to change them arbitrarily. After selecting terrain----Set Resolution in the navigation menu, the Heightmap resoluton form pops up. Just enter the changes and you can.


A simple introduction to the following heightmap in the Resoluton form:

Terrain width: Total terrain width

Terrain Height: Total terrain Height

Terrain Length: Total topography

Heightmap Resoluton: Resolution of topographic height graphs

Detail Resolution: Detail resolution, mainly used for grass or other models on the terrain. The higher the value, the better the display effect. Of course, the higher the machine configuration is required at the same time.

Detail Resolution per Patch: detail resolution patch

Control Texture Resolution: Controlling map resolution

Base Texture Resolution: Relative mapping resolution



Edit Terrain

So far, our topography is just a huge plane.

To achieve an undulating effect, first select the terrain in the hierarchy view. The terrain is edited in the Inspector View on the right.



There is a button in the Terrain menu:


Their meanings are: Edit the height of the terrain. Edit terrain-specific heights to smooth over terrain. Terrain map, add tree model, add grass and mesh model, other settings.


Then here is the terrain brush:


Brush Size: Brush Width Value Range

Opacity: Range of brush height values


After selecting the Terrain menu and brushes, you can edit the terrain's ups and downs.

Just because the terrain map is grayed out by default, it's ugly.


In the Terrain menu, click the Second button (edit terrain-specific height) to open the set terrain-specific height page. Just like the previous page, there is only one more height:


In the Edit Terrain height page, Opacity: is the maximum height. While editing a specific height page, height is the maximum height. For example, when editing a specific height page, the value of opacity is 100. And the height value is 80, so the terrain is up to 80.


For example with. Click the third button (smooth transition terrain) in the Terrain menu, then select a suitable brush, and then you can smooth over the terrain.


Smoothed topographic map:


Each time the terrain is created, the system will take its own initiative to add terrain Collider (Terrain collision) components to the terrain. This component allows the terrain to sense collisions with other objects.

Give the terrain a physical material after the epidermis. Objects on the terrain will collide according to the set collision parameters, for example: elasticity, power. Friction and so on.


Material: physical material, setting the physical friction effect after collision between model and terrain

Is trigger: whether to open terrain collision

Terrain Data: terrain resources. To connect a terrain file in Project view

Create tree colliders: Whether a tree collision is created



Terrain Map

The system's default gray terrain is simply not flattering.

In practice. To make the terrain look more beautiful. Unity provides a standard resource package for terrains. First we need to import the terrain resource bundle into the current project. Right-click in Project View and select Import-----Terrain Assets.

After import. Learn how to add new textures to the terrain. First click on the fourth button (terrain map) in the Terrain menu bar, and you can see that there is no terrain map in the textures list at the moment. In the lower right corner, click Edit---textures (editing map). A selection list will pop up.


In the select list. Select the Add Textures option. The left form appears.


First, we briefly explain the significance of the following parameters:

Texture: Select a terrain map in the resource directory

Normal map: Select a regular terrain map in the resource directory

Size x: Map X-axis width

Size y: Map y-axis width

Offset x: Map x-axis offset

Offset y: Map y-axis offset

Clicking Select in texture pops up the Select Texture2d form, where all of the map files originate from the Catalog in Project view.


Then select the free-map double-click in the Select Texture2d form and click Add on the Add terrain textures form in the lower-right corner.

Once you've added the terrain map, you're able to render the map. First, select a rendered map directory. Then select a render pen. You can finally render it directly in the scene view.


"Unity 3D" Learning Note 30: Game elements--game terrain

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.