Unigine.FieldHeight Class
Inherits: | Field |
This class is used to create and modify a field height. The field is applied to global water and specifies areas where height of waves should be changed.
The maximum number of the rendered FieldHeight objects per frame/bit mask is 8.
Creating a Height Field
When creating a FieldHeight object you should specify a heightmap texture for it as this object doesn't have any default texture.
// create a new instance of the FieldHeight class and set its transformation
FieldHeight height = new FieldHeight();
height.setTransform(Mat4(1));
// set the size of the field
height.setSize(vec3(4096.0f, 4096.0f, 512.0f));
// set the heightmap texture
height.setTexturePath("unigine_project/textures/fh_static.png");
See also#
UnigineScript API sample <UnigineSDK>/data/samples/fields/height_00
FieldHeight Class
Properties
Texture Texture#
The heightmap texture (from gpu) and saves it into the given texture instance.
set
Sets the given texture from the Texture instance for the FieldHeight.
set value -
Texture instance.
string TexturePath#
The path to the fieldheight's heightmap texture.
set
Sets the path to the FieldHeight's heightmap texture.
set value -
Path to the heightmap texture.
int BlendMode#
The current field height blending mode.
Attenuation parameter is interpreted depending on the selected blending mode:
- is used as a mulpiplier for the additive mode
- lerp(1.0f, value, attenuation) is used for the multiplicative mode
set
Sets the field height blending mode.
Attenuation parameter is interpreted depending on the selected blending mode:
- is used as a mulpiplier for the additive mode
- lerp(1.0f, value, attenuation) is used for the multiplicative mode
set value -
Blending mode to be set. One of the BLEND_*values.Blending mode to be set. One of the FIELD_HEIGHT_BLEND_*values.
int Order#
The current field height rendering order.
This parameter is used to properly apply fields with mixed blend modes.
set
Sets the field height rendering order.
This parameter is used to properly apply fields with mixed blend modes.
set value -
Rendering order to set.
float Power#
The fieldheight's power value. the power is a multiplier for loaded heightmap texture values.
set
Sets the FieldHeight's power value. The power is a multiplier for loaded heightmap texture values. By default the power is set to 1.0f.
set value -
Power value. The higher the value, the more FieldHeight's heights will have influence on the Global Water's object heights.
float Attenuation#
The fieldheight's attenuation factor value. the attenuation factor indicates the rate of filedheight influence attenuation from the center of the object to its edges.
set
Sets the FieldHeight's attenuation factor value. The attenuation factor indicates the rate of FiledHeight influence attenuation from the center of the object to its edges. By default the attenuation factor is set to 1.0f.
set value -
Attenuation factor. The higher the value, the less FieldHeight's heights will have influence on the Global Water's object heights.
vec3 Size#
The vec3 size vector of the fieldheight's object.
set
Sets the vec3 size vector of the FieldHeight's object. By default, the size is (1.0f, 1.0f, 1.0f).
set value -
Size vector (x,y,z), where:
- x value is length of the FieldHeight along X axis (in units),
- y value is length of the FieldHeight along Y axis (in units),
- z value is length of the FieldHeight along Z axis (in units).
Members
static FieldHeight ( ) #
The default constructor. Creates a FieldHeight instance with the default size vec3(1.0f, 1.0f, 1.0f).By default, a heightmap texture is empty. Specify it after creating the FieldHeight by using an appropriate function.
int SetTextureImage ( Image image ) #
Sets the given image as the heightmap texture of the FieldHeight.Arguments
- Image image - Image instance with heightmap for FieldHeight.
Return value
1 if the texture is set successfully; otherwise, 0.int GetTextureImage ( Image image ) #
Grabs the texture for the FieldHeight (already loaded to GPU) and saves it into the given Image instance.Arguments
- Image image - Image instance into which the texture will be saved.
Return value
1 if the texture has been grabbed successfully; otherwise, 0.static int type ( ) #
Returns the type of the object.Return value
FieldHeight type identifier.Last update:
2020-04-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)