This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Landscape Tool
Sandworm
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World Nodes
Звуковые объекты
Объекты поиска пути
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL
Плагины
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Работа с контентом
Оптимизация контента
Материалы
Material Nodes Library
Art Samples
Tutorials

Unigine::ObjectWaterGlobal Class

Header: #include <UnigineObjects.h>
Inherits from: Object

Interface for Global Water object handling. This water object represents infinitely spread water with auto-tessellation (the wireframe of the water object is not scaled — regardless of the camera position it stays the same) and the underwater mode. This type is suitable 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. If you need to simulate the physics of buoyancy, you should use Physical Water. Also it is limited to a single water level. It means that the filling level of water always remains the same. So, if you need to create, for example, mountain lakes or water flows with height difference, you should use a Water Mesh.

There are three options for creating waves:

  • Layer mode — you create layers on which waves will be randomly generated in a given range of wave parameters. All the layers are added together.
    Notice
    Wave layers are usually created through the UnigineEditor, but you can also create and edit them via code.
  • Manual mode — you create your own individual waves and have full control over them. This mode can only be set via code, you cannot do this in the UnigineEditor.
    Notice
    In Manual mode, be careful with the Steepness parameter, the waves will be everted if this value is set high.
  • Beauforts mode — waves are generated based on the presets reproducing the state of the sea according to the Beaufort wind force scale (0 - Calm, 12 - Hurricane). In this mode, the parameters that define the main wave geometry will not be available for editing via code.

For all modes, wave frequency is calculated based on the wavelength using the formula:

Frequency formula
sqrt (Gravity * 2 * PI / wavelength)

where Gravity = 9.81 m/s 2.

When you enable Manual mode, the list of the generated waves is cleared and you can set up your own waves. When you disable Manual mode, the user-defined waves will be cleared, and if you previously had any layers, the waves will be generated based on the parameters of these layers.

When you save the world, the layers will be saved, but the user-defined waves will not, since they are created via code.

The maximum total number of waves is 256. For better performance, we recommend using about 100.

Here is how you can modify the AppWorldLogic.cpp file to create waves in Manual mode:

AppWorldLogic.cpp

Source code (C++)
#include "AppWorldLogic.h"
#include <UnigineWorld.h>

using namespace Unigine;
// World logic, it takes effect only when the world is loaded.
// These methods are called right after corresponding world script's (UnigineScript) methods.

ObjectWaterGlobalPtr water = nullptr;

/* ... */

int AppWorldLogic::init()
{
	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
	
	water = static_ptr_cast<ObjectWaterGlobal>(World::getNodeByType(Node::OBJECT_WATER_GLOBAL));
	if (!water)
	{
		water = ObjectWaterGlobal::create();
	}
		
	// you can set each wave only in manual mode
	water->setWavesMode(ObjectWaterGlobal::WAVES_MODE_MANUAL);

	// add each wave. 
	// addWave(wave length, amplitude, steepness, direction angle[0.0; 360.0], phase offset[0.0; 2*PI])

	water->addWave(8.0, 0.05, 2.0, 270.0, 0.0);
	water->addWave(8.0, 0.015, 1.0, 150.0, 1.0);
	water->addWave(8.0, 0.02, 6.0, 75.0, 0.0);
	water->addWave(16.0, 0.05, 2.0, 270.0, 3.0);
	water->addWave(16.0, 0.05, 7.0, 45.0, 0.5);
	water->addWave(32.0, 0.1, 2.0, 120.0, 2.0);
	water->addWave(64.0, 0.2, 1.0, -90.0, 0.1);

	// change amplitude and length for the second wave 
	water->setWaveAmplitude(1, 0.03);
	water->setWaveLength(1, 10);
	
	return 1;
			
		/* ... */
		
}

See Also#

A UnigineScript API sample <UnigineSDK>/data/samples/objects/water_00

ObjectWaterGlobal Class

Enums

WAVES_MODE#

NameDescription
WAVES_MODE_MANUAL = 0Manual mode of wave generation.
WAVES_MODE_LAYERS = 1Layer mode of wave generation.
WAVES_MODE_BEAUFORTS = 2Beaufort scale mode of wave generation.

STEEPNESS_QUALITY#

NameDescription
STEEPNESS_QUALITY_LOW = 0Default. Low quality of wave steepness calculation.
STEEPNESS_QUALITY_MEDIUM = 1Medium quality of wave steepness calculation.
STEEPNESS_QUALITY_HIGH = 2High quality of wave steepness calculation.
STEEPNESS_QUALITY_ULTRA = 3Ultra quality of wave steepness calculation.
STEEPNESS_QUALITY_EXTREME = 4Extreme quality of wave steepness calculation. Significantly affects performance.

PLANAR_REFLECTION_SIZE#

NameDescription
PLANAR_REFLECTION_SIZE_RESOLUTION_128 = 0Reflection image with 128x128 resolution.
PLANAR_REFLECTION_SIZE_RESOLUTION_256 = 1Reflection image with 256x256 resolution.
PLANAR_REFLECTION_SIZE_RESOLUTION_512 = 2Reflection image with 512x512 resolution.
PLANAR_REFLECTION_SIZE_RESOLUTION_1024 = 3Reflection image with 1024x1024 resolution.
PLANAR_REFLECTION_SIZE_RESOLUTION_2048 = 4Reflection image with 2048x2048 resolution.
PLANAR_REFLECTION_SIZE_RESOLUTION_4096 = 5Reflection image with 4096x4096 resolution.
PLANAR_REFLECTION_SIZE_RESOLUTION_HEIGHT_QUART = 6Reflection image with the resolution height/4 x height/4, where height is an application window height.
PLANAR_REFLECTION_SIZE_RESOLUTION_HEIGHT_HALF = 7Reflection image with the resolution height/2 x height/2, where height is an application window height.
PLANAR_REFLECTION_SIZE_RESOLUTION_HEIGHT = 8Reflection image with the resolution height x height, where height is an application window height.

Members


