EasyRoads3D V3 Manual
 

 

Creating Roads


 

CREATING THE ROAD OBJECT

Select New EasyRoads3D Object from the EasyRoads3D Menu. A dialog window will appear where you can name the new road object. After clicking the Create Object button the new road object will be added to the hierarchy panel as a child of the main EasyRoads3D Roads game object.

In the property Inspector you will see the EasyRoads3D toolbar:

Once you have created your first road object you can also create new road objects by clicking the most left button in the Inspector of the main EasyRoads3D Roads game object.

 

ADD ROAD MARKERS

Add road markers by activating the Add Markers toolbar tab. Move the mouse to the position where you want the road to start and click the left mouse button while holding the [shift] key.

Continue adding markers according the shape of the desired road. You will see that the road system will create surfaces representing the road and the affected surrounding which are configurable in General Settings.

NOTE: Make sure the scene camera is in perspective (Persp) mode when adding or inserting markers. In iso mode (also if one of the three axis is selected) the markers will be placed in the center of the screen! Click the cube in the center to put the camera in Persp mode.

Tip: For the best results (smoothly bending roads) and road shape control, add markers at more or less equal distances from each other. Avoid big irregular distances between markers.

 

 

INSERT ROAD MARKERS

Insert road markers works similar as adding road markers but instead of adding the marker at the end of the road, it will insert the marker between the 2 closest markers to the mouse position. Make sure you are in Insert Markers mode by activating the Insert Markers toolbar tab and click on a road segment to actually insert a marker!

NOTE: Markers will only be inserted when you actually click on a road segment. Click outside the road will be ignored!

 

MARKER PROPERTIES

Click on one of the generated surfaces to change its properties.

Soft Selection: When enabled for the selected marker all other markers within the entered soft selection distance will be affected to an extend as the distance to the selected marker.

Left/Right Indent. Use this feature to increase the distance between the road and the edge where the terrain has the same height as the road. This is useful in hilly areas to avoid the terrain break through the road because of the Unity terrain LOD system.

Tip: Sometimes you will see the terrain pop through the road. Usually this happens in case of significant height differences between the road and the original terrain height. Try increasing the indent values at these spots, you will probably get better results! It is also worth while to check the pixelError setting in Terrain > Settings. Higher values will result in the terrain popping through the road unless you raise the road far enough above the ground.

 

Left/Right Surrounding: This represents the distance used to level the area between the road and the current terrain height. This property gives you full control over the area around the road, especially in hilly areas.

Tip: It is recommended to experiment with the surrounding settings together with the soft selection tool. You can get spectacular results. It can be used as a terrain shaping tool by itself.

 

Left/Right Tilting. This feature will lift the road up to a maximum of the road width minus 1 meter. You will get the best results when used together with the soft selection tool so the tilting affects all road surfaces in a bended road.

Refresh Surfaces (). By default the road surfaces will be updated instantly after changing one of the above settings. However when Auto Updates in General Settings is toggled off this will not be the case. Click the Refresh Surface button to update the surfaces manually.

Delete Road Marker. Clicking this button will remove the selected road marker.

Tip: Especially when using soft selection on a large distance repositioning can take quite some processing. If it runs too slow, press [shift] while moving the gizmo. This will only move the road markers. After releasing [shift] and the mouse button the surfaces will be updated.

 

Bridge Object: Activate this toggle to create bridges. The terrain will not be deformed while the road geometry will still follow the marker positions.

Distribute Heights: This toggle is associated with bridge objects. Activating it will distribute the road surface heights evenly from the previous marker position to the terrain height at the selected marker position. This feature is useful to create realistic viaducts.

Creating Bridges

Simply select a marker, make sure the road surface area between this marker and the previous marker is raised above the ground and check "Bridge Object". You will see that the white surfaces disappear. This means that the terrain will not be adjusted for this part of the road. Alternatively you can check "Distribute Heights" which will gradually lower the terrain from the previous marker to the terrain height at the selected marker. The shape will be visually represented by the white surfaces. A bridge with distributed heights enabled, consists of at least 3 markers:

  1. The start of the bridge, "Distribute heights" checked, make sure this marker is raised above the terrain or just before something like a ravine where the bridge starts.
  2. One or more middle segments, with "Distribute heights" unchecked, make sure this marker is raised above the terrain
  3. The end of the bridge, with "Distribute heights" checked, at this point the terrain will be leveled up till the height of this marker.
Tip: The best workflow to create bridges is, first make sure the shape of the road that will cover the bridge is smooth. Afterwards check the bridge objects for the affected surfaces.

