Tutorial: Using the River Tool With complex environments terrain details such as rivers, roads and vegetation are vital to increase visual appeal and create worlds that are dynamic and interesting. One of the most useful tools in the Lumberyard Editor is the River tool which allows us to draw 2D Rivers into already completed terrain sculpts. You will learn how to do the following: • • •
Access & Layout the River Tool Set the River Parameters Add a Watervolume shader to the River Tool
Prerequisites This tutorial requires that you have successfully downloaded and installed the Lumberyard Editor. This tutorial also requires you to use the styletown assets included with the Lumberyard download. You must have the following before starting this tutorial: •
Lumberyard Editor v1.6.0.0 or later
It is recommended that you are familiar with the Lumberyard interface and have been following along with the Getting Started series. Tutorials on the Getting Started series can be found here: • •
Getting Started: Understanding the Interface Getting Started: Making your First Level
Step 1: Accessing and Laying Out the River Tool The first step in the tutorial is to open your My_First_Level file or open one of the Getting Started Levels by clicking Open Level in the Welcome Window and navigating to GettingStartedFiles -> Start-Section08-Physics. Open the file. To add rivers to your scene follow these steps: 1. In the Objects tab of the Rollup Bar under Misc, select the River tool and notice the change in the mouse cursor. This will be the start point of the River.
2. Click once to place the River Tool Start Point and click additional times to add more points to the river spline. Once you have a path that you like, double-click to de-activate the River Tool.
Note: If you start to draw the River Path and cannot see the path make sure you have activated the Helpers Icon located in the upper-right corner of the Perspective Viewport.
3. Select the river path. Under the Spline Parameters sub-menu in the Rollup Bar there are options for editing the individual points along the River. To edit the river points click on the Edit Button. This will allow you to modify the parameters of an individual point along the river path using various tools:
1. Edit – Activates edit mode allowing manipulation of individual points along the river path 2. Default Width – Toggles the ability to adjust the river width of individual points 3. Width – Set custom width of an individual point 4. Split – Split the River spline at the selected point 5. Add Point – Add points to spline by clicking along the spline
4. Edit the river points until you have a layout that is satisfactory. Once finished we are ready to begin adjusting the River Parameters and add depth and character to our river.
You have now set up a basic river path and can begin customizing the river behaviors using River parameters.
Step 2: Setting River Parameters The River tool comes with many parameters that allow us to adjust the various physics behaviors and visual elements associated with the River including texture tiling, river depth and width, speed of physicalized objects along the river path and much more. To Set the River Parameters: 1. Now that we have a River laid out we can begin adjusting some of the Parameters in order to get the visual quality and fluid behaviors we want. The River Parameters include but are not limited to:
1. Width – Sets overall width of the River. 2. BorderWidth – Creates a smooth River bed when value is greater than width 3. StepSize – Sets distance between each point along the spline. Higher numbers lower polycount. 4. ViewDistanceMultiplier – Sets render distance of the River 5. TileLength – Length of river texture. Use with StepSize to control texture stretching. 6. Depth – Set depth of river 7. Speed – Defines the speed physical objects move along the river path 8. UScale – Set Texture Tile along U Axis 9. VScale – Set Texture Tile along V Axis 10. Caustics – Enables optical caustics effects 11. CausticsIntensity – Scales caustics intensity 12. Caustic Tiling - Allows tiling of caustics independently from the surface material 13. Caustic Height – Sets height above surface where caustics become visible.
2. Play around with these settings until you have a river path you are satisfied with. You will probably have noticed that some of the River points do not align with the terrain. This can be corrected using the Align Height Map tool under the River Parameters sub-menu.
1. Align Height Map – Aligns the Terrain Heighmap to account for the river spline path and any set parameters 2. Erase Vegetation – Removes any vegetation from the river spline path.
3. Once you have your river positioned click the Align Height Map button to modify the terrain to the path of the River Tool and the associated parameters. Adjust the Spline path and parameters as necessary in order to achieve the results desired. 4. Some tips for creating interesting Rivers in Lumberyard are to set the Width and Border Width parameters very wide on the River spline. Then, lower the River path to rest just below the Terrain patch and press the Align Height Map tool to give the path shape. Having a zero for Border Width creates a river path with a sharp edge, while a higher vale creates a sloping shore.
1. Once you have a river path that you are satisfied with you can go back over the river bed with the Terrain Sculpting brushes to adjust the look of the river adding additional shore details or eddies. Note: The Align Height Map tool works best when the river spline runs along fairly flat terrain features as the adjustment to the terrain heightmap can create texture and shading artifacts. You have now successfully used the River Tool to carve out a river bed in your scene. Next lets add a Material to the River to give it some character.
Step 3: Assigning a Material to the River While it is possible to set up the terrain to use the provided Ocean Shader in order to create rivers, we have a stock Watervolume shader in the Material Editor that will allow us finer control over the direction of the water, its speed and the tiling of the water shader. To add a water material to the river: 1. For the next step we will want the River Tool to sit above the river bed we just sculpted into the terrain. Using the Select tool, select the river spline and then move it up slightly so that we can see it. 2. If you want to apply a custom Water Shader to the river spline then select the river path and click the Mtl (Material) button to open the Material Editor.
3. In the Material Editor, Navigate to Materials -> Gettingstartedmaterials -> water and change to Shader type to Watervolume. Right-click on the material and click Assign to Selected Object to apply the water material to the River Spline.
Note: The River Tool currently only supports the Watervolume shader, other water shaders will not render properly when applied to the river path.
4. Next, let’s add some motion to the River so that it appears to be flowing. To do this we will first need to adjust the position of the River Tool spline to cover the riverbed area we just created. Using the Select tool, select the river spline and then move it up slightly so that we can see it. 5. The River is in a good position, but the edges do not reach the shore of the riverbed. Select the River spline and then click the Edit Button in Spline Parameters. Select each point along the spline and set the width so that the river stretches all the way from shore to shore. 6. In the Material Editor under Shader Params adjust the Flow Speed to 0.5. Under Shader Generation Params check the box labeled Water Flow. You can close the Material Editor for now. 7. With the river spline selected, adjust the River Parameters StepSize and TileLength to adjust the tiling of the Water Material. My final values were StepSize 10 and TileLength 20. 8. Once you have you water shader set to your liking feel free to continue experimenting with the River Parameters and terrain sculpting/painting brushes. When your finished you should have something like this:
Congratulations! You have successfully added a river path your scene!