Unigine.ObjectGrass Class
Inherits: | Object |
ObjectGrass Class
Properties
int CutoutInverse#
A value indicating if the grass is rendered inside or outside the areas determined by the cutout intersection mask.
set
Sets a value indicating whether the grass should be rendered inside or outside the areas determined by the cutout intersection mask.
set value -
0 to render the grass outside the areas determined by the cutout intersection mask; 1 to render the grass inside these areas.
int CutoutIntersectionMask#
The current cutout intersection mask. this mask allows you to cut out the grass in the areas of intersection with objects and decals (e.g. can be used to remove grass under houses or from the surface of roads projected using decals). the grass will be cut out by objects and decals that have their intersection mask matching this one (one bit at least).
To set intersection masks the following methods can be used:
- for decals use getIntersectionMask()
- for objects use getIntersectionMask()
set
Sets a new cutout intersection mask. This mask allows you to cut out the grass in the areas of intersection with objects and decals (e.g. can be used to remove grass under houses or from the surface of roads projected using decals). The grass will be cut out by objects and decals that have their intersection mask matching this one (one bit at least).
To set intersection masks the following methods can be used:
- for decals use getIntersectionMask()
- for objects use getIntersectionMask()
set value -
Integer, each bit of which is a mask.
int MaskInverse#
A flag indicating if the grass is rendered inside or outside the mask mesh contour.
set
Specifies if the grass should be rendered inside or outside the mask mesh contour.
set value -
0 to render the grass inside the mesh contour; 1 to render it outside.
int MaskMaxValue#
The maximum value of the mask application range.
set
Sets the maximum value of the mask application range.
set value -
Maximum mask value, [0;255].
int MaskMinValue#
The minimum value of the mask application range.
set
Sets the minimum value of the mask application range.
set value -
Minimum mask value, [0;255].
int MaskFlipY#
A flag indicating if a mask is flipped by y axis.
set
Flip the mask by Y axis.
set value -
Positive value to flip the mask; otherwise, 0.
int MaskFlipX#
A flag indicating if a mask is flipped by x axis.
set
Flip the mask by X axis.
set value -
Positive value to flip the mask; otherwise, 0.
vec4 Probability#
The current grass rendering probability per column (in the diffuse texture). the higher the value for some column, the more frequently it will be rendered.
set
Sets the grass rendering probability per column (in the diffuse texture). The higher the value for some column, the more frequently it will be rendered.
set value -
Per-column probability. Any values can be set, since they are normalized.
float Angle#
The current angle cosine defining the slope steepness appropriate for grass growing.
set
Sets the angle cosine defining the slope steepness appropriate for grass growing.
set value -
Slope angle cosine in range from 0 to 1.
float Threshold#
The current threshold for density, starting from which the grass is rendered.
set
Sets the threshold for density, starting from which the grass will be rendered.
set value -
Threshold value in range from 0 to 1.
float Density#
The current density factor for the grass per square unit.
set
Sets the density factor for the grass per square unit.
set value -
Density factor. If a negative value is provided, 0 will be used instead.
int Subdivision#
The current divisor used to subdivide grass rendering cells into smaller sub-cells. subdividing is used if a grass node is used as a distant lod for WorldClutter or ObjectMeshClutter with smaller cells. This way, positions of randomly scattered objects will coincide with those of grass-based impostors.
set
Subdivide grass rendering cells into smaller sub-cells. It is used if a grass node is used as a distant LOD for WorldClutter or ObjectMeshClutter with smaller cells. This way, positions of randomly scattered objects will coincide with those of grass-based impostors.
set value -
Divisor for cells. The value is clamped to a range [1;32].
float Step#
The current step for cells used to render grass.
set
Sets the step for cells used to render grass.
set value -
Step for grass cells.
float SizeY#
The current length of the grass object along the y-coordinate.
set
Sets the length of the grass object along the Y-coordinate.
set value -
Y-coordinate length in units. If a negative value is provided, 0 will be used instead.
float SizeX#
The current width of the grass object along the x-coordinate.
set
Sets the width of the grass object along the X-coordinate.
set value -
X-coordinate width in units. If a negative value is provided, 0 will be used instead.
int Seed#
The seed used for pseudo-random positioning of grass.
set
Sets the seed for pseudo-random positioning of grass.
set value -
Number used to initialize a pseudo-random sequence. If a negative value is provided, 0 will be used instead.
int SpawnCount#
The number of cells to be generated.
int NumTextures#
The number of rows contained in the grass diffuse texture.
set
Sets the number of rows contained in the grass diffuse texture.
set value -
Number of rows in the grass diffuse texture in the [1; 4] range.
int Intersection#
A value indicating whether grass grow upon the ground: either the terrain or a mesh set as a parent node.
set
Sets a value indicating whether grass should grow upon the ground: either the terrain or a mesh set as a parent node.
set value -
Positive number to enable intersection; 0 to disable.
int Orientation#
A flag indicating if grass polygons are oriented along the normal of its parent (for example, a terrain).
set
Sets a flag to orient grass polygons along the normal of its parent (for example, a terrain).
set value -
1 to orient the grass along the normals of the ground; 0 to render it always pointing upwards.
int Variation#
A value indicating if the random horizontal flip for grass polygons is set.
set
Sets the random horizontal flip for grass polygons.
set value -
1 to enable grass flipping, 0 to disable it.
int Thinning#
A flag indicating if the grass is thinned out with a distance (random grass polygons are not rendered across the grass fade distance).
set
Sets a flag to thin out grass with a distance (random grass polygons are not rendered across the grass Fade distance).
set value -
1 to thin out the grass; 0 to render all grass polygons at the distance.
int FieldMask#
A mask specifying the area of the field node to be applied to the grass.
set
Sets a mask specifying the area of the Field node to be applied to the grass.
set value -
Integer, each bit of which is a mask.
ivec4 TerrainMasks#
The current set of Landscape Terrain masks used for grass placement.
set
Sets a new set of Landscape Terrain masks to be used for grass placement.
set value -
Four-component vector combining Landscape Terrain mask indices (each component in the [0; 19] range) to be used for the corresponding diffuse texture column.
Members
static ObjectGrass ( ) #
Constructor. Creates a new grass object.void SetAspect ( vec4 mean, vec4 spread ) #
Sets the aspect of the grass polygons (width to height ratio).Arguments
- vec4 mean - Mean value of grass aspect.
- vec4 spread - Spread value of grass aspect.
vec4 GetAspectMean ( ) #
Returns the current mean value of the grass aspect (width to height ratio), defined for four diffuse texture columns.Return value
Mean value of grass aspect.vec4 GetAspectSpread ( ) #
Returns the current spread value of the grass aspect (width to height ratio), defined for four diffuse texture columns.Return value
Spread value of grass aspect.int SetMaskImage ( Image image, int invalidate = 1 ) #
Sets an image that defines the areas of growing grass. Possible mask formats are R8, RG8, RGB8 and RGBA8.Arguments
- Image image - Pointer to the image.
- int invalidate - Invalidate flag. Set 1 to invalidate all grass cells; otherwise, set 0. All invalidated cells will be regenerated.
Return value
1 if the mask image is successfully set; otherwise, 0.int GetMaskImage ( Image image ) #
Writes the image that is currently used to define the areas of grass growing into the given buffer. Possible mask formats are R8, RG8, RGB8 and RGBA8.Arguments
- Image image - Image buffer to store a mask into.
Return value
1 if the mask image is successfully written into the buffer; otherwise, 0.void SetMaskImageName ( string image_name, int invalidate = 1 ) #
Sets the name of a mask image that defines the areas of growing grass. Possible mask formats are R8, RG8, RGB8 and RGBA8.Arguments
- string image_name - Name (path) of the mask image.
- int invalidate - Invalidate flag. Set 1 to invalidate all grass cells; otherwise, set 0. All invalidated cells will be regenerated.
string GetMaskImageName ( ) #
Returns a name of the current mask image that defines the areas of grass growing. Possible mask formats are R8, RG8, RGB8 and RGBA8.Return value
Name (path) of the mask image.int SetMaskMesh ( Mesh mesh, int invalidate = 1 ) #
Sets a mesh to be used as a mask on-the-fly. Limitations:- Before the method is called, another mesh must be set via setMaskMeshName() first.
- If the world is reloaded, the mesh set via setMaskMeshName() will be loaded.
- If the memory limit is exceeded, the new mesh might be replaced with the mesh set via setMaskMeshName().
Arguments
- Mesh mesh - Mesh instance.
- int invalidate - Invalidate flag. Set 1 to invalidate all grass cells; otherwise, set 0. All invalidated cells will be regenerated.
Return value
1 if the mesh is set successfully; otherwise - 0.int GetMaskMesh ( Mesh mesh ) #
Copies the current mask mesh (if it exists) to the specified target mesh.Arguments
- Mesh mesh - Mesh instance to copy the current mask mesh to.
Return value
1 if mesh mask exists; otherwise - 0.void SetMaskMeshName ( string mesh_name, int invalidate = 1 ) #
Sets a mesh to be used as a mask for the grass. This mesh should be plane.Arguments
- string mesh_name - Path to the *.mesh file.
- int invalidate - Invalidate flag. Set 1 to invalidate all grass cells; otherwise, set 0. All invalidated cells will be regenerated.
string GetMaskMeshName ( ) #
Returns the name (path) of the current mesh used as a mask for the grass. This mesh should be plane.Return value
Path to the *.mesh file.void SetMaxBend ( vec4 mean, vec4 spread ) #
Sets the maximum grass bending parameters (rendered in areas with the highest density according to the mask). Bend angles (mean and spread) are defined for four diffuse texture columns. The resulting value is determined as follows: Result = Mean + Random * Spread, where Random is a random value in range from -1 to 1.Arguments
- vec4 mean - Vector of mean values of grass bending angles to be set for four diffuse texture columns.
- vec4 spread - Vector of spread values of grass bending angles to be set for four diffuse texture columns.
vec4 GetMaxBendMean ( ) #
Returns the mean value for the maximum grass bending (rendered in areas with the highest density according to the mask). Bend angles are defined for four diffuse texture columns.Return value
Vector of mean values of grass bending angles for four diffuse texture columns.vec4 GetMaxBendSpread ( ) #
Returns the spread value for the maximum grass bending (rendered in areas with the highest density according to the mask). Bend angles are defined for four diffuse texture columns.Return value
Vector of spread values of grass bending angles for four diffuse texture columns.void SetMinBend ( vec4 mean, vec4 spread ) #
Sets the minimum grass bending parameters (rendered in areas with the lowest density according to the mask). Bend angles (mean and spread) are defined for four diffuse texture columns. The resulting value is determined as follows: Result = Mean + Random * Spread, where Random is a random value in range from -1 to 1.Arguments
- vec4 mean - Vector of mean values of grass bending angles to be set for four diffuse texture columns.
- vec4 spread - Vector of spread values of grass bending angles to be set for four diffuse texture columns.
vec4 GetMinBendMean ( ) #
Returns the mean value for the minimum grass bending (rendered in areas with the lowest density according to the mask). Bend angles are defined for four diffuse texture columns.Return value
Vector of mean values of grass bending angles for four diffuse texture columns.vec4 GetMinBendSpread ( ) #
Returns the spread value for the minimum grass bending (rendered in areas with the lowest density according to the mask). Bend angles are defined for four diffuse texture columns.Return value
Vector of spread values of grass bending angles for four diffuse texture columns.void SetMaxHeight ( vec4 mean, vec4 spread ) #
Sets the maximum grass height (rendered in areas with the highest density according to the mask). The height is defined for four diffuse texture columns, as mean and spread values ( Result = Mean + Random * Spread, where Random is a random value in range from -1 to 1).Arguments
- vec4 mean - Mean value for the maximum grass height in units. If a negative value is provided, EPSILON will be used instead.
- vec4 spread - Spread value for the maximum grass height in units.
vec4 GetMaxHeightMean ( ) #
Returns the mean value for the maximum grass height (rendered in areas with the highest density according to the mask). The height is defined for four diffuse texture columns.Return value
Mean value for the maximum grass height in units.vec4 GetMaxHeightSpread ( ) #
Returns the spread value for the maximum grass height (rendered in areas with the highest density according to the mask). The height is defined for four diffuse texture columns.Return value
Spread value for the maximum grass height in units.void SetMinHeight ( vec4 mean, vec4 spread ) #
Sets the minimum grass height (rendered in areas with the lowest density according to the mask). The height is defined for four diffuse texture columns, as mean and spread values ( Result = Mean + Random * Spread, where Random is a random value in range from -1 to 1).Arguments
- vec4 mean - Mean value for the minimum grass height in units. If a negative value is provided, EPSILON will be used instead.
- vec4 spread - Spread value for the minimum grass height in units.
vec4 GetMinHeightMean ( ) #
Returns the mean value for the minimum grass height (rendered in areas with the lowest density according to the mask). The height is defined for four diffuse texture columns.Return value
Mean value for the minimum grass height in units.vec4 GetMinHeightSpread ( ) #
Returns the spread value for the minimum grass height (rendered in areas with the lowest density according to the mask). The height is defined for four diffuse texture columns.Return value
Spread value for the minimum grass height in units.void SetOffset ( vec4 mean, vec4 spread ) #
Sets the grass offset from the surface along the surface normal, defined for four diffuse texture columns. If a negative mean value is provided, vec4_eps will be used instead.Arguments
- vec4 mean - Mean value of grass polygons offset in units.
- vec4 spread - Spread value of grass polygons offset in units.
vec4 GetOffsetMean ( ) #
Returns the current mean value of the grass offset from the surface along the surface normal, defined for four diffuse texture columns.Return value
Mean value of grass polygons offset in units.vec4 GetOffsetSpread ( ) #
Returns the current spread value for the grass offset from the surface along the surface normal, defined for four diffuse texture columns.Return value
Spread value for grass polygons offset in units.void SetRotation ( vec4 mean, vec4 spread ) #
Sets the grass rotation. Rotation is defined for four diffuse texture columns, as mean and spread values ( Result = Mean + Random * Spread, where Random is a random value in range from -1 to 1).Arguments
- vec4 mean - Mean value of grass polygons rotation, in degrees.
- vec4 spread - Spread value of grass polygons rotation, in degrees.
vec4 GetRotationMean ( ) #
Returns the current mean value for the grass rotation, defined for four diffuse texture columns.Return value
Mean value of grass polygons rotation, in degrees.vec4 GetRotationSpread ( ) #
Returns the current spread value for the grass rotation, defined for four diffuse texture columns.Return value
Spread value of grass polygons rotation, in degrees.static int type ( ) #
Returns the type of the node.Return value
Object type identifier.void Invalidate ( ) #
Invalidates all grass cells. All invalidated cells will be regenerated.void Invalidate ( WorldBoundBox bounds ) #
Invalidates all grass cells within the area specified by the given bounding box. All invalidated cells will be regenerated.Arguments
- WorldBoundBox bounds - Bounding box, defining the area, where grass cells will be regenerated.
Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)