maanantai 16. tammikuuta 2017

UNITY 3D - Terrain

NAV16AP

3. jakso lukuvuonna 2016-2017

Let's take a look at the terrain tool in Unity. This time the objective is to create your own outdoor terrain. First create a new Unity project in 3D mode. The Unity terrain tool can be found in the top tool bar under the Game object -> 3D object tabs. Choose terrain and Unity will automatically create a game area for you.

As you can see the terrain is completely black. This can be fixed by adding some light into your scene. Choose directional light from the light tab under game object tab. This light will simulate the sun/moon.

Now there are many options in the terrain object. First tool is used for raising or lowering terrain. This is done with a brush that has different properties. You can change the size and opacity of the brush. You can also decide which kind of brush you want to use. Now start creating your terrain. To raise terrain simply paint it by clicking on the flat terrain. To lower the terrain use shift + right click.





Next tool in the terrain object is paint height which is quite similar to the raise terrain tool. This has additional options in which you can determine the height painted. There is also flatten option in which you can flatten the terrain to the desired height.



The smooth height tool is used to even the altitude differences. It also has options for different brushes as well as brush size and opacity.




After you have created the terrain you want it's time to put some texture to it. This is done with paint texture tool. For this you're going to need textures to paint on. These can be done in Photoshop but make sure that your textures are tileable. This makes your terrain to appear consistent. If you want to do different types of grounds.



Next there is an option for tree painting. First you must assign a tree to paint into terrain. Click the edit trees button and choose add tree. Select tree prefab you want to use. There are built in trees for you to test but it's always better to create your own trees in 3ds Max.



After you have selected the tree type new settings for the tree painting appear. Again you can select brush size that affects the area trees will be painted in. You can also affect how dense the painted trees will be and the height variation of the trees. Shift clicking will remove trees while only right clicking will add them.


The mass place trees button will place trees all over the terrain. You can still add or remove trees with the brush tool after this.

Next button is for little details in the terrain such as grass and rocks.


If you want to add grass to the terrain then select edit details button and add grass texture. Select texture you want to use. Again there are built in grass textures but you can also make your own. There are few settings for the grass such as height and color. Noise spread will control the size of the alternating patches. If the billboard option is selected then the grass will always face the camera.


The add detail mesh can be used for rocks and other 3D objects. This will take a prefab you choose and generate them with properties you have selected. Most important setting in this is the render mode. If you select grass then the object will be flattened into 2D image. With the option vertex lit the object will be rendered as solid, vertex lit object.



Last tool is the settings for terrain. Here most of the settings are quite clear. Base map distance means the max distance where terrain textures are shown at full resolution.

In the detail object and tree settings there are three settings for distance: detail distance, tree distance and billboard start. These will define how far from the main camera the objects and trees will be culled and trees changed to billboard images.

Lastly there is an option for importing and exporting raw. This allows you to set or save heightmap to an image file. You can use your own greyscale heightmap Photoshop file to create detailed terrain.


TASK: Create your own terrain with the terrain tool. Use at least two different textures to paint the terrain. Put some grass and trees in suitable places. Model a rock in 3ds Max and use it with details tool.

Ei kommentteja:

Lähetä kommentti