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.

mesh_leaf_base

A mesh_leaf_base material is used to create realistic leaves. Can be applied to static meshes and dynamic meshes. Animation for leaves is supported.

mesh_leaf_base

See also

Billboards Leaves Requirements

For billboard leaves, the second UV channel of the exported model should contain information about the size and orientation of leaf billboards.

If leaves are animated, the anchor to rotate billboards is:

  • In 3ds Max, the top left corner of the UVW zero-to-one square (at [1,0] coordinates)
  • In Maya, the lower left corner ( at [0,0] coordinates)

The 2nd UV channel (in Resource Editor)

Materials are modified via Materials Editor.

States

In the States tab you can set rendering passes and available options. Enabling some of the states activates additional textures and parameters in the Textures and Parameters tabs respectively.

The states divide into 2 groups: Passes and Options.

Possible values for all the passes:

GUI name XML name Description
Skip none Material is not rendered during the pass.
Default default Material is rendered during the pass.

Possible values for a Leaves option:

GUI name XML name Description
None none Leaves are not rendered.
Geometry geometry Leaves are rendered as a standard polygons.
Billboard billboard Leaves are rendered as billboards that always face the camera.

All the other options can be either enabled or disabled by ticking the respective boxes.

All the states can be set to default ones - click a Set to parent button near the state (if the state is different from the default one, its field will be highlighted with green).

The states available for this kind of materials are listed below.

Passes

Passes specify during which rendering pass the material should be rendered. They are modified in the Passes field of the States tab.

GUI name XML name Description
Deferred deferred Deferred rendering pass. Specifies if the material should be rendered during the deferred pass. For the transparent surfaces see also a Post deferred option.
Auxiliary auxiliary Auxiliary rendering pass. Specifies if the material should be rendered into the auxiliary buffer to create a custom post-process.
Ambient ambient Ambient rendering pass. Specifies, how the material should be rendered during the Ambient light pass for the opaque objects. The actual opacity or transparency of the material depends solely on the set blending options.
Light omni light_omni Omni-directional lights rendering pass. Specifies, if the material should be rendered illuminated by the Omni light sources during the light and shadows rendering passes.
Light proj light_proj Projected lights rendering pass. Specifies, if the material should be rendered illuminated by the Projected light sources during the light and shadows rendering passes.
Light world light_world World lights rendering pass. Specifies, if the material should be rendered illuminated by the World light sources during the light and shadows rendering passes.

Options

The following options are set in the Options field of the States tab.

GUI name XML name Description
Leaves leafs Specifies the way to render the leaves geometry.
Angle fade angle_fade Used only for polygon-based leaves (with the set Geometry type).

Fades leaves by their alpha channel when the polygon is viewed from the side. When viewed from the front, it is rendered in its full color.

Without Angle fade With Angle fade enabled
Disabled Angle fade
Enabled Angle fade
Animation animation Enables leaves animation. The available values are:
Phong shading phong Specifies if additional normal and specular maps for the leaves lighting will be added. If disabled, the whole leaf polygon will be lit uniformly.
Color noise noise Specifies if additional spatial noise and color gradient textures will be added. These textures add a random color variation to leaves.
Without Color noise With Color noise
Disabled Color noise
Enabled Color noise
Shadow shafts volumetric Specifies if volumetric shadows from world lights will be rendered from surfaces with the applied material.
Without Shadow shafts With Shadow shafts
Disabled Shadow shafts
Enabled Shadow shafts
Ambient light ambient_light Optimizes leaves rendering. When enabled, leaves are rendered only once - during the ambient rendering pass, and are not redrawn one more time for a world light pass (it is automatically skipped in this case).

This option allows to get rid of leaf flickering caused by the limited depth buffer precision in the distance.
Notice
It is not possible to use two or more world light sources to light leaves if this option is enabled. This limitation does not apply to other types of light sources.

Textures

In the Textures tab of the Materials Editor you can:

  • Load the textures - click a Load button near the texture and specify the path to the texture or type the path in the texture field manually
  • Open the view window to see texture's details - click a View button near the texture
  • Set the current texture to default one - click a Set to parent button near the texture (if the texture is different from the default one, its field will be highlighted with green)

The textures available for this kind of materials are listed below.

Base Textures

Base textures are loaded and modified in the Base field of the Textures tab. Normal and specular textures are present only if Phong Shading option in the States tab is enabled.

