This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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.

Passes

Auxiliary pass

All lights influencing opaque objects are computed by means of deferred shading (and a forward shading for transparent objects only). The only rendering pass that can come separately from deferred is Auxiliary that is used for writing the contour of object with the specified material into an auxiliary color buffer. Detail information on the pass can be found here.

To enable the pass, check the Auxiliary option in the Passes field of the States tab.

Options

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.

Spacer interaction

Spacer interaction enables interaction with FieldSpacer.

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 the 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 the Lightmap Scale parameters.

Occlusion

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

Occlusion disabled
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).

Auxiliary Texture

Auxiliary texture is used for auxiliary rendering pass.

Additional Textures

Spatial Noise Texture

Spatial 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).

Spatial noise texture used to add color irregularity
Spatial 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 diffuse 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 be 256 × 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 the 1024 × 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.

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.

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.

Shading Parameters

Diffuse Color

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

Fibers

Fibers is a coefficient to scale the intensity of the fiber. This parameter creates an effect of the napped surface. The higher the value, the higher the fiber 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.

Decal Mask

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

Base

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

Alpha

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.

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.

Scale

Scale 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.

Auxiliary

Color

Color is a constant color for the auxiliary rendering pass.

Lightmap

Scale

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

Options

Occlusion

Occlusion scale 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.

Last update: 2017-07-03
Build: ()