static ObjectWaterGlobalPtr create ( ) #

Constructor. Creates a new global water object.

int getPhysicsFieldMask ( ) const#

Returns the FieldHeight physics mask of the assigned material on the Global Water.

Return value

The FieldHeight physics mask.

int getVisualFieldMask ( ) const#

Returns the FieldHeight visual mask of the assigned material on the Global Water.

Return value

The FieldHeight visual mask.

float getMeanLevel ( ) const#

Returns the average Z coordinate of the water object.

Return value

The Z coordinate value.

void setAnimationTime ( float time ) #

Sets water animation time value for water synchronization. It is used for effects, such as normals, caustics, and foam.

Arguments

  • float time - Water animation time value.

float getAnimationTime ( ) const#

Returns water animation time value for water synchronization.

Return value

Water animation time value.

void setLayerName ( int layer, const char * value ) #

Sets a new name for the wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • const char * value - Name of the layer.

const char * getLayerName ( int layer ) const#

Returns the name of the wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

Name of the layer

void setLayerWeight ( int layer, float value ) #

Sets a weight for a given wave layer. This value determines how much the given layer affects the final wave form. It can be used for smooth transitions between the states of water. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • float value - Layer weight

float getLayerWeight ( int layer ) const#

Returns the current weight of the wave layer. This value determines how much the given layer affects the final wave form. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

Weight of the layer.

void setLayerDirectionAngleVariance ( int layer, float value ) #

Sets a variance value of the wave direction angle for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • float value - Variance value.

float getLayerDirectionAngleVariance ( int layer ) const#

Returns the current variance value of the wave direction angle for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

Variance value.

void setLayerSteepnessScale ( int layer, float value ) #

Sets a steepness scale value for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • float value - Steepness scale value.

float getLayerSteepnessScale ( int layer ) const#

Returns the current steepness scale value for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

Steepness scale value.

void setLayerAmplitudeRange ( int layer, const Math::vec2& value ) #

Sets a range of wave amplitudes for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number.
  • const Math::vec2& value - Amplitude range.

Math::vec2 getLayerAmplitudeRange ( int layer ) const#

Returns the current range of wave amplitudes of a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number.

Return value

Amplitude range.

void setLayerLengthRange ( int layer, const Math::vec2& value ) #

Sets a range of wave lengths for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • const Math::vec2& value - Length range.

Math::vec2 getLayerLengthRange ( int layer ) const#

Returns the current range of wave lengths of a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

Length range.

void setLayerNumWaves ( int layer, int num ) #

Sets the number of waves for a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • int num - Number of waves.

int getLayerNumWaves ( int layer ) const#

Returns the number of waves on a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

Number of waves.

bool isLayerEnabled ( int layer ) const#

Returns a value indicating if a given wave layer is enabled. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

Return value

1 if the layer is disabled; otherwise, 0.

void setLayerEnabled ( int layer, bool enabled ) #

Enables or disables a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number
  • bool enabled - 1 to enable the layer, 0 to disable it.

void swapLayer ( int num_0, int num_1 ) #

Swaps two specified wave layers. Available when the Layers mode is set.

Arguments

  • int num_0 - Layer1 number.
  • int num_1 - Layer2 number.

int getNumLayers ( ) const#

Returns the current number of wave layers. Available when the Layers mode is set.

Return value

Number of wave layers.

void removeLayer ( int layer ) #

Removes a given wave layer. Available when the Layers mode is set.

Arguments

  • int layer - Layer number

int addLayer ( ) #

Appends a new wave layer. Available when the Layers mode is set.

Return value

Number of the new added layer.

void setWavePhaseOffset ( int index, float value ) #

Sets the phase offset parameter for a given wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.
  • float value - Phase offset parameter value in radians in range [0; 2pi].

float getWavePhaseOffset ( int index ) const#

Returns the value of the Phase Offset parameter of a wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.

Return value

Phase offset parameter value in radians in range [0; 2pi].

void setWaveDirectionAngle ( int index, float value ) #

Sets direction (angle of spreading) for a given wave:
  • If 0 is specified, the wave spreads along the Y axis and is parallel to the X axis.
  • If a positive value is specified, the wave direction is slanted counterclockwise relative to its initial spread.
  • If a negative value is specified, the wave is rotated clockwise.

Available when the Manual mode is set.

Arguments

  • int index - Wave number.
  • float value - Angle, in degrees. Both positive and negative values are acceptable.

float getWaveDirectionAngle ( int index ) const#

Returns direction (angle of spreading) of a given wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.

Return value

Angle, in degrees.

void setWaveSteepness ( int index, float value ) #

Sets the steepness value for a given wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.
  • float value - Steepness value.

float getWaveSteepness ( int index ) const#

Returns the current steepness value of the given wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.

Return value

Steepness value.

void setWaveAmplitude ( int index, float value ) #

Sets the distance between the highest and the lowest peaks for the given wave. It sets the wave form along with the setWaveLength() function. The higher the value is, the higher the waves are. Available when the Manual mode is set.

Arguments

  • int index - Wave number.
  • float value - Amplitude, in units.

float getWaveAmplitude ( int index ) const#

Returns the distance between the highest and the lowest peaks for the given wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.

Return value

Amplitude, in units.

void setWaveLength ( int index, float value ) #

Sets the distance between successive crests for the given wave. The higher the length value is, the broader the waves are. Available when the Manual mode is set.

Arguments

  • int index - Wave number.
  • float value - Length, in units.

float getWaveLength ( int index ) const#

Returns the distance between successive crests of the given wave. Available when the Manual mode is set.

Arguments

  • int index - Wave number.

Return value

Length, in units.

int getNumWaves ( ) const#

Returns the current number of simulated waves. Available when the Manual mode is set.

Return value

Number of waves.

void removeWave ( int index ) #

Removes the wave having a specified number. Available when the Manual mode is set.

Arguments

  • int index - Wave number.

int addWave ( float length, float amplitude, float steepness, float direction_angle, float phase ) #

