This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Water

Unigine provides realistic water with complex behavior and ability to interact with rigid bodies. It can represent different types of water basins, from oceans, seas, natural lakes and streams to mud, mires, slush and other types of liquids.

In Unigine, water is implemented as 2 types of objects:

  •  Global Water represents infinitely spread water with auto-tessellation (the wireframe of the water is not scaled - regardless of the camera position it stays the same) and the underwater mode. This type should be used to represent boundless ocean while not overloading the GPU. However, it cannot have a body assigned, and thus does not provide proper physical interaction with scene objects.
    Notice
    Physical interaction of global water and other scene objects can be done by using a physical water object.
  •  Water Mesh is a loaded mesh that is appropriate for finite basins of arbitrary form. A water mesh object provides physical interaction with scene objects. A water mesh can be used to create, for example, lakes, pools, fountains, mires, slushes and so on.
    Notice
    In contrast to the Water object, the Water Mesh object doesn't have the underwater mode.

See also

Water Surfaces

Both the global water object and the water mesh object consist of 2 surfaces approximating optical and dynamic behavior of water:

  • The surface is used to add the following effects:
    • Surface waves — geometrical waves and rippling produced by surface displacement according to normal maps (see the water_base material), as well as waves conditioned by the physical interaction with objects (in case the water mesh is used).
    • Reflection — specular reflection of direct sunlight and skylight from the water surface. Reflection can be:
      • Dynamic. In this case, water reflections are set up by adjusting parameters in the Reflection field of the Parameters tab of the Materials window.
      • Static. In this case, water reflections are baked into a cube map that should be specified in the Reflection field of the Textures tab of the Materials window.
    • Fresnel effect — increase or decrease of water surface reflectance depending on the angle of the camera. In real life when looking at the water straight from above, it is transparent and non-reflective. When looking at the surface from a distance, the view angle becomes smaller and the amount of reflection increases until it seems completely non-transparent.
    • Refraction as light passes through air-water boundary.
    • Foam, spray or bubbles.
    • White caps in water. They look like foam, except that they are spread all over the water surface.
  • The volume surface introduces the following:
    • Underwater volume. For both water objects, it simulates water volume when the camera is above the water surface: it adds the visual depth to the rendered water.

      Also, in case of global water, this surface simulates underwater conditions when the camera is under the water surface. This becomes possible because of the water surface infinite size. As for the water mesh object, a mesh that is used to render both the surface and the volume surfaces has a finite size and form, so it is not possible to correctly render underwater surface by using such mesh. However, to imitate the underwater effect with water meshes, volumetric fog can be added.

    • Subsurface scattering that allows you to achieve additional play of colors. It becomes most visible at the horizon when the viewing angle is close to the water surface.
    • Caustics — light patterns formed on surfaces underneath the water. This effect is caused by the group of light rays focusing or defocussing because of the water surface is not flat, but rippled rough.

Water Waves

By default, water surface ripples according to normal maps (see the water_base material). However, different kinds of waves can be also simulated with 4 directional geometrical waves, summed to create dynamic waves. This model uses static geometry animated in vertex shader. Movement each of the wave is set independently that enhances flexibility of adjustment.

The waves have the following characteristics defining their periodic and sinusoidal nature:

Direction

A directional wave (unlike the circular one from the objects, for example) travels along the specified direction:

  • By the minimum value of 0, the wave spreads along the Y axis and is parallel to the X axis.
  • Positive values rotate the wave about the Z axis, meaning the wave direction is slanted counterclockwise relative to its initial spread.
  • Negative values rotate the wave on the water surface clockwise.
  • By the maximum possible values of 180 or -180, the wave direction becomes parallel to the X axis yet again.

Speed

The wave progresses along the water surface with the definite speed (measured in units per second):

  • The minimum value of 0 means the wave is inactive.
  • Increasing the value results in waves following each other faster.

Length

The length represents distance between successive crests of the wave:

  • The smaller the value is, the more rippled the water surface is.
  • The higher the value is, the broader formed waves are.
Length of the First Wave = 10
Length of the First Wave = 70

Amplitude

Amplitude determines the distance between the highest and the lowest wave peaks. Together with the length, it sets the wave form.

  • The minimum value of 0 means the wave is not formed.
  • Increasing the value forms higher waves up to tsunami-like ones.
Amplitude of the First Wave = 0.3; Length = 10
Amplitude of the First Wave = 0.7; Length = 10

Water Interaction with Field Spacer

Some areas of the water surface can be cut out by using a Field Spacer. It allows you to dynamically adapt the water surface to an object placed into water. For example, you can set a field spacer for a boat, so that water is not rendered inside this boat.

If a material assigned to a water object allows for interaction with FieldSpacer objects, you can specify the field mask that specifies an area of the Field Spacer node to be applied to water. This mask must match the mask set for the Field Spacer node.

Last update: 2017-07-03
Build: ()