Main
Tutorials











 

Terrain Part One

Terrain is one of the most important new additions to the new engine, and can be used to give a great sense of realism in a level. In this tutorial I will teach you how to make and manipulate terrain, and apply texture layers to make it even more realistic. Let's get started!

Creating The Terrain

Let's begin by setting up our room. Terrains are extremely large by default, so let's go with a 4096 unit cube for now. To make it easier to see our terrain, add a Light >> Sunlight actor to our room, and point it toward the ground at a slight angle. In order for the Sunlight actor to work, we need to set the walls and ceiling of our cube to Fake Backdrop, so go ahead and do that now. Once that is done, open up the actor browser and place an Info >> ZoneInfo in the map as well. Open up it's properties and set ZoneInfo >> bTerrainZone to True. This tells the engine that this zone will be rendering our terrain.





One thing to keep in mind when making your level is that terrains cannot overlap zones. If you cannot see into the zone where the TerrainInfo actor is, then it will not be rendered. To have terrain displayed in the next zone you will have to add a separate Terrain to that zone.

Now to make our terrain. Click on the Terrain Editing button on the left toolbar. This will bring up our Terrain Editor.



A lot of options here, but don't worry, I will explain them later. One thing you might notice is that there is no Close button in the top corner of the Terrain Editor. To exit it simply click on the Camera button or one of the other buttons in the left toolbar's top section.

New Terrain Button Click on the New Terrain button in the bottom corner and a dialogue box will pop up giving us a few options.



If you are using your own texture pack for your level then put that as the package name. If you don't want to include any extra files, set the Package name to mylevel. For the name, put something to make it easy to identify, like "valley" or "bluebase". For this example I will use terrain1. For the X and Y size, you're going to have to think ahead a little, but for this tutorial we will leave it at the default. These values determine the number of grid rows and columns our terrain will have. For small terrains you will want to lower this number so as to not waste space and slow your map down. For example, a small room might only need a 32x32 terrain, where an entire map made of terrain would use the default 256 value. IMPORTANT NOTE - These numbers must ALWAYS be a power of two, for example 256 x 128, or you will crash the editor. This number is multiplied by the Terrain Scale values (size of each square) which we can change later to determine how big it will be. The Terrain Scale values are set by default to 64, so leaving everything at default will give us a terrain 64 x 256 = 16384 units square. To give you an idea of what the grid spacing looks like when left at the 64 default, look at the following picture:



If you need more fine tuning than that you can lower the Terrain Scale values, but I would recommend leaving them as is, it is low enough for most work. Once you have settled on the values press the Ok button and our TerrainInfo actor will appear in our level.



The first thing I do when it appears is align it to the world grid. This makes it easier to align static meshes to the terrain grid later. To do this, simply right click on the TerrainInfo in any of the viewports and hit Reset >> Move To Origin. If you want to move it elsewhere in the level but still want it to stay on the grid, open up the TerrainInfo properties and set Advanced >> bEdShouldSnap to True.

If you rebuild the level at this point you will see the terrain in the Wireframe Mode, but it isn't showing up in the 3d view. We haven't told the terrain any textures to display, so let's do that now so we can see it. For this tutorial I will be using the AlleriaTerrain texture pack, which includes snow and rock textures. Open this pack up and select the snow01AL texture, then close the texture browser. Click on the Terrain Editor tool and you will see our terrain listed on the Terrains tab at the bottom.



I have highlighted the Size listing for a reason. All the texture layers we make for this terrain must be the exact same size as this, or it will not be displayed correctly, as in the following picture, where I have painted a mismatched texture on the terrain:



To make our first layer, click on the Layers tab. Here you will see a list of undefined red boxes where we can input our terrain layers.



Click on the first one and hit New. A dialogue box will pop up giving us our options for creating that layer.



It is best to keep all the terrain maps in the same Package, and in this tutorial I am placing all of them in the mylevel package. For Name, put something so you will know what that layer's texture is. I will be using a snow texture as the base for this terrain, so I named it terrain1snow. The AlphaHeight and AlphaWidth values must be the same as the Size values I highlighted in the Terrains tab. If you know the U and V scale values you want to use for the texture, enter them at the bottom, but these can always be changed later so it will not hurt to leave them at the default of 1. There is only one more value we need to look at here, and that is AlphaFill. Since this is our first layer, we want it to show up completely filled in on the entire terrain. A completely black alpha value would make it invisible, so click on the small box to the right of "Pick", and choose pure white. Once this is done click Ok and our new layer will be created with the snow texture we selected earlier. Look in the 3d veiwport and our terrain is now visible. Congratulations!



In part two of this tutorial we will take a look at the tools used to manipulate terrain and a few of the options in the TerrainInfo properties. Let's keep going!

Continue to Part Two of this tutorial