The Road Tool uses a series of points to shape terrain and/or apply a texture on top of the terrain texture. Its use is not limited to designing roads in the traditional sense, but can also be used generally to shape terrain.
After the road is placed, the points in the road can be edited, and the terrain can be aligned to the height and curvature of the road.
Depending on the purpose of the road, it may be useful to first place a vehicle in the level so that you can test the width, curvature, and slope of the road.
Be sure to also take a look at the Road and Decal Sorting Priority article as it contains helpful information for road setup.
Creating a Road
Navigate to Create Objects -> Misc -> Road. As with all of the tools in the Misc category, click to activate it.
With the Road Tool selected, click on the terrain to place the starting point, which is the first key point of the road.
Continue clicking to place a series of points that will make up the road. The more points you place, the greater the degree of control you will have over the general direction, curvature, and height of your road.
For now, simply make sure to place points at varying heights and don't worry about empty or missing terrain underneath the path of the road.
To set the last point, double-click the desired spot.
Modifying the Road's Properties
With the road selected, look on the entity's Properties Panel to see the road's properties. Here you can adjust the width of the road and a number of other properties.
After adjusting the width of the road, make sure to re-align the heightmap in order to take into account the additional width of the road. Also note that increasing the width will stretch the texture if it is not designed for the specified width.
Changing the road parameters will allow you to make the road look even better.
The Width of the road.
Only used for the Align Height Map function, this will make a smooth edge on the terrain geometry if the BorderWidth value is higher than the Width value.
Smaller StepSize will increase the polycount used for the river surface, so for roads with smooth corners, you want to use a smaller Size than the default 4.
Specifies how far the road entity will be rendered.
The Length of the Road Texture. Tweak this in combination with StepSize to avoid stretching textures.
This setting can be used if you want to have a specific road to be drawn above another road.
If set to true, this will allow the road texture to be rendered over terrain holes.
Material Settings for Roads
Roads are basically Decals placed along a spline, so the material setup is fairly similar, with a few additions.
The material must use the Illum Shader. It should also use the Decal and Vertex Colors check-boxes in the Shader Generation Params:
|Decal + Vertex Colors Enabled||Vertex Colors Disabled||Decal + Vertex Colors Disabled|
As you can see above, using both Decal and Vertex Color options allows for a nice blend with the terrain.
- Decal: Activating this allows the alpha blending on the sides of the road, which comes from the Alpha channel of the Diffuse texture.
- Vertex Colors: Activates a blend fade-out at each end of the road. This is a 100% to 0% fade-out over the length of the final step. Textures/Alpha channel has no influence on the fade-out.
While setting the material Opacity value to 99% or less will also activate the alpha blending, you get much more control over the material by setting it to 100% and then using the Decal parameters.
Applying a Material to the Road
Up until now, the road has only shown its spline helper on top of the existing terrain texture.
To set a material, select the road entity and on the Properties Panel, click the Material field under the General section.
After selecting the material, click the Assign Material to Selection button (or right-click and Assign To Selected Objects).
Now if you look at the road you will see the texture applied on to of the terrain texture. If you look closely, you will see that the texture is always projected on the surface below the geometry that defines the road. Thus, the road doesn't need to be perfectly aligned on top of the terrain.
The road segments between the key points try to smooth the bends in the road to creating a more realistic look.
Modifying a Road
After you have placed the road, it can be easily modified with a selection of tools available to you.
Edit button will allow to modify, add (CTRL + click on a line) or delete (double-click on a point) points on the line of the road shape.
Sets the Angle of the road per Point.
Sets the Width of the road per Point.
Splits the road at the point on which you click.
Merges two roads. Roads can only be merged at either start or end nodes.
Align Height Map
Will modify the terrain geometry based on the shape of the road and its border width parameter.
Click Edit in the Road Parameters section (if the button is disabled, deselect the road and select it again).
You will now be able to control every key point on the road. You can change the X, Y, or Z positions separately, X and Y together, or move the key point on top of the terrain. For this, choose one of the axis lock modes in the taskbar.
Now, click a key point of the road and drag the point to its new position. Choosing the Lock on Z Axis mode enables you to change the height of this key point to manually smooth the road, if the particular section is too steep.
With Align Height Map and by modifying the key points, you can place the road exactly where you want it to be.
When you enter Edit mode, you can select individual points of your road. Deselecting Default Width will allow you to type a specific width for the road at that point in the type in box below.
There may be some instances where you wish to split a road into multiple segments. This can be easily achieved by using the Split function in the Road entity's Properties.
Select the road you wish to split. Now activate the Split function in the road tool's properties.
The spline keys will change to a pink color to signify they're in Edit mode, else they'd be colored green.
With the split function activated, select one of the keys nearest to where you want to split the road.
Now the road has been split and a new instance of the cut-off road is created.
You may notice the new road ends abruptly, this is because the final spline key along that road is positioned right near the second last one, thus ending the road fade-out early.
Go into Edit mode on the newly created road and drag the final spline key over the top of the other road to blend them nicely together.