Difference between revisions of "Create a Terrain in Unity"

From __space Wiki
Jump to: navigation, search
m (Trees and Plants)
m
 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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, pick Show in Explorer, copy it, paste, and make sure 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, where it should've appeared as a new item in your Assets folder.
+
If using one of the lab computers, start by opening Unity. Go to Projects and choose "EventProjectTemplate" from the list.
  
===Basic Manipulation of the Camera===
+
If you don't have access to a lab computer at _Space.URI or want to complete this on your own, you can download the template [https://drive.google.com/file/d/1gWoo32URu7tIfUMMqhSthSeCFKqcmV3a/view?usp=sharing here].
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 and moving the mouse around.
 
  
===Create the Terrain===
+
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" and '''rename''' the scene, this is done to avoid conflicts with other scenes, which may result in deleting other scenes. Once the new scene is saved, go back to the "Project" tab and open the newly duplicated scene by double-clicking on it. It should appear as a new item in your "Assets" folder.
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, as in underneath the tab name of Hierarchy.
+
 
 +
===Manipulation of the Camera===
 +
To pan the camera hold down middle mouse wheel 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 a terrain, right-click anywhere in the tab labeled, "Hierarchy"  and a new menu should appear (see below, the blue dot is an example where to right-click).
  
 
[[File:createTerrain.png]]
 
