This document provides an overview of creating terrain layers and painting them on the terrain in the Sandbox Editor. The creation of different terrain types works like the painting in layers in common 2D graphic design programs.
In order to paint terrain, it is necessary to use different Sandbox components. Please refer to the Creating a New Level tutorial to prepare to use this tutorial. See Terrain Painting Tips and Tricks for additional information.
- Preparing a Terrain Layer
- Importing/Exporting Terrain Texture Layers
- Painting the Terrain
- Changing Terrain Tile Resolution
- Terrain Painting Reference
Preparing a Terrain Layer
After creating a new map, on the Terrain menu, click Texture:
Adding a New Layer
The Terrain Texture Layers Editor dialog box looks like this:
The Layer Tasks menu on the left hand side provides quick access to common Terrain Texture Layer tasks. Click Add Layer to add a new layer.
By default, the insertion point will jump into the bar of the new layer so that it can be named directly after creation. It is recommended that you name the layers in a way that identifies their use e.g. rock, grass, etc.
Sandbox uses two components for painting a terrain:
- The first is a low detail texture (Layer Texture) with color information. This texture should be less than 512x512 pixels. This texture is visible from far away distances and provides underlying color information for the surface texture.
- The second component is a Material. The diffuse texture should be a high-pass texture. This material is visible at close distances, often high resolution and can have various Texture Maps like a bump or specular map.
The distance at which low and high resolution textures transition is controlled via the DetailLayersViewDistRatio property found in the properties: RollupBar -> Terrain -> Environment.
Changing a Layer's Texture
Select the layer that you wish you edit.
Click Change Layer Texture on the left toolbar of the Terrain Texture Layers:
Alternatively, you can also use the Layer -> Load Texture menu option.
This will open the "Preview" file dialog box. Select an appropriate low resolution texture.
For most cases you will want to use a low-noise, mid-gray texture such as
Textures/defaults/grey.dds, as this gives you the most amount of flexibility when it comes to color information.
Changing a Layer's Material
Open the Material Editor by clicking on the material property in the Terrain layer, which by default is set to:
Now, from the terrain folder, select a material:
After selecting the desired material, the selected material now needs to be applied to the layer. Return to the Terrain Texture Layer Editor, select the desired layer on the Terrain Texture Layers, and click Assign Material in the Layer Tasks Menu.
Requirements for terrain detail material
The detail material has to use Terrain.Layer shader and should output high frequency variations of gray color.
Usually this can be achieved by applying a high-pass filter on the diffuse texture in Photoshop and by setting material diffuse color to full white.
Base color of material (like green for grass) should come only from terrain base texture.
In other words we put high frequency details into detail material and low frequency into terrain base texture.
Below is an example of the poor blending results that can happen with incorrectly setup materials:
Diffuse = 128 (incorrect)
Diffuse = 255 (correct)
Importing/Exporting Terrain Texture Layers
For information on how to Import and Export Terrain Texture Layers, see the Layer Import and Export article.
Painting the Terrain
Access the layer painter under RollupBar > Terrain > Layer Painter.
At the bottom of this panel, you will notice a list with all of the layers set up in the Terrain Texture Layers.
In the Brush Settings section, there are two sliders that modify the radius of the brush and the hardness of the applied texture.
The Radius slider changes the size of the brush:
|1m brush radius, up close||4m brush radius, from a distance|
The Hardness slider changes the strength of the brushes painting between texture and color. A lower value will only paint the detail texture, while a higher value will include color information and detail texture.
Keep in mind whether the Paint LayerID check box is enabled or not as this will determine if you are painting the detail texture or not. If you just want to paint the detail texture without the color information, then you would have a hardness of 0 and have Paint LayerID enabled. Alternatively if you just want to paint the color information without the detail texture, you would have a hardness of 1 and Paint LayerID disabled.
Now, click and hold down the mouse button in the Perspective viewport and move the mouse pointer around. The terrain will be painted, wherever the brush moves.
The Filter option gives the ability to modify the basic color and brightness of the paintbrush.
Move the brightness slider left and right to control the brightness of the terrain layer.
You can also apply a color tint to the Terrain Layer, click on the colored box to open the color selection window:
You can select a new color from the color window or use the color picker to select a color from the world; this can be useful to improve object and vegetation blending with the terrain.
Click OK and the color option will show the new, selected color.
Now, click and hold down the mouse button in the Perspective viewport and move the mouse pointer around. The terrain will be painted with the new settings, wherever the brush moves.
Changing Terrain Tile Resolution
The terrain in Sandbox can be split into multiple tiles and can be painted with a resolution of between 64x64 and 2048x2048. This gives more flexibility over where higher/lower resolutions can be used in your level. Each tile can have a different material resolution,and the higher the resolution the softer the transition between painted Terrain Texture Layers.
You can split the tile size in your level my selecting the Refine Terrain Texture Tiles option in the Terrain Texture Layers File menu.
The size of the tiles in your level will then automatically split by 4. So if you have 4x4 tiles, after further refinement, you will then have 8x8 tiles. NB: Do this only as necessary, as there is no way to reduce tiles!
You can get a quick overview of the your terrain tiles from the main toolbar in Terrain > Export/Import Terrain Texture.
Here you can see a map of the various resolutions contained in the Forest level:
In order to change the tile resolution of map, please follow the following steps.
Until recently, the method of changing the tile resolution was done through the rollupBar. However, this function has been moved into the Export/Import Terrain Texture tool.
A much more straight forward method of selecting the tile and changing it directly from this window, rather than through the perspective viewport.
Simply click on a tile then click on the "Change tile resolution" button below the tile overview.
Here, you can select the desired resolution. After clicking OK, the terrain will be changed to the new resolution. When you're finished resizing your tiles, simply click "Close" on the tool window.
As you can see, a well painted terrain can look very realistic. If you have a good vegetation setup and good brush placement, you can achieve excellent results in a very short amount of time!
Terrain Painting Reference
|Radius||The Radius slider changes the size of the brush.|
|Hardness||The Hardness slider changes the strength of the brush in applying the material. A lower value will give a softer translucent effect, whereas 1 means the material painting is completely opaque.|
|Paint by LayerID||When set, the painter will only paint the detail texture of the terrain material.|
|Mask by Layer Altitude and Slope||Sets the material to only paint between the Altitude and Slope(deg.) parameters defined below.|
|Mask by Material Layer||Select the material layer from the drop down list to protect it from being painted over.|
|Filter||The Filter option gives the ability to modify the brightness of the material base color. Click the color box to open up the color selector and alter the base color of your material.|
|Altitude||Sets a minimum and maximum altitude mask for painting - the brush will only apply within these boundaries.|
|Slope (deg.)||Sets a minimum and maximum slope mask for painting - the brush will only apply within these boundaries.|
|Tile Resolution||When you press the change button and left mouse click on one of the terrain sectors you can choose a higher or lower detailed ground texture resolution.|