UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Программирование
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
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
CIGI Client Plugin
Rendering-Related Classes

Grass Settings

The article describes all settings located on the Grass tab of the Parameters window. This tab becomes available when the grass node is selected.

Adding Grass#

To add grass to the world, perform the following:

  1. On the Menu bar, click Create -> Grass -> Base.

  2. Place the grass object somewhere in the world.

  3. Set the required grass parameters described below.

Notice
See also the tutorial on Adding Grass for more detailed explanation of grass adding and setting its parameters.

Grass Parameters#

Num textures Sets how many grass clusters (or plants, or flowers) are lined up horizontally in the diffuse texture. Learn more about this parameter here.
Notice
This value cannot exceed 4.
Size X Specifies the length of the grass area along the X axis.
Size Y Specifies the length of the grass area along the Y axis.
Step Sets the size of the cells into which the grass field is split.
  • The higher the step value, the bigger the cells the field is split into. But there exists a limit how many grass quads can be planted in each cell. So after reaching this limit, the number of grass quads can no longer be increased, though the Density parameter specifies it.
  • The smaller the step is, the smaller the cells the field is split into. While the density value stays unchangeable (for each separate cell), the whole field becomes planted with grass much more densely.
To learn more about the parameter, read the Step for Cell Division chapter of the Grass article.
Subdivision Subdivides each cell into the specified number of parts. This is usually required when the grass is used as a low-poly distant LOD of a forest created by using World Clutter or a ObjectMeshClutter with smaller cell size: the Subdivision parameter subdivides large grass cells so that they match the smaller clutter ones. This way, positions of randomly scattered objects will coincide with those of grass-based impostors. The range of available values is from 1 to 32.
Density Determines how many grass quads are to be rendered per square unit taking into account the step of division and the number of cells.

Randomizing Grass#

To randomize appearance of grass quads, two types of values are used:

  • Mean value (i.e.Aspect, Minimum/Maximum Height, Offset) defines the average value. With its help the designer can set setting milestones to control the parameter.
  • Spread value defines the range for possible variation of the parameter. The higher the value, the more diverse the final result will be.
    Spread value is optional: if set to 0, it will not influence the simulation process and only the mean value will be uniformly used.

After these values are specified, the following formula is used to calculate the final result for the parameter:

Result = Mean + Random * Spread
where Random is a random value in range from -1 to 1. This means, for each of the grass quad on the field the parameter will differ to the desired extent (see example with height below).

Spread value is optional: if set to 0, it will not influence the simulation process and only the mean value will be used for all objects.

Variation On the randomly chosen quads, flips the diffuse texture horizontally, automatically giving two variants available for rendering of varied blades.
Min height Determines the mean value for the minimum height of the grass blades quad that is rendered in areas with low density according to the image mask. The higher the Min height value, the higher the grass will be in areas with low density.
Min height = 1; Spread = 0.3
Min height = 1.2; Spread = 1
Max height Determines the mean value for the maximum height of the grass blades quad that is rendered in areas with high density according to the image mask. The higher the Max height value, the higher the grass will be in areas with high density.
Min height = 1; Spread = 0.3; Max height = 3; Spread = 0.3
Min height = 1.2; Spread = 1; Max height = 3; Spread = 1
Aspect Sets an aspect to calculate the width of a grass quad:

Width = Max height * Aspect
Aspect is set for each of the diffuse texture columns separately and can be randomly varied if spread value is set in addition to mean one.
Offset Specifies the offset in units up the surface normal, thus accurately repeating its relief. It is set by mean value (only positive) and additional spread value (positive or negative), if variation is required.
Rotation It might be necessary to add more diversity via random rotation of grass quads. This parameter specifies the rotation of grass quads in degrees. It is set by mean value (only positive) and additional spread value (positive or negative), if variation is required. Values are set for each of the diffuse texture columns separately.
Probability Sets the grass rendering probability per diffuse texture column.
Seed Sets an integer value used to generate pseudo-random successions of numbers. The parameter is used to randomly position grass blades quads across an area by an image mask.
Notice
The same Seed value will always generate the same successions of numbers.
To get a random seed value, press the Randomize button.

Masking Grass Areas#

Mask image Mask that determines the density distribution of the grass.
  • The mask is a 4-channel (RGBA8) texture:
    • Red channel specifies the areas of growth for the 1st texture column. If there are several grass clusters in a vertical column, they will be randomly spread across the masked area.
    • Green - for the 2nd texture column.
    • Blue - for the 3rd texture column.
    • Alpha - for the 4th texture column.
    Notice
    In case R8, RG8 or RGB8 texture is used as a mask, the diffuse texture must have only one, two, or three columns. So, if your diffuse texture contains, for example, only 1 vertical column, the R8 texture should be used.
  • Zero channel values specify areas where the grass should not grow
  • Non-zero channel values create a grassy area: the higher the value, the denser the grass grows.
Threshold Controls starting from what density (according to the mask), the grass should grow. This means, that if in some particular place the threshold value is higher than the color or alpha value of the mask, it is rendered grassless.
  • With the minimum value of 0, the grass is planted on the whole area, that is specified as available by the mask.
  • With higher threshold value, the grass will grow only in the areas marked by the mask as dense. The areas of sparse distribution stay bare.
  • With the maximum value of 1, there will be no grass at all.
Min value Image mask minimum value of the color density range. Read more here.
Max value Image mask maximum value of the color density range. Read more here.
Flip X Flips an image mask horizontally.
Flip Y Flips an image mask vertically. For example:
Grass Growing According to Original Image Mask
Grass Growing According to Image Mask Flipped Vertically

After flipping the image mask by the Y axis, the grass has started growing on the stony area. Density and color of grass growing on the presented area have also changed.

Mesh mask Mesh-based mask that is used to specify areas where grass can grow. A mesh for masking should be a simple planar mesh.

Mesh used as a mask
Inverse Toggles the value that indicates if grass grows inside or outside the mesh contour.
Field mask
  • If used together with a Field Spacer object, the field mask specifies areas of the grass field that should not be rendered.
  • If used together with a Field Animation object, the field mask specifies areas of the grass field that should be animated.
Notice
The field mask set for the grass object must match the field mask of a Field node applied to the grass object.
Cutout Intersection Cutout bit mask. This mask is used 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 masks matching this one (one bit at least).
Cutout Inverse Toggles the value that indicates whether the grass should be rendered inside or outside the areas determined by the cutout intersection mask.

Orienting Along the Relief#

Intersection Flag indicating whether grass should follow the relief.
Orientation Flag indicating whether grass polygons are oriented along the normal of its parent node (for example, terrain).
Grass Polygons Oriented Along Normal of Grass Object
Grass Polygons Oriented Along Normal of Terrain

Read more here.

Angle Sets the ground slope angle.
  • By the minimum value of 0, grass will grow everywhere on the ground.
  • The bigger the value is, the flatter the place should be for grass to grow. So, as the value is increased, steep slopes turn out to be bare at first, and then low-sloped places also become grassless.
  • By the maximum value of 1, grass will grow only on the strictly horizontal ground.

Optimizing Grass#

Thinning Flag indicating whether grass is thinned out with a distance.
  • If the flag is set, random grass polygons are not rendered across the grass Fade distance.
  • If the flag is not set, all grass polygons are rendered between the grass Visibility distance and the Fade distance.
Spawn Sets the number of cells rendered each frame. The higher the spawn rate, the more likely a performance spike will occur.
Triangles Counter that shows the total number of grass polygons. The shown values can be, for example, compared after changing some parameters in order to improve performance.
Last update: 27.12.2018