Adds a wave if the Manual mode is set.

Arguments

  • float length - Wave length.
  • float amplitude - Wave amplitude.
  • float steepness - Wave steepness.
  • float direction_angle - Angle of the wave direction in degrees. At 0 angle the wave will be directed along the X-axis.
  • float phase - Phase offset of the wave in radians (0 to 2pi).

Return value

Number of the added wave.

float getWindAffect ( ) const#

Returns the current value determining how much the wind direction affects the waves.

Return value

Wind influence value in range [0;1].

void setWindAffect ( float affect ) #

Sets how much the wind direction affects the waves.

Arguments

  • float affect - Wind influence in range [0;1]. If you set it to 1, all waves will be directed along the wind direction.

float getWindDirectionAngle ( ) const#

Returns the angle that determines the wind direction.

Return value

Angle, in degrees.

void setWindDirectionAngle ( float angle ) #

Sets the angle that determines the wind direction.

Arguments

  • float angle - Wind direction angle, in degrees.

static int type ( ) #

Returns the type of the node.

Return value

Object type identifier.

void setActiveWater ( bool water ) #

Sets a value indicating if the global water object is active. If there are more than one global water nodes in the scene, only the active one will be rendered.

Arguments

  • bool water - true to set the global water object as active, false - to set it as inactive.

bool isActiveWater ( ) const#

Returns a value indicating if the global water object is active.

Return value

true if the global water object is active, false - if it is inactive.

float fetchHeight ( const Math::Vec3 & position ) const#

Returns a height offset of a given point relatively to the water surface.

Arguments

  • const Math::Vec3 & position - Point position coordinates.

Return value

Height offset of the point.

Math::vec3 fetchNormal ( const Math::Vec3 & position ) const#

Returns a normal vector of a given point (to orient objects along the waves normals).

Arguments

  • const Math::Vec3 & position - Point position coordinates.

Return value

Normal vector.

void setFetchAmplitudeThreshold ( float threshold ) #

Sets the threshold for amplitude values that will not participate in height calculations. The more you cut off, the less accurate the height value you get, but the faster are the calculations.

Arguments

  • float threshold - Amplitude threshold. The default value is 0.1f.

float getFetchAmplitudeThreshold ( ) const#

Returns the current threshold for amplitude values that will not participate in height calculations.

Return value

Amplitude threshold.

void setFetchSteepnessQuality ( ObjectWaterGlobal::STEEPNESS_QUALITY quality ) #

Sets the wave steepness calculation quality used in height and normal calculations. Low quality is usually sufficient for calm water and large floating objects. If the waves are big, or you want to simulate small floating objects, you may need to increase the quality. Higher quality gives a more precise result but affects performance.

Arguments

ObjectWaterGlobal::STEEPNESS_QUALITY getFetchSteepnessQuality ( ) const#

Returns the wave steepness calculation quality used in height and normal calculations.

Return value

Quality value.

float getIntersectionAmplitudeThreshold ( ) const#

Returns the current threshold of amplitude values that will not participate in intersection calculations.

Return value

Amplitude threshold.

void setIntersectionAmplitudeThreshold ( float threshold ) #

Sets the threshold for amplitude values that will not participate in intersection calculations. The default value is 0.1f.

Arguments

  • float threshold - Amplitude threshold.

void setIntersectionPrecision ( float precision ) #

Sets an intersection precision which represents an error between the real value of the water intersection point and the calculated value. The default value is 0.25.

Arguments

  • float precision - Precision for intersection detection.

float getIntersectionPrecision ( ) const#

Returns current intersection precision which represents an error between the real value of the water intersection point and the calculated value.

Return value

Precision for intersection detection.

void setIntersectionSteepnessQuality ( ObjectWaterGlobal::STEEPNESS_QUALITY quality ) #

Sets the wave steepness calculation quality used in intersection calculations. Higher quality gives a more precise result, but affects performance.

Arguments

ObjectWaterGlobal::STEEPNESS_QUALITY getIntersectionSteepnessQuality ( ) const#

Returns the wave steepness calculation quality used in intersection calculations.

Return value

Steepness quality.

void setSoftIntersection ( float intersection ) #

Sets soft intersection of water with the shoreline and surfaces of objects.

Arguments

  • float intersection - Soft intersection value.

float getSoftIntersection ( ) const#

Returns the current soft intersection of water with the shoreline and surfaces of objects.

Return value

Soft intersection value.

void takeSyncData ( const Ptr<Stream> & stream ) #

Writes wave synchronization data to the specified stream.

Arguments

  • const Ptr<Stream> & stream - Stream to which wave synchronization data is to be written.

void applySyncData ( const Ptr<Stream> & stream ) #

Reads wave synchronization data from the specified stream and applies it to the wave system.

Arguments

  • const Ptr<Stream> & stream - Stream with wave synchronization data to be applied.

void setWavesMode ( ObjectWaterGlobal::WAVES_MODE mode ) #

Sets the wave generation mode.

Arguments

ObjectWaterGlobal::WAVES_MODE getWavesMode ( ) const#

Returns the current wave generation mode.

Return value

Wave mode.

void setBeaufort ( float beaufort ) #

Sets the Beaufort wind force scale value.

Arguments

  • float beaufort - Beaufort value from 0 (Calm) to 12 (Hurricane). Available when the Beauforts mode is set.

float getBeaufort ( ) const#

Returns the current Beaufort wind force scale value. Available when the Beauforts mode is set.

Return value

Beaufort value.

void setWavesNormalIntensity ( float intensity ) #

Sets the intensity of normals of the waves.

Arguments

  • float intensity - Intensity value.

float getWavesNormalIntensity ( ) const#

Returns the current intensity of normals of the waves.

Return value

Intensity value.

void setAdditionalNormalBlur ( float blur ) #

Sets the ratio of the procedurally generated normal blurring. The lower the value, the more blurred (hence, more flatten) the water surface is.

Arguments

  • float blur - Normal blur value.

float getAdditionalNormalBlur ( ) const#

