« Tutorials Overview

 
 

Rivers and Streams



Rivers and streams can be created with the side object system. The demo project includes an example.


Scene Object
River 001
Side Objects
Terrain / River Bed & River Surface
Side Object Type
Shape Object
Level
Intermediate

Two Shape type of side objects are used. One to create the river bed shape in the terrain objects and another to create the river surface.

 

The River Bed

 

 

The river bed object adjusts the terrain object to the river shape. To trigger this, "Deformation Object" is switched on and a Mesh collider is added to the surface.

 

 

The river bed can have any shape. Y = 0 represents the water level. 7 nodes are used in the simple example above. One in the center at the lowest level, 2 nodes on the left and just below water surface. The next two nodes on both sides define the default riverbank height.. The two outer nodes have a Terrain Snap Weight of 1, the surfaces will snap to the terrain height at this position. The x position of the outer nodes depends on the terrain heightmapscale. The distance to the adjacent nodes should ideally cover at least 1 terrain grid cell.

When underwater views are involved more nodes could be added to increase the detail of the river bed. This default shape is editable per marker, this is explained further below..

On higher resolution terrains more nodes with a terrain snap weights lower then 1 could be added near the riverbank. The riverbank will be shaped more fluently on higher resolution terrains.

 

The River Surface

 

 

The river surface setup in the Inspector is fairly simple. Most important is setting the material and river script. This is done by dropping the water prefab of your choice in the Target Object slot like the "waterPrefab" in "/Assets/EasyRoads3D Assets/Water/Prefabs" in this example.

The geometry resolution depends on the shape of you rivers. For streams you probably want more detail.

 

 

The default shape of the river shape is a simple flat shape at y = 0. The material in the example uses displacement so additional nodes are added for more detail. To make sure the river surface aligns nicely with the riverbank shape in the terrain, the outer nodes extend to outside the nodes that define the riverbank height.

 

New River Object

A new object type was created in General Settings > Road Types, named "River" and marked as "Side Object" to make sure no road mesh is created. Both the "River Bed" and "River Surface" side objects are active.

 

Creating rivers in the scene

New rivers can now be created quickly through the new object tab (second tab from the left). Select "River" from the dropdown, press "Add new Object" and start adding markers using Shift + Click.

Objects with no roads snap by default to the terrain. You may want to switch off "Snap to Terrain" in the Inspector especially for streams.

Some rivers should align with the terrain, other rivers or stream should be placed more below the terrain. This can be controlled for each river through Y Position value in the main side object settings for that object.

A useful tool for rivers is the "Distribute Y Evenly" option. This button appears after selecting two markers while holding the Shift key. Press the"Distribute Y Evenly" button in the Inspector. The Y position of all markers in between the two selected markers will adjust accordingly.

 

 

The scale tool (Transform Tools > Scale) can be used to quickly scale the width of the river per marker. This scale tool will scale all shape type of side objects, in this case both the river bed as the river surface.

The individual river shape nodes can also be adjusted per marker. The B key activates the display of the shape nodes mentioned above. Nodes can be selected and moved sideways and upwards. When holding the Shift Key all nodes outside the selected node will also move. To change the width, select the node below the water level next to the center node, hold shift and move sideways. Move the next node to change the river bank shape. This was done on marker 6 and 7 for the river in the demo project, the sand area. Note that the river surface should also be adjusted in a similar way.

In a next update it will be possible to update both surfaces simultaneously just like the global scale tool.

Please participate in the survey if you like to see this added as soon as possible.