Unity3d Game Development Terrain System (IV)

Source: Internet
Author: User

http://mahaile.blog.51cto.com/2891586/771167

in the previous chapter, we explained how to create a simple world of games. Let's take a look at the terrain system in Unity3d. Don't talk about it, come on, haha   start by creating a new scene   Click the terrain-> create Terrain menu in the menu bar     upon completion as
 

when creating a terrain system, unity creates a terrain with the default wide-height image resolution, texture resolution, and so on, but we're not afraid to change it .

If you need to see the effect in the game window (that is, the games running window), you need to adjust the position and angle of the camera below

operation mode selected the main camera camera in the Hierarchy and then use the scene editor above the 4 functions (drag, move, rotate, zoom) to adjust the process can be seen in the game window to see the effect of the children's shoes more than a few operations can be skilled operation

  Click the Terrain->resolution menu to set the various parameters of the terrain     as               as shown from top to bottom respectively, the meaning is
  Terrain Width: The width of the terrain

 

Terrain Height: height of terrain

Terrain Length: size of terrain heightmap Resolution: The resolution of the topographic height map. Detail Resolution: Detail resolution, which controls the resolution of the grass and detail grid map. The higher the value, the better the effect, and the more you want to consume the machine performance, the more likely it will be jammed. Appropriate adjustment according to the situation. control Texture Resolution: controls the resolution of different textures. Base Texture Resolution: controls the relative texture resolution, which is defined in a range.     set up Click the Set Resolution button, interested friends can change the parameters dynamically, to see how your terrain has changed?   when you're done, let's add some elements to the terrain.   Select the topographic edit window that appears to the right of the terrain terrain you just created in Hierarchy               in the Red Box explained from top to bottom
  1:position is the location coordinates of the terrain
Rotation coordinates of the rotation
Scale Scaling
This location has 3 properties for any game component     2: These 7 attributes are edit height, edit specific height, set smoothing, texture map, Picture tree model, sketch grass model, and other settings from left to right respectively . Use seven tools to edit a very good game terrain, and later I will introduce the specific procedures of the seven buttons.
  2.1 Select Edit Height the Barusher and settings property bars appear below   Brushes: Terrain drawing Brush, there are many kinds of brush patterns available for us to choose from.
Brush Size: Brush Width Value Range
Opacity: Brush Height value range        
Children's shoes can modify the parameters of the map system to draw height feel the meaning of these parameters
        is I use the editing height dragged out of the effect now a little ugly ha, nothing drops we continue to refine it     2.2 Editing a specific height   and edit the height of the information in the page is similar, just a height to set the maximum height, the editing height of opacity is the maximum height, but here height is the maximum height but opacity must have a value, For example, opacity is set to the maximum height of 80. The Opacity is set to the maximum height of 20.
  2.3 Setting Smoothing
The terrain you pull out of the top will find some of the peaks are slightly rougher at close range, and then we can use the smoothing to smooth out the corners of the peaks.   2.4 Texture Map
This east, is to add to the map, so that the good-looking map and not like the light on the picture resources, we can import the System standard resource library , there are many good-looking terrain resources, of course, you can also add your favorite images to do terrain resources.
Import System Picture resource Select Menu bar assets, import package, Terrain assets Click Import, here is just the resources to import the terrain system at this time you can also import other resources such as               Click Edit Textures a drop-down list appears
Add Textures adds a decal
Edit Textures editing a map
Remove Textures Delete a decal Click Addtextures to add a decal
arrow Markers In the Select a terrain image you like to give the terrain

        Add Terrain Texture ( adding stickers)
splat: Select a map that imports the system's own terrain resources, where you add two stickers to differentiate resources. You can also add your favorite pictures, drag and drop in the project you can see the picture resources here.
Tile size x: set map X- axis width Tile size x: set map y- axis width Tile offset x: set map X- axis offset

Tile offset Y: sets the mapping y- axis offset

Interested Children shoes Modify the parameters to see the effect, here for the moment the default value is used.

  now look back to see if it looks much better, wonderful still in the back, we continue ... .     2.5 Drawing Tree Model
since it's a terrain, of course, there are trees.   Hierarchy tab Bar, click Create-> tree can create a model of the trees, set their own tree model, here we first import the system's own tree model, later in the discussion of the production of custom models.
  because the new project is a map element that does not have trees and grass, it can be imported in the standard repository of Unity3d, as described in the method and texture map. Open Unity3d in the Project tab bar, right-click Import Package-> Tree Creator the standard tree resource model into the project.
  Click Add Terrain Texture Adding a tree model procedure and adding texture maps like
  as
      in the properties of the flower tree model
Brush Size: The brush draws a number of trees at a time, the larger the value, the smaller the lower the value range of 0 to 100.
Tree Density: The percentage between trees, in the middle of a tree in the amount of a tree will have to modify this value, the value range 0 to 100.
Color variation: The range of colour differences between trees, ranging from 0 to 1.
Treeheight: The height of the tree, which is a certain proportion to the scene model, the higher the tree, the higher the value range of 0 to 200. Variation: The height ratio between the trees and the tree, with values ranging from 0 to 30. Tree Width: The width of the trees, which is proportional to the scene model, the larger the tree is wider, the value range is 0 to 200. Variation: The width ratio between the tree and the trees, taking a range of 0 to 30.

        Children's shoes can adjust these parameters before the terrain flowers and watch the effect   I added a tree effect on the terrain as follows    
effects of game run time
    but what we see in the game window is the dark, gray patches of the terrain. This is because the light is not enough, and these unity are for us, remember that we have a chapter on the game object? Now let's add a parallel light (how to add a child's shoes that don't know the parallel light to see Unity3d Game Development to create a simple game world (iii) Add game components), adding brightness to the terrain Children shoes Note Oh, the position of the parallel light is not related to the brightness in the game, the angle is related to the brightness, so we added a parallel light rotation angle can be done   if it looks much better.
 
Picture Grass Model:
  start it not only can the grass, but also can draw some custom model, can deal with some small pieces of little things rich game scene it or the picture tree model somewhat similar here is not more wordy mainly set some 3D game terrain parameters     The following is a list of some of the main parameters of the introduction, the pot friends can drag their own mouse to modify the specific values in the game view can be clearly seen in the effect.   Pixel Error: Control the density tolerance of the terrain, the larger the more smooth, the smaller the terrain angle is more obvious.
Base Map Dist: Controls the distance of the terrain map.
Case Shadows: Whether to show terrain shadows
Draw : Whether to draw a scene model, such as trees, grasses, etc.
Wind Settings Terrain Stroke settings
Speed: Air velocity
Size: The range of the wind

  Learn this chapter children's shoes quickly try to make their own favorite game terrain bar, haha,, this chapter temporarily to this, there is what do not understand the place or missing place welcome positive message, everyone together to learn common progress ka ka

Unity3d Game Development Terrain System (IV)

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.