====== Lab 3: Outdoor Environment ====== {{:public:t-vien-15-3:lab3-image.png?600|}} ===== Goal ===== The goal of this lab is to create an outdoor environment that could serve as a backdrop for an interesting story. Put some effort into the planning and the designing, as well as into making the environment believable. ===== Preparation ===== - Import the "Environment" assets from **Assets->Import Package->Environment**. - Make sure you have an account in the Unity Asset Store. You can create an account on the [[https://www.assetstore.unity3d.com/|store's web page]] if you like. Once you are inside Unity, you can access the store through **Window->Asset Store**. - Browse the Asset Store for free environmental assets such as SkyBoxes, rocks, grass and small structures (you can of course also purchase things you like, but you are certainly not required to spend money in this class ;-) ). ===== Documentation ===== - You will be using Unity's Terrain Engine. For more information about how to use it and for looking up what the different buttons and parameters do, please check out [[http://docs.unity3d.com/Documentation/Components/script-Terrain.html|Unity's Terrain Engine Overview]]. ===== Procedure ===== - **Decide on a Theme** Decide what kind of story you wish to tell. You do not have to decide on any details, just a rough theme which you can summarize in a title, e.g. "The search for the city of gold", "Stranded and lost", "The valley time forgot", "The Dwarves last stand", "Save our planet". - **Plan and Design** On a piece of paper (or on your computer, if that is more comfortable) make a rough map / sketch of an outdoor environment that supports your theme. Remember the following: - You need a "natural" border that keeps the user confined to your environment. For an outdoor environment it is easiest to either make (1) an island surrounded by water or (2) a valley/canyon surrounded by steep slopes / mountains. - Provide a variation in scenery, e.g. low flat areas vs. high cliffs, and plan paths that users can take to reach the most interesting spots. - Choose one location where you can place a structure of some sort, plan to make that location flat enough for a structure to stand. - ** Configure a Terrain Game Object ** Start a new scene in Unity and add **GameObject->CreateOther->Terrain** to it. **Inspect** the object and open the **Terrain Settings** (the gear wheel / cog icon tab in Terrain script component). Choose a terrain size and height. **Tip:** Keep the environment relatively small so that you can quickly travel across it and also so that you can sculpt / populate it relatively quickly. Side lengths of 500m - 1000m and heights of 400m - 700m would work well. - **Center the Terrain** You may notice that the origin of the terrain mesh is in its lower left corner and that is the point that gets placed at (0,0,0) in the world. If you want to center the terrain, change its x and z position (under its Transform component) to be half its width and length. - ** Adjust Terrain Base Level ** Using the **Paint Height** tool (second tab) you can quickly make the whole terrain a certain height, base height. Type a value into the ''Height'' parameter and press the **Flatten** button to do this (useful to carve valleys, but maybe not so useful for making an island). - ** Shape the Terrain ** Use the **Raise/Lower Terrain**/**Paint Height**/**Smooth Height** tools to shape the terrain according to your map / sketch. Make sure to create one flat location for placing a structure. Remember the following: - The SHIFT key gives you the "other" function, e.g. holding the SHIFT using the "Raise/Lower" tool, will activate the "Lower" function. - You can lessen ''Opacity'' to make your brush work in a more gradual fashion, rather than immediately giving you extreme and sharp slopes. - Experiment with the different brush shapes and experiment with light and short mouse-clicks vs. press-and-hold mouse drags. - In the **Paint Height** tool, you can "copy a height value" directly from a spot in the scene by SHIFT clicking on it. - ** Add the FPS Controller ** Import the **Character** asset package if you haven't already. Find the "FPSController" prefab and add it to the scene (and remove the ''Main Camera''). Place the controller on your terrain and test it. - ** Color the Terrain ** Use the **Paint Texture** tool to apply certain textures to certain areas of your map. Load at least 4 different textures into the tool, using the **Edit Textures...** button. These textures form your "palette". When you paint from this palette, play with ''opacity'' and brush shapes to create natural blends between the different textures. Avoid sharp transitions from one texture to another. Remember: - Your palette should include textures for different amounts of slope, e.g. a rock/cliff texture for very steep slopes (it would not make sense to paint those with regular grass for example). - You can paint paths through your environment, e.g. using a dirt/gravel texture. Don't make the path too clean though, since typically those are partially overgrown and faded (unless it's an asphalt road). - ** Place Ocean / Lake ** Find the ''WaterProDaytime'' Prefab and place in your scene. Scale it up to the size of your terrain if you want an ocean, or use a smaller one for lakes. Drag it up/down until the sea/lake level is what you want it to be? It should fill the lowest parts of your map. Play with its ''WaterMode'' property and the material/shader properties (especially ''Wave scale'', ''...distort'' and ''..color'') - ** Place Trees ** Use the **Place Trees** tool to add trees and pay attention to where you would logically find them in your environment. Also, pick tree types that make sense for your theme. Leave some areas without trees, e.g. mountain tops and beaches. Also consider leaving some clearings in forested areas. - ** Add Wind** Pick ''WindZone'' from the **GameObjects->3D Object**, edit its ''Main'' value to change its intensity if the trees are moving too much. - ** Place Details** Use the **Place Details** tool to place grass and rocks, but do it sparingly. - ** Place Structure** Use the Asset Store to import some structure (building, ruin, mechanical device..) in the location you had prepared for it. Use details (decorations) to make that area richer (and to hide the "flatness" of it). - ** Play with Lighting ** Use **Window->Lighting** to change the SkyBox if you have found another one to try. You can use that SkyBox as the ''AmbientSource'', which may make the scene too bright, in which case you can also choose ''Gradient'' as your ''AmbientSource'' which you can carefully adjust to capture the mood you are after. Also look at the ''color'' and ''intensity'' of your ''DirectionalLight'' object, as well as its direction to make all lights and shadow paint a coherent picture. - ** Add ambient sound** Add a looping sound clip to an **Audio Source** component you attach to something like the terrain itself. Search the Internet for Creative Commons licensed sound that you can use if you credit. - **Optional/Extra** Bring in your scripts from Lab 2 and place "pickable" props around your environment that you can collect.