Returns the current ratio of the procedurally generated normal blurring.

Return value

Normal blur value.

void setAdditionalNormalIntensity ( float intensity ) #

Sets the intensity of procedurally generated normals. This affects the normals generated for Field Height, Field Shoreline, and distant waves.

Arguments

  • float intensity - Intensity value.

float getAdditionalNormalIntensity ( ) const#

Returns the current intensity of procedurally generated normals.

Return value

Intensity value.

void setDetailTexturePath ( const char * path ) #

Sets a path to the location of a normal detail texture.

Arguments

  • const char * path - Detail texture path.

const char * getDetailTexturePath ( ) const#

Returns the current path to the location of a normal detail texture.

Return value

Detail texture path.

void setDetail0UVSize ( const Math::vec2& size ) #

Sets the size of the first sample of the normal detail texture.

Arguments

  • const Math::vec2& size - Size of the detail texture.

Math::vec2 getDetail0UVSize ( ) const#

Returns the current size of the first sample of the normal detail texture.

Return value

Size of the detail texture.

void setDetail0UVSpeed ( const Math::vec2& speed ) #

Sets the speed of the first sample of the normal detail texture.

Arguments

  • const Math::vec2& speed - Speed of the detail texture.

Math::vec2 getDetail0UVSpeed ( ) const#

Returns the current speed of the first sample of the normal detail texture.

Return value

Speed of the detail texture.

void setDetail0Intensity ( float intensity ) #

Sets the intensity of the first sample of the normal detail texture.

Arguments

  • float intensity - Intensity of the detail texture.

float getDetail0Intensity ( ) const#

Returns the current intensity of the first sample of the normal detail texture.

Return value

Intensity of the detail texture.

void setDetail1UVSize ( const Math::vec2& size ) #

Sets the size of the second sample of the normal detail texture.

Arguments

  • const Math::vec2& size - Size of the detail texture.

Math::vec2 getDetail1UVSize ( ) const#

Returns the current size of the second sample of the normal detail texture.

Return value

Size of the detail texture.

void setDetail1UVSpeed ( const Math::vec2& speed ) #

Sets the speed of the second sample of the normal detail texture.

Arguments

  • const Math::vec2& speed - Speed of the detail texture.

Math::vec2 getDetail1UVSpeed ( ) const#

Returns the current speed of the second sample of the normal detail texture.

Return value

Speed of the detail texture.

void setDetail1Intensity ( float intensity ) #

Sets the intensity of the second sample of the normal detail texture.

Arguments

  • float intensity - Intensity of the detail texture.

float getDetail1Intensity ( ) const#

Returns the current intensity of the first sample of the normal detail texture.

Return value

Intensity of the detail texture.

void setDistantWavesHeightTexturePath ( const char * path ) #

Sets the path to the height texture of the distant waves.

Arguments

  • const char * path - Path to the height texture.

const char * getDistantWavesHeightTexturePath ( ) const#

Returns the current path to the height texture of the distant waves.

Return value

Path to the height texture.

void setDistantWavesUVTransform ( const Math::vec4& transform ) #

Specifies the UV transform for the distant waves height texture.

Arguments

  • const Math::vec4& transform - The first two values are the scale texture coordinates along the X and Y axes. The third and forth specify the wind force and direction for the U and V axes.

Math::vec4 getDistantWavesUVTransform ( ) const#

Returns the current UV transform for the distant waves height texture.

Return value

The first two values are the scale texture coordinates along the X and Y axes. The third and forth specify the wind force and direction for the U and V axes.

void setDistantWavesHeightScale ( float scale ) #

Sets the height scale for the distant waves height texture.

Arguments

  • float scale - Height scale value.

float getDistantWavesHeightScale ( ) const#

Returns the current height scale for the distant waves height texture.

Return value

Height scale value.

void setDistantWavesDistanceFadeStart ( float start ) #

Sets the fade-in start distance for distant waves.

Arguments

  • float start - Fade-in start distance.

float getDistantWavesDistanceFadeStart ( ) const#

Returns the current fade-in start distance for distant waves.

Return value

Fade-in start distance.

void setDistantWavesDistanceFadeEnd ( float end ) #

Sets the fade-in end distance for distant waves.

Arguments

  • float end - Fade-in end distance.

float getDistantWavesDistanceFadeEnd ( ) const#

Returns the current fade-in end distance for distant waves.

Return value

Fade end distance.

void setDistantWavesDistanceFadeMinValue ( float value ) #

Sets the value representing the minimum amount of distant waves in the crossfade zone where the main geometry waves fade out and distant waves fade in.

Arguments

  • float value - A value representing the minimum amount of distant waves. Range: [0; 1], the default value is 0.

float getDistantWavesDistanceFadeMinValue ( ) const#

Returns the current value representing the minimum amount of distant waves in the crossfade zone where the main geometry waves fade out and distant waves fade in.

Return value

A value representing the minimum amount of distant waves.

void setFoamTexturePath ( const char * path ) #

Sets the path to the foam texture.

Arguments

  • const char * path - Path to the foam texture.

const char * getFoamTexturePath ( ) const#

Returns the current path to the foam texture.

Return value

Path to the foam texture.

void setFoam0UVScale ( float scale ) #

Sets the UV scale for the first sample of the foam texture.

Arguments

  • float scale - Scale value.

float getFoam0UVScale ( ) const#

Returns the current UV scale for the first sample of the foam texture.

Return value

Scale value.

void setFoam0UVSpeed ( float speed ) #

Sets the speed for the first sample of the foam texture.

Arguments

  • float speed - Speed value.

float getFoam0UVSpeed ( ) const#

Returns the current speed for the first sample of the foam texture.

Return value

Speed value.

void setFoam1UVScale ( float scale ) #

Sets the UV scale for the second sample of the foam texture.

Arguments

  • float scale - Scale value.

float getFoam1UVScale ( ) const#

Returns the current UV scale for the second sample of the foam texture.

Return value

Scale value.

void setFoam1UVSpeed ( float speed ) #