NOTE: In the case that another road crosses underneath the bridge and when using "Distribute heights" on the bridge segments, make sure there is a middle bridge segment with "Distribute heights" turned OFF. Also make sure that this middle segment clearly covers the other road. This to make sure that the terrain for the other road will be deformed correctly.

NOTE: Avoid enabling bridge object on the first 2 markers of a road object. It will not work. In fact it will make the road object uncontrollable.

 

Start New LOD Segment (Full version & Pro only): In EasyRoads3d v2 you can create and save your road geometry in different LOD segments. Simply check this checkbox when you want to start a new road LOD segment at the selected marker. When rendering the road object you will see that the road asset in the hierarchy now has a number of child assets matching the number of LOD segments. Exporting the road geometry will save each segment in its own group. To create the geometry for your LOD system, export the road with a high resolution, rename the files, switch to a lower resolution and again save the road.

 

Additional Marker Function

When two markers are selected you will see the below buttons in the Inspector:

Align XYZ: This will align all markers between the two selected markers on a straight line

Align XZ: This will align all markers between the two selected markers on the x and z-axis

Align XZ Snap Y: This will align all markers between the two selected markers on the x and z-axis and snap the y position to the terrain height at that position.

Average Heights: This will average the heights of all markers between the two selected markers.

 

SIDE OBJECT MARKER PROPERTIES (Full version & Pro only)

By default markers cannot be accessed when road objects are in render mode (see just below). However when side objects have been built in render mode you will see that the marker objects appear again. By selecting a marker you can adjust the side object settings for this marker for any of the available side objects. Depending on the type of side object you will see the following properties:

Selected Object: this is a combobox with all available side objects. Select the side object from the list you want to edit.

Display Object: Toggle this on/off when you want to render the selected side object for the selected marker.

Spline Node: Toggle this respectively on/off when you want to use this marker for the spline shape. The road scene in the demo project uses this feature for the "Right Fence" in the sharp corner. It cuts of a large part of the road shape. This allows you to create shapes that run independently from the actual road shape.

Distance Sideways: This allows you to move the spline path for the selected side object away from the road shape.



UPDATING THE TERRAIN

One of the main features of EasyRoads3D is adjusting the terrain to the shape of the road. Optionally you can also embed the shape of the road in the terrain splatmap with controls to expand or smoothen the shape.

DEFORMING THE TERRAIN

Click the Level Terrain tab on the toolbar to level the terrain according to the created road and road surrounding surfaces. Depending on the resolution of the terrain and the size of the road this may take a while.

Click the Level Terrain Tab again to switch back to "Edit Mode" and continue adding markers or tweaking markers settings (Full version & Pro only).

Clicking the Terrain tab from the marker toolbar will select the main road object first. In this case, click this tab again to activate the terrain rendering.

NOTE: If you save a scene while an EasyRoads3D objects is in "Render" state and then close Unity, these objects will automatically switch back to edit mode after reopening the scene. This is to make sure the EasyRoads3D object is correctly initialized on startup and also to ensure that the original terrain data is preserved. It is therefor recommended to save your scenes with all EasyRoads3D objects in edit mode.

After leveling is finished the following properties will appear in the Inspector Panel:

ROAD GEOMETRY PROPERTIES

Render: When this property is toggled on, terrain matching road geometry will be created.

Material (Full version & Pro only): This will display the current road texture. Click on the texture to open the Road Texture Window. This will display all available road textures in the folder: /Assets/EasyRoads3D/Textures/Road Textures. You can add your own textures in this folder if you like to use this system. Below each texture you will see the supported shaders for this texture. Currently supported shaders are: Diffuse, Bumped Diffuse and Bumped Specular. The name convention is: texturename_d for the diffuse texture and texturename_b for the bumped texture. When the window opens the specific folder will be scanned and matching materials will be added to the combobox accordingly.

The folder /Assets/EasyRoads3D/Shaders/ contains 6 different depth offset shaders to make sure the road is rendered on top of the terrain. When using a low Field of View on the camera you may still encounter some z-fighting. Most EasyRoads3D shaders have an option to deal with this, Terrain Z Fighting Offset in the material settings in the Inspector. To adjust this for the amended Unity Standard shader, open the shader and adjust the two Offset factor and unit parameters (just below LOD) further downwards.

NOTE: Currently all road objects in a project use the same material. Changing the material on one of them will change the material on all other road objects. In the next release this will be handled per road object individually. Meanwhile you can manually add materials if you like to use different materials per road.

