Unity3d game engine-building basic terrain of the 3D game world (4)

Source: Internet
Author: User

Unity3d game engine: Basic terrain for building 3D games

If the original Yusong Momo article is reprinted, please note: Reprinted to my independent domain name blog Yusong Momo program Research Institute, Original address: http://www.xuanyusong.com/archives/483

Create a 3D Terrain

In the previous chapter, we introduced the simple game plane. Of course, unity3d provides a very powerful terrain Editor, which can be used for all the features you can think of, such as bumps, textures, and collisions, awesome. Build our 3D Game terrain quickly ~ Wow ~~~

Click terrain-> Create terrain to create a game terrain named myterrain.

Adjust the camera angle and add the movement control of the unity3d scene editor to the game terrain we created.

Model rotation: Option + left mouse Creation

Model Translation: Option + middle mouse button

Scaling Model: Option + right-click

In the middle, you can clearly see the game terrain created, and the orientation and display content mapped to the camera.

Once the terrain is created, unity3d will default the terrain size, width, thickness, image resolution, texture resolution, and so on. These values can be modified at will.

Click terrain-> set resolution to open the set terrain parameters menu, as shown in.

As shown in, the meanings of top-to-bottom are:

Terrain width: the width of the terrain.

Terrain Height: Terrain Height

Terrain length: the length of the terrain.

Heightmap resolution: the resolution of the terrain height chart.

Detail resolution: detailed resolution, controls the resolution of grass and detail grid maps. The higher the value, the better the result. The more you want to consume the performance of the machine, the more difficult it may be. Make appropriate adjustments as needed.

Control texture resolution: controls the resolution of different textures.

Base texture resolution: controls the relative texture resolution, which is within a certain range.

After setting, click the set resolution button. If you are interested, you can modify the parameters dynamically to see what changes have taken place in your terrain?

In this way, the terrain surface is created. Add some colorful elements to the terrain...

Colorful Elements

Click terrain in hierarchy. The terrain editing window appears in the right column of Unity editor. Some important information is displayed in the red box.

1. position rotation scale the position of the terrain is rotated and scaled. This window will appear on the right after any model object is clicked, marking the position of the current model in 3D space, modifying the parameter model also changes in the 3D space.

2. there are seven buttons, from left to right: Edit height, edit specific height, set smoothness, texture, draw tree model, draw grass model, and other settings. seven tools are used to edit a nice and practical terrain. I will introduce the specific operation process of these seven buttons later.

Edit height

By default, the cursor is displayed on the edit height button.

Brushes: paint brush for terrain. There are many paint patterns available for us to choose from.

Brush size: paint width value range

Opacity: paint height value range

You can set and drag the mouse and click the terrain to fully understand the meaning of these parameters. Move the mouse left and right to draw the width of the terrain with the paint brush, and move up and down to draw the Terrain Height. Hold down the Shift key and drag the mouse to see the sunken terrain.

The simple terrain shown in shows our eyes. It looks a little rough and don't worry about the future.

Edit a specific height

There is almost one additional height than the information on the editing height page to set the maximum height. In the editing height, the opacity is the maximum height, but here the height is the maximum height, but the opacity must have a value, for example, if Opacity is set to 100 height, the highest height of 80 is 80. opacity is set to 20 height, and the highest height of 100 is set to 20.

Set Smoothness

The terrain created using the above method makes the corner a little rough. You can set a smooth corner transition here.

Texture maps

Add images to the terrain to make good-looking game terrain. In terms of resources, we can import the system standard resource library, which contains many nice-looking terrain resources, you can also add your favorite images as terrain resources.

Right-click the project tab and choose import package> terrain assets. We can see that there are many resource packages in it. For now, We pilot the terrain resources and then consider other resource packages.

Click Edit textures to display a drop-down list

Add textures Add a texture

Edit textures

Remove textures Delete texture

You can add multiple textures to a scenario, such as green for a hill or yellow for a plain.

Add terrain texture (add texture)

Splat: select a texture. The terrain resources provided by the system are imported. Here, add two textures to differentiate resources. You can also add your favorite images. Drag and Drop the images in the project to view the image resources.

Tile size X: Set the X axis width of the texture.

Tile size X: Set the Y axis width of the texture.

Tile offset X: sets the X axis offset of the texture.

Tile offset Y: sets the texture Y axis offset.

If you are interested, modify the parameter to see the effect. The default value is used for the time being ..

As shown in, I added two pasters to distinguish between hills and lands.

This chapter will first come here. The establishment of special map effects, tree models, grass models, and other settings can enrich our game scenarios. I will focus on the introduction in the next chapter, you are welcome to discuss unity3d game development with Momo ~~~

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.