Create a Terrain in Unity

From __space Wiki
Revision as of 10:21, 7 November 2017 by Steph (talk | contribs)
Jump to: navigation, search

If you're using one of the lab computers, you can start by opening Unity. Go to Projects and choose "EventProjectTemplate" from the list. In the "Project" tab right-click on "Empty World", (in "Assets") pick "Show in Explorer". Right click again on "Empty World", copy and then paste inside "Assets". Right click and go down to Rename to rename your scene (otherwise you might get conflicts with other people's scenes and yours might get erased). Go back to Unity and you can open this newly duplicated scene by double-clicking on it, again in the "Project" tab. It should appear as a new item in your "Assets" folder.

Manipulation of the Camera

To pan the camera hold down middle mouse click and move the mouse around. You can also rotate the camera by holding down the Alt key, Left click, and moving the mouse around.

Create the Terrain

To create your terrain, first right-click in the tab labeled Hierarchy (see below, the blue dot is where I right-clicked). To get this menu you can right click anywhere inside the Hierarchy tab.

CreateTerrain.png

Then, go down to 3D Object, and from the sub-menu that appears, choose Terrain. Once you pick terrain, you should see a large blank plane. Select it, and a lot of interesting options appear in the Inspector. (If there is any confusion about where all these tabs are, refer to this guide or the image on the whiteboard.)

NewTerrain.png

Editing Terrain

Hills and Valleys - Adjusting Terrain Height

Select the terrain icon that has an up arrow. Make sure opacity is above zero, this represents how high up the highest point where you click should be. Make sure to adjust brush size as well if you'd like to make bigger mountain ranges.

Once you've adjusted the opacity and brush size to your liking, left click (or click and drag to make continuous formations) anywhere on the terrain plane to raise it at that point. pressing shift while clicking will lower that part of the terrain, though it won't go below the terrain's initial level, regardless what y coordinate that may be.

RaiseTerrain.png TerrainHeight.gif

Adding Texture to the Terrain

Pick the paintbrush icon from the terrain toolbar. PaintTerrain.png

DefaultTerrain.gif

Add a texture to paint with by going to Edit Texture, then Add Texture, then Albedo (RGB) and Smoothness (A), Select, and choose a compatible image type for your terrain (Note: To enlarge the images in the selection window, use the slider on the top right corner of that selection window). Once you've chosen something, double click on that image in the selection window to actually select it and then back in the "Add Terrain Texture" window, and finally press add.

Brush size is the size of the area you'll edit by clicking on the terrain once.

Opacity is the transparency or amount of texture applied for a given amount of time you paint.

Target Strength is the maximum opacity you can reach by painting continuously.

The first texture you add becomes the default for the entire terrain. If you add another texture aside from that first one, you can paint over the default with the newly added one. Whichever texture has the blue line or rectangle underneath is the texture you have currently selected to paint with.

PaintTerrain.gif

Trees and Plants

First, select the Tree icon. TreeIcon.png

Add a Tree

Pick Edit Trees > Add Trees, and then when the window comes up, use the file picker (circled below) to choose "Broadleaf_Desktop" or "Broadleaf_Mobile". (It can really be anything you want, trees usually work better given that's what the "Place Trees" tool is intended to do)

AddTree.png

Using the brush to place trees

Brush size is how large the area you would like to paint with for 1 click.

Tree Density is how many trees will get placed in the circle when you click or move the mouse when you click and drag. Shift click to remove trees in the area you click with a radius of the chosen brush size.

Trees2.gif


If you'd like to learn more about Unity, please refer to our more detailed tutorial!

Test it out!

Normally

You can view your new terrain by pressing the play button at the top middle of the editor. PlayButton.png


On the Vive

You can also try this out on the HTC Vive by first clicking on the collab button.

CollabButton.png

Then press publish. If any prompts come up asking if you'd like to save your scene before doing anything else.

Next, go over to the computer the Vive is hooked up to, and open Unity, and load up EventProjectTemplate. If the Collab button has an orange arrow next to it (as in OrangeCollab.png), click on it and update the project (this will make sure your new scene shows up in the Assets folder). Open your scene, press play, and put on the headset to try it out!