Unigine.ObjectWaterGlobal Class
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.
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.
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:
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 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.cs file to create waves in Manual mode:
AppWorldLogic.cs
ObjectWaterGlobal water = null;
/* ... */
private void Init()
{
// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
// Changing preset to custom (4) and adjusting tesselation parameters
Render.WaterGeometryPreset = 4;
Render.WaterGeometryPolygonSize = 0.01f;
Render.WaterGeometryProgression = 1.0f;
Render.WaterGeometrySubpixelReduction = 6.0f;
water = (ObjectWaterGlobal)World.GetNodeByType((int)Node.TYPE.OBJECT_WATER_GLOBAL);
if (water == null)
{
water = new ObjectWaterGlobal();
}
// You can set each wave only in Manual mode
water.WavesMode = 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.0f, 0.05f, 2.0f, 270.0f, 0.0f);
water.AddWave(8.0f, 0.015f, 1.0f, 150.0f, 1.0f);
water.AddWave(8.0f, 0.02f, 6.0f, 75.0f, 0.0f);
water.AddWave(16.0f, 0.05f, 2.0f, 270.0f, 3.0f);
water.AddWave(16.0f, 0.05f, 7.0f, 45.0f, 0.5f);
water.AddWave(32.0f, 0.1f, 2.0f, 120.0f, 2.0f);
water.AddWave(64.0f, 0.2f, 1.0f, -90.0f, 0.1f);
// Changing amplitude and length for the second wave
water.SetWaveAmplitude(1, 0.03f);
water.SetWaveLength(1, 10.0f);
}
/* ... */
Getting Water Level and Surface Normal#
To ensure proper placement and orientation of objects relatively to the water surface you need to obtain water level (height) and normal orientation at a certain point. You can do this using the following methods:
By default the quality (precision) of calculating heights and normals is set to optimize performance, but in case of higher Beaufort levels (resulting in significant wave steepness and height differences on the water surface), calculation results may differ from visual representation (e.g. calculated water level may be greater the actual value). This may, for example, result in setting incorrect position and orientation for a ship relative to the water surface. To avoid such cases you can increase the quality of calculations for height/normal fetch requests via the following parameters are available via API:
- Steepness Quality (see the FetchSteepnessQuality) - wave steepness calculation accuracy used when calculating water level (height) and normal orientation at a certain point. This parameter is used to improve calculation results in case of high wave steepness (higher Beaufort levels). Low quality is usually sufficient for calm water (high quality provides good results for Beauforts 6-7, while ultra is recommended for Beauforts 8-10).
- Amplitude Threshold (see the FetchAmplitudeThreshold) - this is the minimum amplitude threshold for waves to be taken into account in height and normal calculations (waves having smaller amplitudes will be ignored).
So in case of higher Beaufort levels you can adjust the quality of intersections calculation using the following lines:
water.FetchSteepnessQuality = ObjectWaterGlobal.STEEPNESS_QUALITY.ULTRA;
water.FetchAmplitudeThreshold = 0.01f;
Finding Intersection Points#
Intersections are used for many purposes, for example, you can find an intersection point of a projectile with the water surface to spawn some splashes. By default the quality (precision) of calculating intersection points is set to optimize performance, but in case of higher Beaufort levels (resulting in significant wave steepness and height differences on the water surface), calculation results may differ from visual representation (e.g. intersection point is detected at some distance from the water surface). This may, for example, result in spawning particle systems representing splashes at a wrong position. To avoid such cases you can increase the quality of calculations for intersection detection via the following parameters are available via API:
- Precision (see the IntersectionPrecision) - represents a permissible error between the calculated and real water intersection point.
- Steepness Quality (see the IntersectionSteepnessQuality) - wave steepness calculation accuracy used in intersection calculations. This parameter is used to improve calculation of intersections in case of high wave steepness (higher Beaufort levels). Low quality is usually sufficient for calm water (high quality provides good results for Beauforts 6-7, while ultra is recommended for Beauforts 8-10).
- Amplitude Threshold (see the IntersectionAmplitudeThreshold) - this is the minimum amplitude threshold for waves to be taken into account in intersection calculations (waves having smaller amplitudes will be ignored).
So in case of higher Beaufort levels you can adjust the quality of intersections calculation using the following lines:
water.FetchSteepnessQuality = ObjectWaterGlobal.STEEPNESS_QUALITY.ULTRA;
water.FetchAmplitudeThreshold = 0.01f;
Usage Example#
This example demonstrates the influence of the Steepness Quality, Amplitude Threshold, and Precision parameters on the accuracy of fetch and intersection requests for the Global Water object at various Beaufort levels.
Create a new C# component named WaterFetchIntersection and copy the code below to the corresponding file:
WaterFetchIntersection.cs
using System;
using System.Collections;
using System.Collections.Generic;
using Unigine;
[Component(PropertyGuid = "AUTOGENERATED_GUID")] // <-- this line is generated automatically for a new component
public class WaterFetchIntersection : Component
{
// Object Water Global node to perform requests for
public Node water_node;
// Fetch request mode flag (false - means Intersection request)
private bool fetch = true;
// size and number of points
private int num_intersection = 100;
private float intersect_point_size = 0.2f;
//UI elements
WidgetSlider slider_num_requests;
WidgetSlider slider_beaufort;
WidgetSlider slider_fetch_amplitude;
WidgetSlider slider_fetch_stepness;
WidgetSlider slider_intersection_amplitude;
WidgetSlider slider_intersection_stepness;
WidgetSlider slider_precision;
// pointer to the Global Water object
private ObjectWaterGlobal water;
private WidgetWindow window;
// UI construction for parameters
// function creating a parameter and adding the corresponding UI element
private WidgetSlider create_param(Widget parent, String name, float default_value, float min_value, float max_value, Func<float,int> f, bool floating)
{
WidgetLabel label = new WidgetLabel(name);
label.Width = 100;
parent.AddChild(label, Gui.ALIGN_LEFT);
WidgetSlider slider = new WidgetSlider();
slider.MinValue = MathLib.ToInt(min_value * (floating ? 1000 : 1));
slider.MaxValue = MathLib.ToInt(max_value * (floating ? 1000 : 1));
slider.Value = MathLib.ToInt(default_value * (floating ? 1000 : 1));
slider.Width = 200;
slider.ButtonWidth = 20;
slider.ButtonHeight = 20;
parent.AddChild(slider, Gui.ALIGN_LEFT);
label = new WidgetLabel(default_value.ToString());
label.Width = 20;
parent.AddChild(label);
slider.EventChanged.Connect(() =>
{
float v = slider.Value / (floating ? 1000.0f : 1.0f);
label.Text = v.ToString();
f(v);
});
return slider;
}
private void Init_GUI()
{
window = new WidgetWindow("Fetch and Intersection Water Parameters");
Gui.GetCurrent().AddChild(window, Gui.ALIGN_OVERLAP);
WidgetGroupBox group_box = new WidgetGroupBox("Parameters", 8, 8);
window.AddChild(group_box, Gui.ALIGN_LEFT);
WidgetHBox hbox = new WidgetHBox();
group_box.AddChild(hbox, Gui.ALIGN_LEFT);
WidgetLabel label = new WidgetLabel("Request Type");
label.Width = 180;
hbox.AddChild(label, Gui.ALIGN_LEFT);
WidgetButton fetch_b = new WidgetButton("Fetch");
hbox.AddChild(fetch_b, Gui.ALIGN_LEFT);
fetch_b.Toggleable = true;
fetch_b.Toggled = fetch;
WidgetButton intersection_b = new WidgetButton("Intersection");
hbox.AddChild(intersection_b, Gui.ALIGN_LEFT);
intersection_b.Toggleable = true;
intersection_b.Toggled = !fetch;
fetch_b.EventChanged.Connect(()=>
{
fetch = fetch_b.Toggled;
intersection_b.Toggled = !fetch;
}
);
intersection_b.EventChanged.Connect(()=>
{
fetch = !intersection_b.Toggled;
fetch_b.Toggled = fetch;
}
);
WidgetGridBox grid = new WidgetGridBox(3);
group_box.AddChild(grid);
// number of fetch/intersection requests slider
slider_num_requests = create_param(grid, "Request Count", num_intersection, 100, 10000, (v) => { num_intersection = MathLib.ToInt(v); return 1;}, false);
// Beaufort level slider
slider_beaufort = create_param(grid, "Beaufort", 0, 0, 13, (v) => { water.Beaufort = v; return 1;}, true);
for (int i = 0; i < 3; i++)
{
WidgetSpacer s = new WidgetSpacer();
grid.AddChild(s);
s.Orientation = 1;
}
// sliders controlling quality parameters for fetch requests
slider_fetch_amplitude = create_param(grid, "Fetch Amplitude Threshold", water.FetchAmplitudeThreshold, 0.001f, 0.5f, (v) => { water.FetchAmplitudeThreshold = v; return 1;}, true);
slider_fetch_stepness = create_param(grid, "Fetch Steepness Quality", (float) water.FetchSteepnessQuality, 0, 4, (v) => { water.FetchSteepnessQuality = (ObjectWaterGlobal.STEEPNESS_QUALITY) MathLib.RoundToInt(v); return 1;}, false);
for (int i = 0; i < 3; i++)
{
WidgetSpacer s = new WidgetSpacer();
grid.AddChild(s);
s.Orientation = 1;
}
// sliders controlling quality and precision parameters for intersection requests
slider_intersection_amplitude = create_param(grid, "Intersection Amplitude Threshold", water.IntersectionAmplitudeThreshold, 0.001f, 0.5f, (v) => { water.IntersectionAmplitudeThreshold = v; return 1;}, true);
slider_intersection_stepness = create_param(grid, "Intersection Steepness Quality", (float) water.IntersectionSteepnessQuality, 0, 4, (v) => { water.IntersectionSteepnessQuality = (ObjectWaterGlobal.STEEPNESS_QUALITY) MathLib.RoundToInt(v); return 1;}, false);
slider_precision = create_param(grid, "Intersection Precision", water.IntersectionPrecision, 0.01f, 2.0f, (v) => { water.IntersectionPrecision = v; return 1;}, true);
}
private void Shutdown_GUI()
{
window.DeleteLater();
}
private void Init()
{
// write here code to be called on component initialization
water = water_node as ObjectWaterGlobal;
Visualizer.Enabled = true;
Init_GUI();
}
private void Update()
{
// calculating the number of fetch/intersection points along X and Y axes
int count = MathLib.ToInt(MathLib.Sqrt(num_intersection));
// creating an object to store intersection data
ObjectIntersectionNormal oin = new ObjectIntersectionNormal();
// looping over all points to perform fetch/intersection requests with the current settings
for (int i = 0; i < count; i++)
{
for (int j = 0; j < count; j++)
{
vec3 pos = new vec3(i, j, 0);
if (fetch)
{
// getting Global Water height data and the point and displaying it
float v = water.FetchHeight(pos);
pos.z += v;
Visualizer.RenderPoint3D(pos, intersect_point_size, vec4.BLUE);
// getting and displaying normals at fetch points
vec3 n = water.FetchNormal(pos);
Visualizer.RenderVector(pos, pos + new vec3(n), vec4.WHITE);
}
else
{
// getting and displaying normals at intersection points
if (water.GetIntersection(pos + vec3.UP * 100, pos - vec3.UP * 100, oin, 0))
{
Visualizer.RenderPoint3D(oin.Point, intersect_point_size, vec4.GREEN);
Visualizer.RenderVector(oin.Point, oin.Point + new vec3(oin.Normal), vec4.WHITE);
}
}
}
}
}
private void Shutdown()
{
Shutdown_GUI();
}
}
See Also#
- Set of the Water Global samples in the CPP Samples suite included in the SDK and demonstrating how to use C++ API to control Global Water, fetch water level at a given point, etc.
- The Water Global sample in the C# Component Samples suite included in the SDK and demonstrating how to use C# API to control Global Water, fetch water level at a given point, etc.
ObjectWaterGlobal Class
Перечисления (Enums)
WAVES_MODE#
Имя | Описание |
---|---|
MANUAL = 0 | Manual mode of wave generation. |
LAYERS = 1 | Layer mode of wave generation. |
BEAUFORTS = 2 | Beaufort scale mode of wave generation. |
STEEPNESS_QUALITY#
Steepness calculation accuracy used when calculating intersections, as well as fetching water level (height) and normal orientation at a certain point. This parameter is used to improve calculation results in case of high wave steepness (higher Beaufort levels). Low quality is usually sufficient for calm water (high quality provides good results for Beauforts 6-7, while ultra is recommended for Beauforts 8-10, if you're still not satisfied with the result you can use extreme).PLANAR_REFLECTION_SIZE#
Properties
bool FieldSpacerEnabled#
float SoftInteraction#
float DecalsSoftInteraction#
float DecalsDistortion#
float RefractionScale#
vec4 AuxiliaryColor#
bool Auxiliary#
float ShorelineWetnessOffset#
float ShorelineWetnessDistance#
float ShorelineWetnessIntensity#
float FieldShorelineBeaufortFalloff#
float FieldShorelineMaskTiling#
float FieldShorelineFoamExponent#
float FieldShorelineFoamIntensity#
float FieldShorelineFoamStretching#
float FieldShorelineWaveFrontExponent#
float FieldShorelineWaveExponent#
float FieldShorelineWaveFalloff#
float FieldShorelineWaveHeight#
float FieldShorelineWaveTiling#
float FieldShorelineWaveSpeed#
string FieldShorelineLUTTexturePath#
bool FieldShorelineFoam#
bool FieldShorelineGeometry#
bool FieldShorelineNormal#
bool FieldShorelineHighPrecision#
bool FieldShorelineEnabled#
float FieldHeightSteepness#
float FieldHeightFoamIntensity#
float FieldHeightFoamContrast#
bool FieldHeightEnabled#
float CausticBrightness#
float CausticAnimationSpeed#
float CausticDistanceFade#
vec4 CausticUVTransform#
string CausticsTexturePath#
bool CausticsDistortion#
bool Caustics#
float ReflectionOcclusionSlope#
float ReflectionOcclusion#
float ReflectionRoughness#
int PlanarReflectionViewportMask#
vec3 PlanarReflectionPivotOffset#
float PlanarReflectionDistance#
ObjectWaterGlobal.PLANAR_REFLECTION_SIZE PlanarReflectionMapSizeType#
bool PlanarReflection#
float UnderwaterDofDistance#
bool UnderwaterDOF#
float WaterlineSize#
float UnderwaterShaftIntensity#
float UnderwaterFogSunInfluence#
float UnderwaterFogEnvironmentInfluence#
float UnderwaterFogOffset#
float UnderwaterFogDepth#
float UnderwaterFogTransparency#
vec4 UnderwaterFogColor#
string DepthLUTTexturePath#
float SubsurfaceDecalsIntensity#
float SubsurfaceWaveFoamIntensity#
float SubsurfaceWaveIntensity#
float SubsurfaceAmbientIntensity#
vec4 SubsurfaceColor#
float FoamTextureAffect#
float FoamContactIntensity#
float FoamWindIntensity#
float FoamWindContrast#
float FoamWhitecapIntensity#
float FoamWhitecapContrast#
float FoamPeakIntensity#
float FoamPeakContrast#
float Foam1UVSpeed#
float Foam1UVScale#
float Foam0UVSpeed#
float Foam0UVScale#
string FoamTexturePath#
float DistantWavesBlendMax#
float DistantWavesBlendMin#
float DistantWavesBlendDistanceEnd#
float DistantWavesBlendDistanceStart#
float DistantWavesIntensity#
vec4 DistantWavesUVTransform#
string DistantWavesTexturePath#
float Detail1Intensity#
vec2 Detail1UVSpeed#
vec2 Detail1UVSize#
float Detail0Intensity#
vec2 Detail0UVSpeed#
vec2 Detail0UVSize#
string DetailTexturePath#
float TextureNormalIntensity#
float TextureNormalBlur#
float GeometryNormalIntensity#
float Beaufort#
int NumLayers#
int NumWaves#
ObjectWaterGlobal.WAVES_MODE WavesMode#
int VisualFieldMask#
int PhysicsFieldMask#
ObjectWaterGlobal.STEEPNESS_QUALITY IntersectionSteepnessQuality#
float IntersectionAmplitudeThreshold#
float IntersectionPrecision#
ObjectWaterGlobal.STEEPNESS_QUALITY FetchSteepnessQuality#
float FetchAmplitudeThreshold#
float WavesSpeedScale#
float WindAffect#
float WindDirectionAngle#
float MeanLevel#
float AnimationTime#
bool ActiveWater#
Members
ObjectWaterGlobal ( ) #
Constructor. Creates a new global water object.void SetLayerName ( int layer, string value ) #
Sets a new name for the wave layer. Available when the Layers mode is set.Arguments
- int layer - Layer number
- string value - Name of the layer.
string GetLayerName ( int layer ) #
Returns the name of the wave layer. Available when the Layers mode is set.Arguments
- int layer - Layer number
Return value
Name of the layervoid 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 ) #
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 ) #
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 ) #
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, 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.
- vec2 value - Amplitude range.
vec2 GetLayerAmplitudeRange ( int layer ) #
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, 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
- vec2 value - Length range.
vec2 GetLayerLengthRange ( int layer ) #
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 ) #
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 ) #
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 enabled; 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.
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 ) #
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 ) #
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 ) #
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 a 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 ) #
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 a 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 ) #
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.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.static int type ( ) #
Returns the type of the node.Return value
Object type identifier.float FetchHeight ( vec3 position ) #
Returns a height offset of the specified point relative to the current water level calculated at this point. E.g. in case the specified point is (0, 0, -3) and the current water level calculated for this point is equal to 5, the function shall return 8.
Arguments
- vec3 position - Point position coordinates.
Return value
Height offset of the specified point relative to the current water level calculated at this point, in meters.vec3 FetchNormal ( vec3 position ) #
Returns a normal vector to the water surface at the specified point (to orient objects along the waves normals).Arguments
- vec3 position - Point position coordinates.
Return value
Normal vector.void TakeSyncData ( Stream stream ) #
Writes wave synchronization data to the specified stream.Arguments
- Stream stream - Stream to which wave synchronization data is to be written.
void ApplySyncData ( Stream stream ) #
Reads wave synchronization data from the specified stream and applies it to the wave system.Arguments
- Stream stream - Stream with wave synchronization data to be applied.
void SetDecalsSoftInteraction ( float interaction ) #
Sets a new soft intersection of water with decals.Arguments
- float interaction - Soft intersection value.
float GetDecalsSoftInteraction ( ) #
Returns the current soft intersection of water with decals.Return value
Soft intersection value.void SetWavesSpeedScale ( float scale ) #
Sets a scale value that affects the speed of all the waves. The resulting wave speed is calculated as sqrt(gravity * 2 * pi / wave_length) * waves_speed_scale, where gravity = 9.81 m/s2.Arguments
- float scale - Scale value.