Programming
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_base

A grass_base material is used to create realistic animated grass, plants and flowers. It is applied to ObjectGrass.

Prior Knowledge
This article assumes you have prior knowledge of the following topics. Please read them before proceeding:

States

States

Materials editor, States tab.

Options

Auxiliary Pass

Auxiliary pass is used for writing an additional texture into an auxiliary color buffer. Detail information on the pass can be found in the Rendering Sequence article.

Notice
Enabling this option activates an additional Auxiliary texture and Auxiliary parameters.

Shape

Shape specifies the way to render the grass geometry:

  • Default - grass quads are rendered as a plain geometry and are turned randomly.
  • Billboard - grass quads are rendered as billboards and always face the camera.
Default shape
Billboard shape

Animation

Animation option enables animation for objects (e.g. for plants swinging in the wind). Available modes:

  • Disabled - animation is disabled.
  • Default - standard animation is enabled.

    Standard animation
  • Field - standard animation is enabled. Besides, objects are also influenced by FieldAnimation.
    FieldAnimation with visualizer disabled
    FieldAnimation with visualizer enabled
Notice
Enabling this option activates additional Animation parameters.

FieldSpacer Interaction

FieldSpacer interaction option enables interaction with FieldSpacer objects.

Interaction with FieldSpacer disabled
Interaction with FieldSpacer enabled

Color Noise

Color noise activates a spatial color noise texture, so the grass field is colored differently according to it. The noise can add irregularity to the color of the grass field or it can color the grass.

Color noise disabled
Color noise enabled

Notice
Enabling this option activates the additional Spatial noise texture and Noise parameters.

Light Map

Light map activates an additional light map texture therefore specifying that the material will be rendered lit by it. Color is multiplied by the light map and the ambient color.

Notice
Enabling this option activates the additional Lightmap texture and Lightmap Scale parameters.

Ambient Occlusion

Ambient Occlusion enables the ambient occlusion that sets shading arising from the ground to the top of the grass blade.

Ambient Occlusion disabled
Ambient Occlusion enabled
Notice
Enabling this option activates the additional Occlusion scale parameter.

Emission

Emission activates an additional emission texture. It is used to simulates glow from extremely bright surfaces, therefore imitating real light sources and highlights.

Textures

Textures

Materials Editor, Textures tab.

Base Textures

Diffuse Texture

Diffuse texture defines the grass shape and color. It is subdivided into chunks that are placed on the texture as follows:

  • The horizontal row can have up to 4 chunks.
  • The vertical column can have any number of chunks. The chunks in the column represent the variations of the grass of the particular species (thinner, thicker, tangled, etc.). The chunks of the column are randomly spread across the area.

The texture is 4-channeled (RGBA):

  • The RGB values store grass color information.
  • The alpha (A) stores transparency information and defines which parts of the grass chunks will be rendered colored and which ones will be cut by means of the alpha test.

Notice
The chunks of the diffuse texture can be rendered according to a mask texture. In this case, each chunk of the horizontal row will correspond to the red, green, blue and alpha channels of the mask (see details).

Options Textures

Noise Texture

Noise texture is used to color the grass (for example, to match the colors of the terrain) or to add irregularity to the color of the grass field. In both cases, the colors of the grass diffuse texture and the spatial noise texture are blended in the overlay mode.

The texture is 3-channeled (RGB).

Noise texture used to add color irregularity
Noise texture used to color the grass

For example, if you apply these textures to the following grass field and set the Noise Scale to 0.6, you will get the following result:

The original grass field

The texture that is used to color the grass is usually generated based on the terrain's albedo texture colors. The texture and the terrain size may differ, but the spatial noise texture should meet the following requirements:

  • Dimensions of the texture should be equal to some power of two (for example, 1024 ×  1024 , 2048 ×  2048 and so on).
  • Dimensions of the texture should be proportional to the terrain size. For example, if you have the 4096 ×  4096 terrain, the texture should not be256 ×  512 .
  • Dimensions of the texture should be chosen so that to get the result of appropriate quality after mapping pixels to the terrain. For example, if you have the 4096 ×  4096 terrain and the1024 ×  1024 texture, 1 pixel of this texture will be mapped to cover 4 units of the terrain. If such quality is enough, you can use this texture. Otherwise, you should create a new one of an appropriate size.