Sets the speed for the second sample of the foam texture.

Arguments

  • float speed - Speed value.

float getFoam1UVSpeed ( ) const#

Returns the current speed for the second sample of the foam texture.

Return value

Speed value.

void setFoamPeakContrast ( float contrast ) #

Sets the foam contrast on the wave peaks.

Arguments

  • float contrast - Contrast value.

float getFoamPeakContrast ( ) const#

Returns the current foam contrast on the wave peaks.

Return value

Contrast value.

void setFoamPeakIntensity ( float intensity ) #

Sets the foam intensity on the wave peaks.

Arguments

  • float intensity - Intensity value.

float getFoamPeakIntensity ( ) const#

Returns the current foam intensity on the wave peaks.

Return value

Intensity value.

void setFoamWhitecapContrast ( float contrast ) #

Sets the foam contrast on the white caps.

Arguments

  • float contrast - Contrast value.

float getFoamWhitecapContrast ( ) const#

Returns the current foam contrast on the white caps.

Return value

Contrast value.

void setFoamWhitecapIntensity ( float intensity ) #

Sets the foam intensity on the white caps.

Arguments

  • float intensity - Intensity value.

float getFoamWhitecapIntensity ( ) const#

Returns the current foam intensity on the white caps.

Return value

Intensity value.

void setFoamWindContrast ( float contrast ) #

Sets the contrast for the foam generated based on the wind direction.

Arguments

  • float contrast - Contrast value.

float getFoamWindContrast ( ) const#

Returns the current contrast for the foam generated based on the wind direction.

Return value

Contrast value.

void setFoamWindIntensity ( float intensity ) #

Sets the intensity for the foam generated based on the wind direction.

Arguments

  • float intensity - Intensity value.

float getFoamWindIntensity ( ) const#

Returns the current intensity for the foam generated based on the wind direction.

Return value

Intensity value.

void setFieldHeightFoamContrast ( float contrast ) #

Sets the contrast of the foam generated from the FieldHeight objects placed in Global Water.

Arguments

  • float contrast - Contrast value.

float getFieldHeightFoamContrast ( ) const#

Returns the current contrast of the foam generated from the FieldHeight objects placed in Global Water.

Return value

Contrast value.

void setFieldHeightFoamIntensity ( float intensity ) #

Sets the intensity of the foam generated from the FieldHeight objects placed in Global Water.

Arguments

  • float intensity - Intensity value.

float getFieldHeightFoamIntensity ( ) const#

Returns the current intensity of the foam generated from the FieldHeight objects placed in Global Water.

Return value

Intensity value.

void setFoamContactIntensity ( float intensity ) #

Sets the foam intensity near shores or different objects in water.

Arguments

  • float intensity - Intensity value.

float getFoamContactIntensity ( ) const#

Returns the current foam intensity near shores or different objects in water.

Return value

Intensity value.

void setFoamTextureAffect ( float affect ) #

Sets the visibility of the foam texture. It can be used to create additional effects, e.g., foam bubbles.

Arguments

  • float affect - Texture affect value.

float getFoamTextureAffect ( ) const#

Sets the visibility of the foam texture.

Return value

Texture affect value.

void setSubsurfaceColor ( const Math::vec4& color ) #

Sets the water subsurface scattering (SSS) color.

Arguments

  • const Math::vec4& color - Color value.

Math::vec4 getSubsurfaceColor ( ) const#

Returns the current water subsurface scattering (SSS) color.

Return value

Color value.

void setSubsurfaceAmbientIntensity ( float intensity ) #

Sets the intensity of subsurface scattering for ambient lighting.

Arguments

  • float intensity - Intensity value. The lower the value, the faster the light rays dissipate in water.

float getSubsurfaceAmbientIntensity ( ) const#

Returns the current intensity of subsurface scattering for ambient lighting.

Return value

Intensity value.

void setSubsurfaceWaveIntensity ( float intensity ) #

Sets the intensity of light rays passing through waves.

Arguments

  • float intensity - Intensity value. The lower the value, the faster the light rays dissipate in water.

float getSubsurfaceWaveIntensity ( ) const#

Returns the current intensity of light rays passing through waves.

Return value

Intensity value.

void setSubsurfaceWaveFoamIntensity ( float intensity ) #

Sets the intensity of subsurface scattering near the foam areas.

Arguments

  • float intensity - Intensity value.

float getSubsurfaceWaveFoamIntensity ( ) const#

Returns the current intensity of subsurface scattering near the foam areas.

Return value

Intensity value.

void setSubsurfaceDiffuseIntensity ( float intensity ) #

Sets the intensity of subsurface scattering for diffuse lighting.

Arguments

  • float intensity - Intensity value.

float getSubsurfaceDiffuseIntensity ( ) const#

Returns the current intensity of subsurface scattering for diffuse lighting.

Return value

Intensity value.

void setDepthLUTTexturePath ( const char * path ) #

Sets the path to the LUT texture that shows the color of the bottom.

Arguments

  • const char * path - Path to the texture.

const char * getDepthLUTTexturePath ( ) const#

Returns the current path to the LUT texture that shows the color of the bottom.

Return value

Path to the texture.

void setUnderwaterFogColor ( const Math::vec4& color ) #

Sets the underwater fog color. The Sun and Environment lighting affect this parameter to create the final underwater fog color.

Arguments

  • const Math::vec4& color - Color value.

Math::vec4 getUnderwaterFogColor ( ) const#

Returns the current underwater fog color.

Return value

Color value.

void setUnderwaterFogTransparency ( float transparency ) #

Sets the transparency of the underwater fog.

Arguments

  • float transparency - Transparency value. The higher the value, the more transparent the underwater fog is.

float getUnderwaterFogTransparency ( ) const#

Returns the current transparency of the underwater fog.

Return value

Transparency value.

void setUnderwaterFogDepth ( float depth ) #

Sets the distance from the water surface up to which the light affects the underwater color.

Arguments

  • float depth - Transparency value, in units.