[[File: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 appear, but when you select it, there are a lot of interesting options in the Inspector. (If there is any confusion about where all these tabs are, refer to [http://space.apps.uri.edu/wiki/index.php?title=Getting_Started_-_No_Scripting#Overview_of_editor_and_various_tabs this guide] or the image on the whiteboard.)
+
Then, go down to "3D Object", and from the sub-menu that appears, choose "Terrain". Once selected, a large blank plane should appear. Select it, and various options appear in the "Inspector". (If there is any confusion as to where all these tabs are, refer to [http://space.apps.uri.edu/wiki/index.php?title=Getting_Started_-_No_Scripting#Overview_of_editor_and_various_tabs this guide]).
 +
[[File:newTerrain.png|800px]]
 +
 
 +
Make sure to rename your newly added "Terrain" in the "Project" tab!  Do this by double clicking on the name in the "Project" tab, with the second click being longer.
  
[[File:newTerrain.png|800px]]
+
Next you should center the terrain's position, go to "Inspector", the tab in the upper right, and in the "Transform" area, there is a line labeled "Position" where you can change the XYZ position of a selected object.  Type in -249 for the x value, -5 for y, and -250.9 for the z.
  
 
=Editing Terrain=
 
=Editing Terrain=
 
==Hills and Valleys - Adjusting Terrain Height==
 
==Hills and Valleys - Adjusting Terrain Height==
Select the terrain icon that has an up arrow, then 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, no matter what y coordinate that may be.
+
Select the terrain icon which has an up arrow. Make sure "Opacity" is above zero, as this affects how big the hills are.  The brush size can also be changed to make larger mountain ranges.
 +
 
 +
Once adjusted, left click (or click and drag to make continuous formations) anywhere on the terrain plane to raise it at that point.  Pressing the "shift" key while clicking will lower that part of the terrain, though it will not go below the terrain's initial level, regardless of the y coordinate.  
  
 
[[File:raiseTerrain.png]]
 
[[File:raiseTerrain.png]]
Line 25: Line 34:
 
[[File:defaultTerrain.gif]]
 
[[File: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. To enlarge the images in the selection window, use the slider on the top right corner of that selection window. Only textures that are in somewhere in your assets will show up, so import any images you'd like to use first.  The first texture you add becomes the default for the entire terrainIf 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.
+
Add a texture to paint with by going to "Edit Texture", "Add Texture", then click "Select" located within "Albedo (RGB) Smoothness (A)".  Find and choose a texture for the terrain ('''Note''': To enlarge the images in the selection window, use the slider on the top right corner of that selection window). Once chosen, double click on the image and when prompted, select add.  Before doing any painting, set "Target Strength" and "Opacity" to anything above zero.
  
 +
'''Brush size''' is the size of the area that will be affected by clicking on the terrain once.
  
'''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.
  
'''Opacity''' is the transparency or amount of texture applied for a given amount of time you paint.
+
'''Target Strength''' is the maximum opacity that can reach by painting continuously.
  
'''Target Strength''' is the maximum opacity you can reach by painting continuously.
+
The first texture added becomes the default for the entire terrain.  To add another texture, different from the first one, you can paint over the default with the newly added one. A blue outline will indicate which texture is selected.
  
 
[[File:paintTerrain.gif]]
 
[[File:paintTerrain.gif]]
Line 40: Line 50:
  
 
==Add a Tree==
 
==Add a Tree==
Pick Edit Trees > Add Trees, and then when the window comes up, use the file picker (circled below) to choose something that looks like a tree.  It can really be anything you want, but if it isn't setup right as a tree, things may be generated wrong.
+
Pick Edit Trees > Add Trees, and then when the window comes up, use the file picker (circled below) to choose "Broadleaf_Desktop" , "Broadleaf_Mobile" , "Conifer_Desktop" , or "Palm_Desktop".
  
 
[[File:addTree.png]]
 
[[File:addTree.png]]
  
 
==Using the brush to place trees==
 
==Using the brush to place trees==
'''Brush size''' is how large the area you would like to paint with for 1 click.
+
'''Brush size''' is how large the area will be 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.
+
'''Tree Density''' is how many trees will get placed in the circle when clicking  or moving the mouse while clicking and dragging.  Shift click to remove trees in the area you click with a radius of the chosen brush size.
  
 
[[File:trees2.gif]]
 
[[File:trees2.gif]]
 +
 +
 +
If you'd like to learn more about Unity, please refer to our more detailed [http://space.apps.uri.edu/wiki/index.php?title=Learn_Unity_First tutorial!]
  
 
=Test it out!=
 
=Test it out!=
  
 
==Normally==
 
==Normally==
You can view your new terrain by pressing the play button at the top middle of the editor. [[File:playButton.png]]
+
The new terrain can be viewed by pressing the play button at the top middle of the editor. [[File:playButton.png]]
 
 
  
 
==On the Vive==
 
==On the Vive==
You can also try this out on the HTC Vive by first clicking on the collab button.  
+
The new terrain can also be viewed on the HTC Vive, by first clicking on the collab button.  
  
 
[[File:collabButton.png]]
 
[[File:collabButton.png]]
  
Then press publish.
+
Then press publish.  If any prompts come up asking to save the scene, do so.
 
 
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 [[File: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!
 
 
 
 
 
  
If you'd like to learn more about Unity, please refer to our more detailed [http://space.apps.uri.edu/wiki/index.php?title=Learn_Unity_First tutorial!]
+
Next, go over to the computer the Vive is hooked up to, open Unity, and load up EventProjectTemplate.  If the Collab button has an orange arrow next to it (as in [[File:orangeCollab.png]]), click on it and update the project (this will make sure your new scene shows up in the Assets folder). Open the scene, press play, and put on the headset to try it out!

Latest revision as of 16:54, 28 February 2018

If using one of the lab computers, start by opening Unity. Go to Projects and choose "EventProjectTemplate" from the list.

If you don't have access to a lab computer at _Space.URI or want to complete this on your own, you can download the template here.

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" and rename the scene, this is done to avoid conflicts with other scenes, which may result in deleting other scenes. Once the new scene is saved, go back to the "Project" tab and open the newly duplicated scene by double-clicking on it. It should appear as a new item in your "Assets" folder.

Manipulation of the Camera

To pan the camera hold down middle mouse wheel 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 a terrain, right-click anywhere in the tab labeled, "Hierarchy" and a new menu should appear (see below, the blue dot is an example where to right-click).

CreateTerrain.png

Then, go down to "3D Object", and from the sub-menu that appears, choose "Terrain". Once selected, a large blank plane should appear. Select it, and various options appear in the "Inspector". (If there is any confusion as to where all these tabs are, refer to this guide). NewTerrain.png

Make sure to rename your newly added "Terrain" in the "Project" tab! Do this by double clicking on the name in the "Project" tab, with the second click being longer.

Next you should center the terrain's position, go to "Inspector", the tab in the upper right, and in the "Transform" area, there is a line labeled "Position" where you can change the XYZ position of a selected object. Type in -249 for the x value, -5 for y, and -250.9 for the z.

Editing Terrain

Hills and Valleys - Adjusting Terrain Height

Select the terrain icon which has an up arrow. Make sure "Opacity" is above zero, as this affects how big the hills are. The brush size can also be changed to make larger mountain ranges.

Once adjusted, left click (or click and drag to make continuous formations) anywhere on the terrain plane to raise it at that point. Pressing the "shift" key while clicking will lower that part of the terrain, though it will not go below the terrain's initial level, regardless of the y coordinate.

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", "Add Texture", then click "Select" located within "Albedo (RGB) Smoothness (A)". Find and choose a texture for the terrain (Note: To enlarge the images in the selection window, use the slider on the top right corner of that selection window). Once chosen, double click on the image and when prompted, select add. Before doing any painting, set "Target Strength" and "Opacity" to anything above zero.

Brush size is the size of the area that will be affected 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 that can reach by painting continuously.

The first texture added becomes the default for the entire terrain. To add another texture, different from the first one, you can paint over the default with the newly added one. A blue outline will indicate which texture is selected.

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" , "Broadleaf_Mobile" , "Conifer_Desktop" , or "Palm_Desktop".

AddTree.png

Using the brush to place trees

Brush size is how large the area will be like to paint with for 1 click.

Tree Density is how many trees will get placed in the circle when clicking or moving the mouse while clicking and dragging. 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

The new terrain can be viewed by pressing the play button at the top middle of the editor. PlayButton.png

On the Vive

The new terrain can also be viewed on the HTC Vive, by first clicking on the collab button.

CollabButton.png

Then press publish. If any prompts come up asking to save the scene, do so.

Next, go over to the computer the Vive is hooked up to, 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 the scene, press play, and put on the headset to try it out!