GUI name XML name Description Channels
Diffuse diffuse Diffuse map. A texture to define a surface's main color.
Diffuse colors Alpha values
Diffuse colors
Alpha values
RGBA:
  • RGB values store a color of the texture
  • An alpha (A) value contains either transparency values or a detail mask
Notice
An alpha (A) value will store transparency values if an Alpha test option is enabled. Otherwise it will store a detail mask.
Thickness thickness A texture to darken leaves and make the foliage look more thick. It is visible only against the light and allows to create leaf vein patterns.

Thickness value is subtracted from translucency.
R: The higher the color value, the darker the leaves are (the thicker the foliage).
Normal normal Normal map. A texture to store information about a surface's normals deviation.

2-channel normal map
Use only 2-channel normal map
RG:
  • RG values contain two components of a normal
  • The third component's value is calculated from the given components in run-time
Specular specular Specular map. A texture to define a surface's shininess and highlight color.

Specular map
Specular map
RGBA:
  • RGB values store reflection color and intensity (black color means no reflection)
  • An alpha (A) value specifies the specular power: 0 means specular highlights are very bright and intense, 256 - specular highlights are dull

Additional Textures

Additional textures are present only if an Color noise option is enabled and are modified in the Additional field of the Textures tab.

GUI name XML name Description Channels
Spatial noise noise A 3D noise texture to randomize the coloring of leaves according to the gradient color texture.

Color noise texture
3D color noise texture (rotated and cut)
R.
Color gradient color A gradient texture that modulates leaves colors (for example, from bright green to yellow).

Color gradient
Color gradient
RGB.

0.5 means the texture does not affect leaf color.

Higher values lighten the colors (are added).

Lower values darken the colors (are subtracted).
Notice
The above textures with the _d (diffuse map), _n (normal map) and _s (specular map) postfixes in the name respectively, located in a folder named uncompressed, will be automatically compressed by the engine.

Parameters

In the Parameters tab you can set or modify base and additional parameters.

Parameters of different types are set in different ways:

  • expression - vector values can be set either in the field near the parameter or in the dialog window opened when double clicking this field
  • slider - the value can be set either by smoothly moving the slider of the scroll box or manually in the box near the parameter (if required, the value bigger than maximum one for the slider can be set)
  • color - the color can be chosen in the dialog window, activated after double clicking the color field

All the parameters can be set to default ones - click a Set to parent button near the parameter (if the parameter is different from the default one, its field will be highlighted with green).

The parameters available for this kind of materials are listed below.

Transform Parameters

Texture transformation parameters are modified in the Transform field of the Parameters tab. Detail materials transformation parameters are present only if the Detail option is enabled.

GUI name XML name Type Description
Base base_transform expression Base texture native coordinates transformation. A vector of the four float components, consisting of two pairs of vector elements:
  1. Scale texture coordinates, along X and Y axes.

    For example, by the scale of 2;2 the texture will be repeated four times on the surface.

  2. An offset of the texture respectively to its initial position along X and Y axes.

    For example, by the offset of 0.5 along X axis the texture will be repositioned to the right (so the left edge of the texture will be rendered in the center).

Notice
Besides the native texture coordinates transformation, there are more options of setting texture coordinates. They are described in the Texture coordinates transformation article.

Animation Parameters

Animation parameters are present only if an Animation state is enabled. Leaf noise, Leaf offset and Leaf scale parameters are present only if leaves are rendered as billboards. The parameters are modified in the Animation field of the Parameters tab.

GUI name XML name Type Description
Stem noise animation_stem_noise slider A coefficient to scale a spatial noise that diversifies the direction of movement of the vegetation stems.
Notice
Should be the same as in the mesh_stem_base material.
Stem offset animation_stem_offset slider A coefficient to scale an amplitude of horizontal movement for the vegetation stems.
Notice
Should be the same as in the mesh_stem_base material.
Stem radius animation_stem_radius slider A coefficient to scale an amplitude of vertical movement for the vegetation stems.
Notice
Should be the same as in the mesh_stem_base material.
Stem scale animation_stem_scale slider A coefficient to scale the speed of vegetation stems movement.
Notice
Should be the same as in the mesh_stem_base material.
Leaf noise animation_leaf_noise slider A coefficient to randomize the orientation and direction of rotation for leaves (seen only on several nodes with the same material).

By the minimum value of 0, all leaves are synchronized in their movement.

By higher values leaves randomly move in different directions.
Leaf offset animation_leaf_offset slider A coefficient to scale leaves rotation amplitude.

By the minimum value of 0, leaves do not move at all.