float getUnderwaterFogDepth ( ) const#

Returns the current distance from the water surface up to which the light affects the underwater color.

Return value

Transparency value, in units.

void setUnderwaterFogOffset ( float offset ) #

Sets the height offset for lighting.

Arguments

  • float offset - Offset value.

float getUnderwaterFogOffset ( ) const#

Returns the current height offset for lighting.

Return value

Offset value.

void setUnderwaterFogEnvironmentInfluence ( float influence ) #

Sets the degree of impact of the environment lighting on the final underwater color.

Arguments

  • float influence - Influence value.

float getUnderwaterFogEnvironmentInfluence ( ) const#

Returns the current degree of impact of the environment lighting on the final underwater color.

Return value

Influence value.

void setUnderwaterFogSunInfluence ( float influence ) #

Sets the degree of impact of the sun lighting on the final underwater color.

Arguments

  • float influence - Influence value.

float getUnderwaterFogSunInfluence ( ) const#

Returns the current degree of impact of the sun lighting on the final underwater color.

Return value

Influence value.

void setUnderwaterShaftIntensity ( float intensity ) #

Sets the intensity of the underwater sun shafts.

Arguments

  • float intensity - Intensity value.

float getUnderwaterShaftIntensity ( ) const#

Returns the current intensity of the underwater sun shafts.

Return value

Intensity value.

void setWaterlineSize ( float size ) #

Sets the size of the borderline between the overwater and underwater environments.

Arguments

  • float size - Waterline size.

float getWaterlineSize ( ) const#

Returns the current size of the borderline between the overwater and underwater environments.

Return value

Waterline size.

void setUnderwaterDofDistance ( float distance ) #

Sets the focal distance for the underwater DOF effect.

Arguments

  • float distance - Focal distance.

float getUnderwaterDofDistance ( ) const#

Returns the current focal distance for the underwater DOF effect.

Return value

Focal distance.

void setPlanarReflectionDistance ( float distance ) #

Sets the distance from the reflection viewport camera to the reflected object. This distance sums up to the distance from the camera to the reflective surface plus the distance from object to reflective surface.

Arguments

  • float distance - Distance, in units.

float getPlanarReflectionDistance ( ) const#

Returns the current distance from the reflection viewport camera to the reflected object. This distance sums up to the distance from the camera to the reflective surface plus the distance from object to reflective surface.

Return value

Distance, in units.

void setPlanarReflectionPivotOffset ( const Math::vec3& offset ) #

Sets the position of the reflection pivot point.

Arguments

  • const Math::vec3& offset - Pivot point offset.

Math::vec3 getPlanarReflectionPivotOffset ( ) const#

Returns the current position of the reflection pivot point.

Return value

Pivot point offset.

void setReflectionRoughness ( float roughness ) #

Sets the environment reflection roughness of the water surface. This parameter helps to tweak reflections on the water surface relative to the environment.

Arguments

  • float roughness - Roughness value.

float getReflectionRoughness ( ) const#

Returns the current environment reflection roughness of the water surface. This parameter helps to tweak reflections on the water surface relative to the environment.

Return value

Roughness value.

void setReflectionOcclusion ( float occlusion ) #

Sets the occlusion factor for environment reflections on parts of the water surface with negative normals. Using this parameter enables simulation of reflection of waves on the water surface removing too bright areas on waves close to the horizon.

Arguments

  • float occlusion - Occlusion value. Minimum value is 0 - no occlusion. By the higher values, occlusion is performed for reflections on parts of the water surface with negative normals that have a certain slope. The higher the value, the less intensive reflections are on the surface parts with negative normals.

float getReflectionOcclusion ( ) const#

Returns the current occlusion factor for environment reflections on parts of the water surface with negative normals. Using this parameter enables simulation of reflection of waves on the water surface removing too bright areas on waves close to the horizon.

Return value

Occlusion value.

void setReflectionOcclusionSlope ( float slope ) #

Sets the slope of negative normals of the water surface, at which occlusion is performed for wave reflections.

Arguments

  • float slope - Slope value.

float getReflectionOcclusionSlope ( ) const#

Returns the current slope of negative normals of the water surface, at which occlusion is performed for wave reflections.

Return value

Slope value.

void setCausticsTexturePath ( const char * path ) #

Sets the path to the 3D Caustic texture which determines the pattern of light rays refracted by the water surface. The texture is 1-channeled: R value defines the caustics pattern.

Arguments

  • const char * path - Path to the texture.

const char * getCausticsTexturePath ( ) const#

Returns the current path to the 3D Caustic texture which determines the pattern of light rays refracted by the water surface.

Return value

Path to the texture.

void setCausticUVTransform ( const Math::vec4& transform ) #

Sets the UV Transform coordinates for the caustic texture.

Arguments

  • const Math::vec4& transform - Transform coordinates.

Math::vec4 getCausticUVTransform ( ) const#

Returns the current UV Transform coordinates for the caustic texture.

Return value

Transform coordinates.

void setCausticDistanceFade ( float fade ) #

Sets the distance from the water surface downwards, at which light shapes fade.

Arguments

  • float fade - Distance, in units.

float getCausticDistanceFade ( ) const#

Returns the current distance from the water surface downwards, at which light shapes fade.

Return value

Distance, in units.

void setCausticAnimationSpeed ( float speed ) #

Sets the movement speed of the light patterns.

Arguments

  • float speed - Speed value.

float getCausticAnimationSpeed ( ) const#

Returns the current movement speed of the light patterns.

Return value

Speed value.

void setCausticBrightness ( float brightness ) #

Sets the brightness of the light shapes.

Arguments

  • float brightness - Brightness value.

float getCausticBrightness ( ) const#

Returns the current brightness of the light shapes.

Return value

Brightness value.

void setFieldShorelineLUTTexturePath ( const char * path ) #

Sets the path to the LUT texture used for shoreline wetness effect.

Arguments

  • const char * path - Path to the texture.

const char * getFieldShorelineLUTTexturePath ( ) const#