Road Segments (Full version & Pro only): The number of segments over the width of the road. When this number is larger then 1 you will see the following new properties:

  • Bumpyness: the height of the bumpyness
  • Bumpyness Offset: this controls the variation over the width of the road
  • Bumpyness Density: this controls the Variation over the length of the road

Resolution. This represents the geometry resolution of the road.

UVMapping. This allows you to control the texture mapping on the road.

Raise (cm).Represents how much the geometry is positioned above the terrain. On relatively flat surface 2 cm should be fine. Below 2 cm some terrain adjusting is necessary using the unity terrain tools at specific spots.

Save Geometry (Full version & Pro only). This will create a .obj file of the road geometry with the name of the road object saved in the folder project/EasyRoads3D/[roadname]/.

NOTE: When exporting the terrain the geometry will match the position of the resolution slider!

NOTE: The road object created by EasyRoads3D includes uv2 coordinates matching the terrain boundaries. This will allow you to use the terrain lightmap on the road. Simply choose a lightmapped shader for the road material and drag the terrain lightmap in the lightmap slot of this shader.

 

TERRAIN SPLATMAP HANDLING

EasyRoads3D can embed the shape of the road in the terrain splatmap.

Apply Splatmap. When toggled on the road shape will be included in the terrain splatmap. You will have access to a number of splatmap properties.

Terrain texture. Select the terrain texture you like to use for the road shape. The splatmap features support terrains with up to 8 textures (2 splatmaps).

Expand Width: This will make the road shape wider. The actual sizes depends on the Control Texture Resolution of your terrain.

Smooth Level. This will smoothen the edges of the road splatmap slightly. Better results can be achieved in your paint program especially when you use a resolution of 512 or lower. The smoothing algorithm will be improved in next updates. You can find the raw road splatmap in the folder: project folder > EasyRoads3D > [road name] > roadSplatMap.png. You may edit it in your paint program and merge it with the terrain splatmaps.

Offset x/ Offset y. Especially when the Control Texture Resolution is low compared to the size of the terrain the road shape on the splatmap can be slightly out of position compared to the road geometry. Changing the Offset parameters may give better results. Alternatively and recommended, reposition markers to better match the terrain splatmap resolution or increase the Control Texture Resolution of the terrain.

Opacity. Controls the blend level of the road splatmap with the rest of the terrain.

Apply Changes. Click this button to apply changes made to above settings.

Tip: EasyRoads3D supports custom road splatmaps based on the raw shape of the road. You can find the texture with the raw road shape in the folder: project folder > EasyRoads3D > [road name] > roadSplatMap.png. You can modify it in your painting program, make it smoother, add detail, etc. Afterwards you can apply it to the terrain splatmap by running Restore Terrain Splatmaps form the main EasyRoads3D menu and choose Yes when asked if you would like to merge the terrain splatmap with a road splatmap. You can then select the modified road splatmap in the file dialog that will appear.

 

SMOOTH EDGES

This will smoothen the terrain near the indent edges to the left and right over the distance set in Distance (m). Click the "Smooth Edges" button to apply the smoothing.

 

SMOOTH SURROUNDING

This will smoothen the terrain near the surrounding edges to the left and right over the distance set in Distance (m). Click the "Smooth Surrounding" button to apply the smoothing.

SIDE OBJECT SETTINGS (Full version & Pro only)

When this road object has active side objects you will see a button "Built Side Objects". Click this button to create / remove the side objects.

Note: Click the "Terrain" tab once again (or any other toolbar tab) to switch back to edit mode.

Note: The quality/detail of the shape of the road in the splatmap depends on the Control Texture Resolution and the size of the terrain. Increase the Control Texture Resolution for better results. Or edit the splatmap in your paint program.

GENERAL SETTINGS

