UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

grass_base

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

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 separetely 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 as Default 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:

  • Skip - animation is disabled.
  • Default - standard animation is enabled.
  • Field - standard animation is enabled. Besides, objects are also influenced by the Field Animation node.
Notice
Enabling this option activates additional Animation parameters.

Spacer interaction

Spacer interaction enables interaction with the Field Spacer node.

Color noise

Color noise activates a spatial color noise texture, so the objects will be colored differently according to it.

Color noise disabled.
Color noise enabled.

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

Shadow Shafts

Shadow shafts simulates visible volumetric shadows, arising when a bright world light source is partially obscured by grass.

Occlusion

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

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

Diffuse

Diffuse texture defines the grass shape and color. The texture should contain:

  • 4 grass slots in a row.
  • N number of rows (specified in Num textures field).

Basically, 4 columns represent different types of grass. Each column contains N variants of the same grass (thiner, thicker, tangled etc.) These four columns are masked separately.

Samples of grass diffuse textures

The texture is 4-channeled:

  1. RGB values store grass color information.
  2. An alpha (A) value stores transparency values and specifies how the grass will fade at the distance.

Auxiliary

Auxiliary texture is used to render it in auxiliary buffer.

Additional

Spatial Noise

Spatial noise texture is used to color the grass that has the gray diffuse texture or to add irregularity to the grass that has the colored diffuse texture.

It will cover the whole terrain and allows you to color grass differently in all locations.

This texture is generated based on the terrain's diffuse texture colors.

Notice
The texture does not have the same size as the terrain, but 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.

Lightmap

Lightmap - light map texture storing pre-computed light information.

Emission

Emission - emission map texture. Emission map 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 map, and any brighter colors will appear to be emitting light.

Parameters

Parameters available for the material. All of the parameters have set default values, which can be replaced by your own ones. Availability of some parameters depends on the set States field values.

Material Editor, Parameters tab.

Animation Parameters

Animation parameters:

Shading Parameters

Diffuse

Diffuse texture color. A color picker to choose the color of the diffuse map. Diffuse defines the base color of the surface.

Fibers

Fibers parameter creates an effect of napped surface. Fibers is a coefficient to scale the intensity of the fiber. The higher the value, the higher the fiber effect is.

Translucent

A coefficient to scale a translucency level of the material. The higher the value, the more translucent the material is. Back is a scale of the translucency effect, which permits light to pass through the object, but diffuses it so objects on the opposite side are not clearly visible.

Decal Mask

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

Base

Base material parameters:

  • Slope - inclination of grass blades.
  • Alpha - grass alpha channel scale.
Notice
Slope parameter is available only if the Shape option is set as a Default or Billboard.

Slope

A coefficient to scale the inclination of grass blades. By the neutral value of 0.5 the blades are not inclined at all and oriented upwards. Modifying the value leads to changing of the grass angle of inclination.

Slope value = 0
Slope value = 10

Alpha

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

Alpha value = 0.1
Alpha value = 1.0

Noise

  • Transform - spatial noise texture coordinates transformation.
  • Scale - spatial noise texture color transformation.

Emission

  • Color - emission color picker to choose a color multiplier for the emission texture.
  • Scale - a coefficient to scale emission texture intensity. The higher the value, the lighter and brighter light areas of the emission texture are.

Auxiliary

Auxiliary rendering pass parameters:

  • Color - auxiliary rendering pass constant color.
Notice
Auxiliary parameters are present only if Auxiliary rendering pass is enabled.

Lightmap

  • Scale - lightmap texture scale.

Occlusion scale

Occlusion scale parameter specifies scale of the occlusion.

Last update: 2017-07-03