Returns the current path to the LUT texture used for shoreline wetness effect.

Return value

Path to the texture.

void setFieldShorelineWaveSpeed ( float speed ) #

Sets the speed of tidal waves.

Arguments

  • float speed - Wave speed value.

float getFieldShorelineWaveSpeed ( ) const#

Returns the current speed of tidal waves.

Return value

Wave speed value.

void setFieldShorelineWaveTiling ( float tiling ) #

Sets the frequency of tidal waves.

Arguments

  • float tiling - Tiling value.

float getFieldShorelineWaveTiling ( ) const#

Returns the current frequency of tidal waves.

Return value

Tiling value.

void setFieldShorelineWaveHeight ( float height ) #

Sets the height of oncoming tidal waves.

Arguments

  • float height - Height value.

float getFieldShorelineWaveHeight ( ) const#

Returns the current height of oncoming tidal waves.

Return value

Height value.

void setFieldShorelineWaveFalloff ( float falloff ) #

Sets the visibility gradient of waves coming from sea to the shore.

Arguments

  • float falloff - Falloff value.

float getFieldShorelineWaveFalloff ( ) const#

Returns the current visibility gradient of waves coming from sea to the shore.

Return value

Falloff value.

void setFieldShorelineWaveExponent ( float exponent ) #

Sets the nonlinearity of tidal waves frequency and movement speed depending on their distance from the shoreline.

Arguments

  • float exponent - Exponent value.

float getFieldShorelineWaveExponent ( ) const#

Returns the current nonlinearity of tidal waves frequency and movement speed.

Return value

Exponent value.

void setFieldShorelineWaveFrontExponent ( float exponent ) #

Sets the semi-transparency of the foam at an angle to the wind direction. Allows making the foam visible only on the windward side.

Arguments

  • float exponent - Exponent value.

float getFieldShorelineWaveFrontExponent ( ) const#

Returns the current semi-transparency of the foam at an angle to the wind direction. Allows making the foam visible only on the windward side.

Return value

Exponent value.

void setFieldShorelineFoamStretching ( float stretching ) #

Sets the width of the Shoreline LUT texture that creates a tidal wave.

Arguments

  • float stretching - Stretching value.

float getFieldShorelineFoamStretching ( ) const#

Returns the current width of the Shoreline LUT texture that creates a tidal wave.

Return value

Stretching value.

void setFieldShorelineFoamIntensity ( float intensity ) #

Sets the degree of foam intensity along the shoreline.

Arguments

  • float intensity - Intensity value.

float getFieldShorelineFoamIntensity ( ) const#

Returns the current degree of foam intensity along the shoreline.

Return value

Intensity value.

void setFieldShorelineFoamExponent ( float exponent ) #

Sets the visibility of the foam texture pattern.

Arguments

  • float exponent - Exponent value.

float getFieldShorelineFoamExponent ( ) const#

Returns the current visibility of the foam texture pattern.

Return value

Exponent value.

void setFieldShorelineMaskTiling ( float tiling ) #

Sets a size of the foam procedural pattern used to reduce the foam tiling effect when seen from above.

Arguments

  • float tiling - Tiling value.

float getFieldShorelineMaskTiling ( ) const#

Returns the current size of the foam procedural pattern used to reduce the foam tiling effect.

Return value

Tiling value.

void setFieldShorelineBeaufortFalloff ( float falloff ) #

Sets the Beaufort falloff value that provides height control of main geometry waves near the shoreline.

Arguments

  • float falloff - Falloff value.

float getFieldShorelineBeaufortFalloff ( ) const#

Returns the current Beaufort falloff value that provides height control of main geometry waves near the shoreline.

Return value

Falloff value.

void setShorelineWetnessIntensity ( float intensity ) #

Sets the intensity of the wetness effect along the shoreline.

Arguments

  • float intensity - Wetness intensity value.

float getShorelineWetnessIntensity ( ) const#

Returns the current intensity of the wetness effect along the shoreline.

Return value

Wetness intensity value.

void setShorelineWetnessDistance ( float distance ) #

Sets the spread of the wetness area along the shoreline.

Arguments

  • float distance - Wetness distance value, in units.

float getShorelineWetnessDistance ( ) const#

Returns the current spread of the wetness area along the shoreline.

Return value

Wetness distance value, in units.

void setShorelineWetnessOffset ( float offset ) #

Sets the offset of the wetness area from the water.

Arguments

  • float offset - Wetness offset value, in units.

float getShorelineWetnessOffset ( ) const#

Returns the current offset of the wetness area from the water.

Return value

Wetness offset value, in units.

void setAuxiliaryColor ( const Math::vec4& color ) #

Sets the color that goes into the auxiliary buffer. Alpha is the blend factor.

Arguments

  • const Math::vec4& color - Auxiliary color.

Math::vec4 getAuxiliaryColor ( ) const#

Returns the current color that goes into the auxiliary buffer.

Return value

Auxiliary color.

void setRefractionScale ( float scale ) #

Sets the scale of the water refraction.

Arguments

  • float scale - Refraction scale value.

float getRefractionScale ( ) const#

Returns the current scale of the water refraction.

Return value

Refraction scale value.

void setDiffuseDistortion ( float distortion ) #

Distortion of decals projected onto water.

Arguments

  • float distortion - Distortion value.

float getDiffuseDistortion ( ) const#

Returns the current distortion of decals projected onto water.

Return value

Distortion value.

void setFieldHeightSteepness ( float steepness ) #

Sets the sharpness of the crests for the waves generated from the FieldHeight objects placed in Global Water.

Arguments

  • float steepness - Steepness value.

float getFieldHeightSteepness ( ) const#

Returns the current sharpness of the crests for the waves generated from the FieldHeight objects placed in Global Water.

Return value

Steepness value.

void setUnderwaterDOF ( bool underwaterdof ) #

Enables/disables the underwater DOF effect.

Arguments

  • bool underwaterdof - true to enable underwater DOF effect, false to disable it.

