Stylized Water 2 documentation

Stylized Water 2

Stylized Water 2
Version: 1.2.0

4.6.River mode #

By default, the water effects will flow in the direction configured under the “General” tab. Some effects like normals and foam have a secondary layer that flows in the opposite direction.

For rivers/creeks, the water should always flow in a single direction. This is where the “River mode” option comes in.

River mode can be enabled under the General tab

When enabled, all the animations flow in the vertical direction of the mesh’s UV. Because of this, the “UV Source” parameter is disabled, as it’s forced to use the mesh’s UV. Surface Foam is also always drawn on slopes, and gradually becomes less visible as the water flattens out.

Included river demo scene

When river mode is used, the waves feature is automatically disabled, since these cannot work together properly. Note that buoyancy functionality only works for flat water, so will not work for rivers

Creating rivers

This is a fairly broad subject, this asset doesn’t contain any functionality to do this, since it’s not a modeling tool.

For example, River Auto Material or EasyRoads3D could be utilized to create spline meshes, though the shader will not support RAM’s flowmap painting functionality. But basically any spline tool that can tile a plane mesh will do.

Mesh requirements:

  • UV shells are laid out straight, without any overlapping shells (necessary for seamless texture tiling)
  • Has precomputed vertex normals (otherwise no way to tell what makes up a steep surface)
  • When using normal maps, tangents need to be calculated (eg. Mesh.RecalculateTangents)
  • Ideally, no or black vertex colors (so nothing interferes with vertex color controlled shading functions)

The Bezier Path Creator asset is an example that doesn’t meet these requirements (specifically point 2 and 3).

Correct: UV laid out vertically

(Version 1.0.9 and older only!) Ensure your mesh has no/black vertex colors. When river mode is used, the Blue channel is used to add foam. If the mesh has uniform white vertex colors, foam will draw on the entire mesh (rather than just the slopes)

Should the water flow in the opposite direction, you can use a negative Y direction on the material to mitigate this. Though this indicates you should actually flip your UV map vertically.

Blending rivers with lakes

This is fairly straightforward to achieve. Essentially, you want the last bit of the river geometry to fade out as it starts to touch the water body. The opacity of the material can be controlled through Vertex Colors, which makes this possible.

First, ensure the river material always draws over the other water material, by modifying the render queue on the river material to 3001 (transparent queue + 1). The ZWrite option must also be enabled on the (receiving) water material.

Secondly, enable the use of vertex colors for opacity on the river material.

The Green vertex color channel can now be used to make parts of the mesh completely transparent. See the Vertex Colors section for more details. You’d want to paint the end of the river mesh, that touches the lake, so it appears to blend in with it. Some spline tools may offer control over vertex colors per node/knot, which works just as well.

End part of the spline mesh having green vertex colors, making it fade out

Yes No Suggest edit
Last updated on October 27, 2022
12 of 12 users found this section helpful
Suggest Edit