By higher values leaves move with greater amplitude.
Leaf scale animation_leaf_scale slider A coefficient to scale the speed of leaves rotation.

By the minimum value of 0, leaves do not move at all.

By higher values leaves move with faster.

Field Animation Parameters

This parameter is present only if the Field value is set for the Animation option on the States tab.

GUI name XML name Type Description
Field field_mask slider A field mask that specifies an area of the animation field to be applied to leaves. This mask must match the field mask of the animation field.

Auxiliary Parameters

Auxiliary color parameter is present only if an Auxiliary pass is set as a Default. The parameter is modified in the Auxiliary field of the Parameters tab.

GUI name XML name Type Description
Stem radius animation_stem_radius slider A coefficient to scale an amplitude of vertical movement for the vegetation stems.
Notice
Should be the same as in the mesh_stem_base material.
Auxiliary auxiliary_color color A color picker to choose an auxiliary color for the Auxiliary rendering pass.
Stem scale animation_stem_scale slider A coefficient to scale the speed of vegetation stems movement.
Notice
Should be the same as in the mesh_stem_base material.

Base Parameters

Shadow base parameter is present only if leaves are rendered as billboards. Angle base parameter is present only if Angle fade option in the States tab is enabled.The parameters are modified in the Base field of the Parameters tab.

GUI name XML name Type Description
Shadow shadow_offset slider A coefficient to determine how much billboard leaves are shadowed. Shadow offset adjusts the distance from a leaf to the light.

Negative values decrease the distance to the light, making leaves less shadowed.

By the value of 0, there is no adjustment at all.

Positive values increase the distance from the light, making the leaves more shadowed.
More shadowed Less shadowed
Shadow = 0.3
Shadow = -0.4
Angle angle_power slider A coefficient to scale the fade angle.

Ambient Parameters

Ambient parameter is modified in the Ambient field of the Parameters tab.

GUI name XML name Type Description
Environment environment_scale slider Environment lighting scale. A coefficient to scale how much the global environment texture illuminates the surface.

The higher the value, the more the colors will be corrected (lightened or darkened) according to the environment component.

Shading Parameters

Shading parameters are modified in the Shading field of the Parameters tab.

GUI name XML name Type Description
Translucency translucent_scale slider Translucency of the leaves when looking at them against the light (independent from the alpha channel):
  • By the minimum value of 0, the leaves are opaque, so their back sides are completely shadowed
  • By the maximum value of 1, the leaves are transparent, so the light goes through them illuminating the back sides as well
Thickness thickness_scale slider The visibility of thickness texture when looking at leaves against the light, thus modulating the thickness of the foliage:
  • By the minimum value of 0, the thickness texture is not visible and the leaves appear to be more transparent
  • By the maximum value of 1, he thickness texture is completely visible and the leaves are shadowed according to it
Diffuse diffuse_color color

A color picker to choose the color of the diffuse map.

Diffuse diffuse_scale slider A coefficient to scale the brightness of the diffuse map.

The higher the value, the brighter the diffuse map is.
Specular specular_color color

A color picker to choose the color of the specular map.

Specular specular_scale slider A coefficient to scale the brightness of the specular map reflections.

The default value of 1 grants the correct color. The higher the value, the brighter the specular reflections are.
Glossiness specular_power slider

A coefficient to modify size of the highlight (Phong lighting) of the specular map:

  • Low values imitate wider highlights, typically appropriate to create diffuse reflection from the mat surface
  • High values imitate pinpoint highlights, typically appropriate to create uniform reflection of light rays from the glossy surface
Low Glossiness High Glossiness
Glossiness = 4
Glossiness = 20

Noise Parameters

Noise parameters are present only if Color noise option is enabled in the States tab and are modified in the Noise field of the Parameters tab.

GUI name XML name Type Description
Transform noise_transform expression Noise textures native coordinates transformation along X, Y and Z axes. A vector of the three float components:
  • By high values, color blobs are small in size (for example, several blobs per leaf). Tiles of the spatial noise texture are small and repeat often
  • By low values, color blobs are big (for example, several blobs for the whole tree). Tiles of the spatial noise texture are big and repeat a few times
Smaller tiles Larger tiles
Transform = vec3(0.1)
Transform = vec3(0.01)
Scale noise_scale expression Noise textures native coordinates transformation along X, Y and Z axes. A vector of the three float components:
  • By the minimum value of 0, the color noise does not influence the grass color
  • By the maximum value of 1, the color noise is fully visible
Last update: 03.07.2017
Build: ()