bool isUnderwaterDOF ( ) const#

Returns a value indicating if the underwater DOF effect enabled.

Return value

true if underwater DOF effect is enabled, otherwise, false.

void setPlanarReflection ( bool reflection ) #

Enables/disables the use of planar reflections on the water surface instead of SSR. It is better to use this option for undisturbed water (0-2 Beaufort). Enabling the option activates Planar Reflection MapSize and Planar Reflection parameters.

Arguments

  • bool reflection - true to enable planar reflections, false to disable them.

bool isPlanarReflection ( ) const#

Returns a value indicating if the planar reflections option is enabled.

Return value

true if planar reflections option is enabled, otherwise, false.

void setPlanarReflectionMapSizeType ( ObjectWaterGlobal::PLANAR_REFLECTION_SIZE type ) #

Sets the size of the planar reflection map. The higher the value, the better the quality is.

Arguments

ObjectWaterGlobal::PLANAR_REFLECTION_SIZE getPlanarReflectionMapSizeType ( ) const#

Returns the current size of the planar reflection map.

Return value

Size of the planar reflection map.

void setPlanarReflectionViewportMask ( int mask ) #

Sets the viewport mask of the reflection camera. A surface has its reflection rendered, if its viewport mask and its material's viewport mask match this mask.

Arguments

  • int mask - Viewport mask.

int getPlanarReflectionViewportMask ( ) const#

Returns the current viewport mask of the reflection camera. A surface has its reflection rendered, if its viewport mask and its material's viewport mask match this mask.

Return value

Viewport mask.

void setCaustics ( bool caustics ) #

Enables/disables the effect of light rays refraction by the water surface.

Arguments

  • bool caustics - true to enable the caustics, false to disable them.

bool isCaustics ( ) const#

Returns a value indicating if the caustics effect is enabled.

Return value

true if the caustics effect is enabled, otherwise, false.

void setCausticsDistortion ( bool distortion ) #

Enables/disables the caustics distortion option. This effect removes pixelation and makes caustics look smoother. When smoothing is not required, you can disable this option to gain performance.

Arguments

  • bool distortion - true to enable caustics distortion, false to disable it.

bool isCausticsDistortion ( ) const#

Returns a value indicating if the caustics distortion effect is enabled.

Return value

true if caustics distortion is enabled, otherwise, false.

void setFieldShorelineEnabled ( bool enabled ) #

Enables/disables the effect of the FieldShoreline object on the Global Water object. Enabling this option makes available the group of Field Shoreline states.

Arguments

  • bool enabled - true to enable FieldShoreline, false to disable it.

bool isFieldShorelineEnabled ( ) const#

Checks if the assigned material on the Global Water object has enabled FieldShoreline interaction option.

Return value

true if the FieldShoreline interaction option is enabled, otherwise, false.

void setFieldShorelineHighPrecision ( bool precision ) #

Enables/disables improved interpolation between the adjacent pixels of the shoreline texture to reduce stepping artifacts. This can be noticed when looking at the waterline separating overwater and underwater. This option should be used only when geometry and/or normal states are enabled.

Arguments

  • bool precision - true to enable high precision, false to disable it.

bool isFieldShorelineHighPrecision ( ) const#

Returns a value indicating if the high precision of the shoreline is enabled. If enabled, this option improves interpolation between the adjacent pixels of the shoreline texture to reduce stepping artifacts.

Return value

true if high precision is enabled, otherwise, false.

void setFieldShorelineNormal ( bool normal ) #

Enables/disables calculation of normals for geometry of shoreline waves. This option significantly reduces performance and can be used in cases, when really large waves are required. Enabling just the geometry state to simulate distortion of the water surface by a shoreline wave is enough in most cases.

Arguments

  • bool normal - true to enable, false to disable.

bool isFieldShorelineNormal ( ) const#

Returns a value indicating if calculation of normals for geometry of shoreline waves is enabled.

Return value

true if enabled, otherwise, false.

void setFieldShorelineGeometry ( bool geometry ) #

Enables/disables rendering of wave geometry for shoreline waves. If disabled, the water surface remains flat. Disabling this option in cases where wave geometry is hardly noticeable (e.g. a flight simulator) gives a performance gain.

Arguments

  • bool geometry - true to enable, false to disable.

bool isFieldShorelineGeometry ( ) const#

Returns a value indicating if rendering of wave geometry for shoreline waves is enabled.

Return value

true if enabled, otherwise, false.

void setFieldShorelineFoam ( bool foam ) #

Enables/disables rendering of foam for shoreline zones.

Arguments

  • bool foam - true to enable, false to disable.

bool isFieldShorelineFoam ( ) const#

Returns a value indicating if rendering of foam for shoreline zones is enabled.

Return value

true if enabled, otherwise, false.

void setAuxiliary ( bool auxiliary ) #

Enables/disables the auxiliary rendering pass for the material. Can be used for custom post-effects, such as thermal vision, night vision, etc. Enabling the option activates the Auxiliary Color parameter.

Arguments

  • bool auxiliary - true to enable, false to disable.

bool isAuxiliary ( ) const#

Returns a value indicating if the auxiliary rendering pass for the material is enabled.

Return value

true if enabled, otherwise, false.

void setFieldHeightEnabled ( bool enabled ) #

Enables/disables the effect of FieldHeight object on the Global Water object.

Arguments

  • bool enabled - true to enable, false to disable.

bool isFieldHeightEnabled ( ) const#

Checks if the assigned material on the Global Water object has enabled FieldHeight interaction option.

Return value

true if the FieldHeight interaction option is enabled, otherwise, false.

void setFieldSpacerEnabled ( bool enabled ) #

Enables/disables the effect of FieldSpacer object on the Global Water object.

Arguments

  • bool enabled - true to enable, false to disable.

bool isFieldSpacerEnabled ( ) const#

Returns a value indicating if the effect of FieldSpacer object on the Global Water object is enabled.

Return value

true if enabled, otherwise, false.
Last update: 30.11.2021
Build: ()