Notice
The texture is present only if Color noise is enabled.

Lightmap Texture

Lightmap texture stores pre-computed light information.

Notice
This texture is present only if Light Map is enabled.

Auxiliary Texture

Auxiliary texture is used for auxiliary rendering pass.

Emission Texture

Emission texture stores information about the light emission. It is blended additively over a texture, so areas which do not glow at all should be pure black on the glow mask, and any brighter colors will appear to be emitting light.

The texture is 4-channeled (RGBA):

  • The RGB values store information on a glowing color.
  • The alpha (A) value stores a glow mask:
    • White color indicates that the area is glowing.
    • Black color indicates that the area is not glowing.

Notice
The texture is present only if Emission is enabled.

Parameters

Notice
Availability of some parameters depends on the set States field values.

All the parameters have default values, which can be replaced by your own ones.

Material Mask

Material mask parameter specifies a decal bit-mask. If the material mask of the decal material matches the material mask of the surface material, the decal will be projected.

Base Shading Parameters

Diffuse Color

Diffuse texture color is the base color of the grass surface.

Specular Color

Specular is a color picker to choose the auxiliary specular color. It can be used for specifying different specular colors for one texture or modifying the texture color on the spot.

Gloss

Gloss is a coefficient modifying the size of the highlight. Low values imitate wider highlights, typically appropriate to create diffuse reflection from mat surfaces. High values imitate pinpoint highlights, typically appropriate to create uniform reflection of light rays from glossy surfaces.

Microfiber

Microfiber is a coefficient to scale the intensity of the microfiber effect. This parameter creates an effect of the napped surface. The higher the value, the higher the microfiber effect is.

Translucent

A coefficient to scale the translucent effect, which permits light to pass through the grass blades, but diffuses it so objects behind the grass blades are not visible. The higher the value, the more translucent the material is.

Alpha Intensity

A coefficient to scale the value of the alpha channel of the grass diffuse texture. The higher the value, the bigger areas of the texture are rendered.

Slope

A coefficient to scale the inclination of grass polygons.

  • By the minimum value of 0, inclination of the grass polygons coincides direction of the normal of the polygon on which the grass grows.
  • When increasing the parameter value, the inclination of the grass polygons relative to the camera increases.
Changing value from 0 to 0.6 and conversely

Animation Parameters

Stem Noise

Stem noise is a coefficient to scale a spatial noise that diversifies the direction of movement of the grass.

  • 0 makes the grass move uniformly.
  • Increasing the value makes the grass blades movement more random.

Stem Offset

Stem offset is a coefficient to scale an amplitude of horizontal movement of the grass.

Stem Radius

Stem radius is a coefficient to scale an amplitude of vertical movement of the grass.

Stem Scale

Stem scale is a coefficient to scale the speed of grass movement.

Noise

Transform

Spatial noise texture coordinates transformation parameter is a vector of 4 float components, consisting of two pairs of vector elements:

  • Scale of texture coordinates along the X and Y axes. For example, by the values 1;1 the texture will cover the whole area with the grass. And by the values 2;2 the texture will be repeated four times on the surface.
  • An offset of the texture respectively to its initial position along X and Y axes. For example, by the offset of 0.5 along the X axis the texture will be repositioned to the right (so the left edge of the texture will be rendered in the center).

Scale

Scale is a coefficient to scale intensity of the spatial noise texture.

Emission

Color

Color is a color multiplier for the emission texture.

Intensity

Intensity is a coefficient to scale intensity of the emission texture. The higher the value, the lighter and brighter light areas of the emission texture are.

Lightmap

Intensity

Intensity is a coefficient to scale the intensity of the light map illumination. The higher the value, the brighter the illumination is.

Gamma

Gamma parameter specifies the gamma of the light map texture.

Ambient Occlusion

Visibility

Visibility parameter specifies how the AO has influence on grass.

Multiplier

Multiplier is a coefficient to scale the occlusion that sets shading starting from the ground to the top of the grass blades. The higher the value, the less shaded the grass is.

Power

Power parameter sets the rate of ambient occlusion appearance on the grass.

On Diffuse

On Diffuse shows how ambient occlusion affects the grass diffuse texture.

Auxiliary

Color

Color is a constant color for the auxiliary rendering pass.

Last update: 2017-12-21