In this tutorial, we will be working with the River feature in WorldBuilder 4.
Note: If you are using WorldBuilder Pro or WorldBuilder Genesis, you will be able to save project files and rendered images, and you will also be able to create animations. If you are using the downloadable demo of WorldBuilder 4 you will not be able to save files, but you can download the sample files that accompany this tutorial.
Let’s begin our tutorial.
Add a Landscape. Draw at least one skeleton Line. You’ll need four eventually. You could draw four individually, one right after the other, right next to one another.
Or, as an alternative, you can copy the first Skeleton Line three times, and then move, scale, rotate and Node-edit the copies so that you have two riverbanks and two river bottoms. Note that the Skeleton Lines used in the example files have been renamed to reflect the way in which they are being used.
Note: Some of the elements in the scene shown were hidden for clarity; your scene (or the sample scene file) will probably appear differently.
Now drop the two riverbottom Skeleton Lines down below the Landscape. Make their Z-placement about… -4.5
Don’t add a river object yet.
Render the landscape with its new Skeleton Lines, so we can see the riverbed without the water in it, first.
The scene incorporates an Area with Scattered vegetation. While it might be cool to have trees half-submerged in this torrent, it’s beyond the purpose of this tutorial.
Use the Placement Conditions property to limit the Height Range in which our forest will appear.
Disable Ignore All, and change the following parameters: Max Height = 40, Min Height = -0.5.
Render the scene again. Notice how the trees have vacated their place in the riverbed. By using Placement Conditions we specified the vertical range in which they would be allowed to ‘grow’. Below –0.5 meters (the lowest point on the ground above the river bank, the trees simply will not be placed.
Now it’s time to add the River / Ocean object. This is a special kind of water object that, although it does appear in the Scene Tree with a full compliment of Properties, cannot be selected or manipulated directly in the viewports, like a Skeleton Line or Camera or Landscape object can.
In the Creation toolbar, click once on River/Ocean.
The first thing we’ ll need to do is ‘assign’ the riverbanks, by using the Channel Definition Property Page.
Select River_0 in the Scene Tree.
In the Properties Tree, click on Select Shores.
Click on Left Shore, and then select SkeletonLine_Riverbank_Left.
Click on Right Shore and select SkeletonLine_Riverbank_Right.
In the Top Viewport we should be able to see the River object following the contours of the Skeleton Lines.
We should also be able to see the Flow arrows, indicating the direction in which our river will be flowing.
If the river is flowing upward, or in the positive Y direction, click on the Reverse Flow button in the River’s Channel Definition Property Page.
NOTE: If you get an error message about Mesh Steps, don’t worry. Just select Settings in the Properties Tree and change the Mesh Step parameter from the default of 15 to 0.5. You’ll notice the Vertices Number value rise or fall in accord with the settings; at a Mesh Step setting of 15 the Vertices Number will probably be zero.
Ok, so let’s render the scene with the trees cleared out and the river flowing through.
So far so good. Now that we can see our river rendered and flowing, let’s examine some of its editable characteristics.
The river controls can be thought of as being divided into two separate but related groups:
We’ll need to make sure our river is at the correct height.
Select River and then select Height Above Surface (Properties Tree). Keep in mind that the river should be no higher than the Skeleton Lines defining its banks (otherwise it would be flooding!).
Set the Height Above Surface value to be a little lower than that of the left and right riverbank Skeleton Lines.
Now let’s work with the Material properties, to alter our river’s appearance.
In the Scene Tree, expand River_0 to show Area1(full).
In the Properties Tree, expand Material and then Fresnel Water.
In the Property Page, set Generate Map to Every Frame.
Render the scene again.
Notice the improved appearance of the river surface.
Now, select the Colors/Depth property.
Choose a greenish-blue shade for the Surface Color value; Deep Color can be left black if you wish.
Use a Deep At setting of 10.
Render the scene once again to check the result.
Now let’s return to our River_0 object.
Select the Flow Parameters property.
Set Flow Speed to 0.1.
Set Perturbations: Amplitude to 0.25.
Set Average Waves Spacing: Across to 1.
Set Average Waves Spacing: Along to 1.
Set to Wave Period (frames) to 20.
Because we’re going to be applying specific kinds of external modifiers and materials, we’ll need to define our river object as a Mesh and not a Shader.
Enable the Mesh Perturbation Type.
A sub-property of Flow Parameters is Speed Profile. This allows us to control the river’s current, and where it is most visible.
In the Speed Profile Property Page we see a curve defined by three points. The low points at each end of the curve indicate a slow-moving river current, while the high middle point represents a faster current (and more visible ripples) in the middle of the river.
Click and drag on the points.
Re-render the scene a few times to see the effect of different settings for Speed Profile.
So we have our river flowing through our forest. Let’s make things more interesting by placing some rocks in the stream. Then we’ll add external perturbations and shaders to simulate a ‘foaming’ water effect.
Select River_0. In the menu toolbar, a Create Area button will appear (this may also appear as an ‘un-docked’ modal toolbar, depending on how you’ve configured your WorldBuilder 4 user interface).
Click on the button and create a new area in the River_0 object. This new area will be called Area2.
Once you’ve created your object, open the Library and select the stones group. Click and drag cobblestone09 into Area2. Choose Scattered Shaded Objects in the Types of Object(s) dialog window.
In the Properties Tree, expand Scattered Object and select Size & Density. Use the settings shown in the screen shot.
Randomize the stones’ Rotate property by applying the settings shown here. This will add more natural variance among the scattered objects.
Render the scene again, to check that the stones are partially submerged in the water.
Our scene looks good, but its realism would be enhanced if the scattered stones created some kind of disturbance in the water as it moves by. We will recreate this phenomenon by applying a special kind of modifier to our river.
With River0 selected in the Scene Tree, right-click on External Perturbations (in the Properties Tree) and pull down to Add…
In the Select Type(s) of Object dialog window,
choose Cavity and click OK.
The Cavity Property Page displays several parameters: Cavity Geometry defines the size and shape of the disturbance created by the stones.
Set Length to 10.
Set Central Angle to 45.
Set Depth to 0.3.
For the Allow Perturbations from control, enable River Area.
Re-render the scene once again.
Now we can see that our rocks appear to be generating realistic disturbances on the surface of the river.
Now let’ s add a final touch: foaming ‘white-water’ .
We’ re going to apply this extra finishing touch as a special shader. In the Properties Tree right-click on River0′ s Area1 (full) and pull down to Add…
In the Select Type of Object(s) dialog window, choose Material in Area from the Textures group and click OK.
Now we have a base upon which to build our new material.
Again, right-click on the new Material in Area and pull down to Add…
Select Foam from the Object Dependant group and click OK.
In the Properties Tree, expand the Foam shader to view its components.
Note: In the Property Page, leave Foam Pattern Style at its default setting of Noise.
The first of the components is Color Gradient. Note that in the Property Page the Gradient Editor is identical to the one used in the CompoundSky scene element.
It the case of our Foam shader, the gradient will be used to generate areas of transparency (for the Constant Color component) with black being 100% transparent and white being 100% opaque.
Initially the gradient will be a simple transition between these two parameters. We could use this arrangement ‘as is’ , but let’ s take a moment to introduce a little more chaos into this transition.
Using the Color Picker
or the Eye Dropper tool ,
left-click to select an appropriate shade of gray.
Then, with the Key Creator Pencil, left-click between the black and white keys (at left and right) to add the shade to the gradient. Repeat this process until you’ve ‘interrupted’ the smooth transition.
You can use the example shown, or you can create one of your own.
Because we don’ t want our gradient transparency to appear (as it does in the editor) as a series of shaded bands, we’ ll need to ‘randomize’ it. This is what the Noise 2D component will do.
In the Properties Page, use the settings shown in the example.
(Since our foam’ s basic color will be white, let’ s just use the default white setting in the Constant Color component)
Now we’ ll make some adjustments to the Phong Photometry. In the natural world, foam is essentially a mass of very tiny reflective bubbles. We want to mimic its visual characteristics as closely as possible, while still maintaining reasonable render times.
Set the Diffuse value to 1.4. This will cause the foam to ‘spread out’ the light that it recieves.
Set the Power to 20. This will impart a larger reflective highlight to the foam.
Just to see how our foam is affecting the river’ s surface, let’ s render the scene.
Well, we can certainly observe the Foam shader at work. But it’ s being applied to the entire surface, not just the ‘disturbed’ areas created by the Cavity modifier.
Let’ s use the Placement Conditions property to limit the Foam shader’ s effect.
Set the Altitude Range from -0.2 to -3.
This will cause the foam shader to be visible only in the disturbances created by the Cavity modifier.
Render the scene again.
Now we can see our scattered rocks generating foaming water traces in the river’ s rushing torrent. Pretty cool, eh?
This concludes our Rivers tutorial. We hope it was fun and informative.
Until the next time, good luck and happy WorldBuilding!