The following tutorial will show you how to setup a new level and its initial terrain map.
Terrain elevation in the Sandbox Editor is based on the brightness values of the height map textures that have been assigned to the terrain geometry.
Creating a New Level Folder and File
Go to File -> New:
The following file dialog will open. Choose where you'd like to save your level file, preferably the folder Levels in the project's Asset directory, before giving it a name in the Level Name field at the bottom.
Clicking Save opens another window where you can adjust the Heightmap Resolution and the Meters per Unit values according to the size and and detail you require, - for now let's leave everything as it is. Finally, click OK:
Adding Terrain to the Level
We now need to add some terrain - there are three main ways to do this;
Generating Terrain Automatically
Go to the Terrain Editor tab (right side panel). Choose File -> Generate Terrain, the following dialog box will open:
Clicking OK will then generate a randomized map automatically.
The various parameters in theinfluence the appearance of the terrain - the parameters are described below:
Determines the amount of land created
Bumpiness / Noise (Fade)
Determines the degree of bumpiness or deformation of the surface
Determines the number of times that effects will be applied
Variation (Random Base)
Determines the random seeding of the islands.
Blurring (Blur Passes)
Sets the number of times that smoothing will be applied to the noise filter
Cover (Exp. Substract)
Sharpness (Exp. Base)
Determines the sharpness of the surface
Sharpness (Freq. Step)
Determines the number of times that the sharpness filter will be used on the surface
The terrain generated will look something like that in the screenshot below:
This is of course quite an unnatural looking terrain and requires some modification to make it look more realistic. To do this we must adjust the terrain max height.
Setting Terrain Max Height
In the terrain generated the XY dimensions of the level are correct (we set them to 1024x1024). However, the Z value is far too high.
To transform this into a more usable heightmap go to the Terrain Editor -> Edit -> Set Terrain Max Height.
Give it a lower value i.e. lower than the 1024 we set for the X and Y dimensions, let's set it at 320. The top of the terrain will now be flattened off.
Now generate the terrain again Terrain Editor -> File -> Generate Terrain. You'll notice that we have lost the huge sheer drop cliff faces (screenshot above) and acquired a much more realistic looking landscape. This is because the height is now set to a more reasonable value. The outcome will be different every time, because it's randomly generated, but you'll definitely see an improvement in the height of the terrain:
Generating Surface Texture
Now that we have a terrain we need to make it look more realistic by adding elements such as grass, mud, sand, rocks etc. For more information on how to add these elements see the article Giving Your Terrain Some Texture.
Resizing the Terrain
Open the terrain resize window by going to Edit - Resize Terrain.
Here, you can change the heightmap of the level by modifying the Heightmap Resolution setting and Meters Per Unit setting.
Meters Per Unit represents the distance between two vertices (lying on a perpendicular grid) in meters. Adjusting the Meters Per Unit will change the size of the heightmap.
Changing the Meters Per Unit to 1 will make the terrain more detailed and changing to a higher value will make the terrain less detailed allowing you to create a bigger level with the same base heightmap resolution.
The default setting of 2 means that every 2 meters there is a new point.
After selecting the desired Heightmap and Meters Per Unit, click OK, and then select the texture dimensions.