- The general road settings are displayed in this toolbar item

  1. Display Object. This will toggle the road surface on/off.
  2. Surface Material. This will let you select the surface material for the road surfaces. You can choose between the standard "Diffuse" and "Transparent" shader. The advantage of the standard "Diffuse" shader is that the road and surface geometry is clearly visible on top of the terrain in hilly areas. The advantage of the "Transparent" shader is that you can control the opacity of the road surfaces with the "Surface Opacity" slider that will appear when this option is selected. This will make it easy to accurately draw road shapes when using a road map overlay texture as the terrain texture. The roads on the map will be clearly visible through the road surfaces.
  3. Surface Opacity. This controls the transparency of the road surfaces and is especially useful when you use map overlays. Simply lower the opacity level so roads ont the map are clearly visible. This will make it easier to position the road markers.
  4. Enable Debugging. Check this when you are experiencing issues when using EasyRoads3D. It will write debug info to the console which will help us to solve problems.
  5. Road Priority. Use this to set the priority for this road. When intersecting with other roads the intersection will first use the default crossing settings. Roads with an higher priority will keep their original shape at the crosspoint. Afterwards road priority can be tweaked for each crossing individually.
  6. Road width. This is the width used for road geometry.
  7. Road indent. The part outside the road that will have the same height level as the road. The value of this parameter will always be bigger then the distance between 2 terrain points to avoid the terrain popping through the road geometry, more info.
  8. Raise markers (cm). When adding a road marker the y position of the marker will match the y position of the terrain at the specific point. This property will automatically raise or lower the marker position according the entered value. This is a simple but effective feature to add focus and detail to the road and near surrounding. Set it before adding markers!
  9. Force Y position.This is a useful feature when creating shapes with consistent y position changes, like rivers. When checked you will be able to assign a value. This value represents the y change per meter. When you add markers, the new marker will inherit the y position of the previous marker + this value * the distance between the markers.
  10. Surrounding. Distance between the road and the terrain used for smooth transitions
  11. Closed Track. This will stitch the start and end of the road together and is useful for creating race tracks.
  12. Material. The material and texture for this road. Clicking the road texture will open the EasyRoads3D road materials window. The road textures are read from the folder /Assets/EasyRoads3D/Textures/Road Textures. Drop you own road textures in this folder. Alternatively you can of course swap the Material attached to the Mesh Renderer of the specific road with your own road material once you are finished with the roads.
  13. Geometry Resolution. This controls the geometry resolution of the road surfaces. 1 represents the highest resolution towards 5 representing the lowest resolution level. It is recommended to use the lowest level (5) while creating the road as it will improve performance although it may lead to less accurate results. Just make sure to set it at level 1 when testing the terrain leveling. Level 1 will always automatically be used when building the terrain and road geometry.
  14. Update Vegetation. When toggled on all tree and detail objects near the road will be removed. For both tree objects and detail objects individually you can specify the distance to the road within these objects will be removed. Depending on the number of tree and especially detail objects in the scene this process can take up some time. You may choose too disable this feature during testing the road and terrain leveling to speed up rendering the terrain.
  15. Auto Create Side Objects. When toggled on, active side objects will be automatically generated immdeiately after deforming the terrain.
  16. Active Side Objects (Full version & Pro only). Here all available side objects will be listed. You can toggle on / off side objects for this particular EasyRoads3D object. This will make it much easier to control your scene and manage side object settings per marker

NOTE: EasyRoads3D uses layers 29, 30 and 31. Make sure other game objects in the scene are not on one of these layers to avoid unexpected behaviour!

 

Customized Road Shape to Terrain Splatmap

The road shape is saved in the folder [your project]/EasyRoads3D/[Road Object Name]/roadSplatMap.png

You can open this in your paint program to customize the splatmap. To embed the customized shape in the terrain, select Main Menu > To add it to the terrain select Main menu > EasyRoads3D> Restore > Terrain Splatmap data. You will be asked if you would like to merge the terrain splatmap backups with a road splatmap. Click yes and select the customized texture.

NOTE: Photoshop users, it is recommended to use "Save for web..." to save the png. If you save the image using "Save as...", be sure to select the png format. Do not simply select the already existing file in your folder as this will probably NOT import well in Unity.

NOTE: DO NOT use the splatmap features if you are using more then 8 textures on your terrain!

 

Exporting Road Geometry

The road geometry exported from EasyRoads3D contains vertex info, face info and one set of UV coordinates. You will have to apply normal info in your modeling application. If you exported the geometry with terrain lightmap support you will see 4 corner faces. Select all road faces and corner faces and use a planar type of uvmapping on the second channel. Save or export to .fbx. In Unity make sure that the import setting for size is 1. Choose a lightmap supported shader on your road asset and drag the terrain lightmap to the shaders lightmap slot. Drag the asset to your scene go to the EasyRoads3D menu and select "Position Road", browse to the EasyRoads3D terrain export file and select it. The road will be positioned correctly.

Depending on your modeling application and/or the export settings you used to export the road, it could be that you have to rotate the object on 1 or more axis. The "Position Road" editor script has some commented code in it that can take care of this automatically once you figured out the correct settings for your case. Just uncomment the lines and fill in the correct values.