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

World Clutter

World Clutter node allows to scatter a set of identical nodes (node references) randomly across the scene practically in one click. There is need any longer to position, scale and rotate every single object by hand and constantly mind the performance factor. World Clutter automatically places nodes in the scene with random parameters, all of which can be efficiently controlled, and renders them only around the camera. WorldClutter object is used to scatter non-geometry objects, such as decals, particles systems and so on. But if you want to scatter identical meshes, it is better to use Mesh Clutter.

Unlike a World Cluster, a World Clutter scatters objects procedurally and therefore even more memory-efficient. At the same time it means that scattered objects cannot be moved.

Notice
World Clutter is used only with reference nodes, because when the world is loaded they are scattered around the camera much faster.

Scattered wood chips in the Port Angeles demo by using a World Clutter.

See also

  • A WorldClutter class to edit world clutters via UnigineScript

Clutter Objects

Objects in one Clutter are node references that will be scattered throughout a definite area and for each of which the probability of its appearing is controlled.

Node references that are contained in the clutter

List of node references in the World Clutter

Probability slider The higher the probability, the more often is it can be seen if compared to other Clutter object. Let's say we create a coast with wood chips and algae. We create wood chips decal and algae decal and save them as *.node files (create a NodeReference file). If the probability slider for algae is near to zero, the coast will be thick with wood chips and only several algae will be seen among them. Changing appearing probability does not influence the number of rendered objects, it only specifies the proportion between several clutter objects.
  • If probability is set to zero, the object will not be rendered at all.
  • If there is only one object in the Clutter, the probability parameter (except when it equals zero) is ignored and the object occurrence will depend solely on the density.
Add Add a reference node to the list of Clutter objects.
Remove Delete all selected node references from the list. To select an object, a box near it should be checked.
Reload Reload all the node references in the Clutter. After a node reference was edited, the saved changes will not be automatically applied to the same nodes scattered by the Clutter. It happens because reference node after being loaded once are copied from the internal cache, which allows to create a lot of copies really fast. Reload option updates this cache and changes in objects parameters come in effect.

World Clutter Parameters

The World Clutter is rendered as a 2D grid, in each cell of which a number of clutter objects are randomly placed depending on the Clutter density and probability of appearing. The cells are generated one by one starting from the nearest ones. This approach allows to control how close or far the scattered objects are from each other and at the same time reduce the rendering load when the camera moves and farther cells become visible.

Once added and scattered, the objects cannot be moved or rotated. The only way to change the scattering pattern is to change the seed.

Size X
Size Y
The size of the clutter bounding box along X and Y axis. Within this area objects will be scattered with specified density.
  • The size is measured in units.
Step for cells Cell size in units. The number of cells in the Clutter is defined in the following way: size of the Clutter (both alongX and Y) is divided by the step.
  • The higher the number of cells (i.e. the smaller the step), the higher the load. However, to create one large cell takes longer time. When the camera moves fast enough, small cells will be created very slow, but large ones can noticeably pop into sight and cause a small rendering lag.
Density Density specifies how many objects there are per square unit. In case there are more than one object in the Clutter, probability will be taken into account, but will not change the resulting number of all rendered objects.
  • If the density value is too high, objects can be penetrating each other.

Lower Density
Lower Density
Higher Density
Higher Density
Visible distance Within visible distance the number of objects is strictly specified by the density parameters. It means that all objects that should be present are found in place.
  • If set to infinity (inf), Fade distance parameter will be ignored.
  • The real radius of Clutter visibility directly depends on the object (surface) maximum visible distance and also its fade out distance. However, even in case it disappears at closer distance, further increase of the visible distance will carry performance penalty, because cell generation-related calculations are still performed.
  • The visible distance is actually measured up to the cell: when the camera moves on the specified distance form it, the cell is generated. Without the fade distance or object maximum visible distance, objects will be rendered in noticeable squares.
Fade Distance Across the fade distance the number of objects gradually decreases, as they disappear randomly one by one. The fade distance follows the Visible distance. If a fade distance is set, there is no clear line where the objects that are contained in the Clutter abruptly disappear. Instead, a few left smoothly blend into the background without any visual noise.
  • For the best result, it is also recommended to combine this effect with objects fade-out.
Seed The seed value for pseudo random number generator allows to create different patterns of automatic positioning. The seed is either be set manually or an engine provides a random value for a seed (Randomize option).

Randomizing Clutter Objects

To randomize the appearance of objects that compose the World Clutter, two types of values are used:

  • Mean value (i.e.Scale, Offset, Rotation) defines the average value. This is the basic value that will be randomly made higher or lower.
  • 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 used for all objects.

After these values are specified, each parameter is calculated according to the following formula:

  • Result = Mean + Random * Spread
where Random is a random value in range from -1 to 1. For example, if a mean value of the parameter equals 3 and a spread value equals 1, the final result will be any in range from 2 to 4.

Min and Max Scale The scale mean value of scattered objects depends on the minimum and maximum scale mean values and the image mask values: the mask values are used to linearly interpolate between the minimum and maximum scale values.
  • The mean scale value cannot be negative.
Min scale Sets the scale mean value for scattered objects in the areas with low density (according to the image mask). The higher the value, the bigger the object will be in such areas.
Notice
When the image mask is not set, this parameter isn't taken into account as the default mask stores only the maximum mask values (there is no areas with low density).
Max scale Sets the scale mean value for scattered objects in the areas with high density (according to the image mask). The higher the value, the bigger the object will be in such areas.
Offset Height offset parameter controls whether all objects are positioned at one height or some are found higher or lower. For example, with offset stones can be dug deep into the ground so that only a small top is visible, or placed higher and look bigger.
  • The offset is measured in units.
Rotation X
Rotation Y Rotation Z
These parameters allow to randomly orient the scattered objects.
  • The rotation is set in angles.
  • If a spread value is set to 180, objects will be rotated by 360 degrees.

Masking Areas with Objects

Having objects uniformly scattered in all directions and places is naturally not very convenient. Instead of creating a number of small World Clutter nodes that cover a limited location, a big one can be used with a mask.

Image Mask Areas across which the objects are randomly scattered and areas where there will be no objects from the list. For example, on the terrain a mask allows to scatter rubbish across the areas, while leaving the some places free.
Notice
When the image mask is not set, the default mask with maximum mask values will be used. The maximum mask value is 255.
  • The mask is one-channel texture (R8). If there are more channels in the provided mask, they will be ignored.
    • Zero color value specify the areas without Clutter objects.
    • The higher the color value is, the more objects there are in this area and the denser they are positioned.
    • Color value of 255 means the density is as specified in by the corresponding parameter.
  • Masking is done for all objects that are contained in the Clutter list.

World Clutter mask for scattering

Notice
To paint the image mask directly in the scene, use Mask Editor.
Threshold for mask To control the strength of masking, a mask threshold is used. It checks the masked density for an area and if a threshold value is higher than the color value of the mask, objects are scattered across it. If the masked density is not enough, the places is left bare.
  • With the minimum value of 0, the mask is applied as it is.
  • With higher threshold value, the objects will be scattered only in areas marked by the mask as dense. Instead of sparse distribution, objects scattered here and there, they are likely to be rendered in dense isolated groups.
  • With the maximum value of 1, there will be no objects scattered at all.

Minimum Threshold
Threshold = 0
Maximum Threshold
Threshold = 1
Mesh Mask A mesh-based mask can be used to place the objects. Vector masking allows not to depend the mask texture resolution and create roads, rivers, etc. with extremely high precision. A mesh for masking should be a simple planar mesh.
Inverse The Inverse flag toggles if the objects are placed inside or outside the mesh contour.
Min and Max mask values As a solution for advanced objects seeding and memory consumption optimization not only a whole mask, but any required part of it can be applied to the object. It means that different multiple objects can share the same mask, but use different levels.

By default, each channel of the image mask specifies the areas and the density of growth in the [0;255] color density range. However, by using Min value and Max value, you can specify any color density range in this diapason and that part of the mask, which contains the specified density range, will be used to seed the nodes.

For example, there is the following R8 image mask:

Several node objects that represent nodes of different heights can share this mask as follows:

  • In range from 100 to 200 density one type of nodes can be stored.
  • In range from 190 to 255 density another type of nodes can be stored.
Flip X Image Mask horizontal flip.
Flip Y Image Mask vertical flip.

Orienting along the Relief

Unless objects in the World Clutter are scattered over a completely flat and non-tilted surface, they can be automatically positioned to precisely repeat ups and downs of the relief without any effort. For that, an underlying surface should be made a parent of the World Clutter node. (If there are some nodes in the hierarchy between a terrain or mesh node and World Clutter, intersections will still be checked.)

A parent for intersection can only be a terrain or a mesh object. The mesh should be terrain-like, i.e. it should have only one surface vertically, along the Z coordinate.

Notice
World Clutter performs only one vertical intersection testing with parent mesh geometry. If there are surfaces underneath the upper surface, they will be ignored. For example, to scatter reference nodes across the whole sphere, two hemisphere meshes need to be used.

Intersection After the Intersection box is checked, objects in the World Clutter will be scattered across the surface of the parent object.
  • It does not matter if the World Clutter is bigger than the parent object in size - the scattering area will be still be limited to parent object surfaces.
Orientation This option allows to set a parent surface normal vector as the initial orientation for scattered objects. It means, if the surface in some place is vertical, the "up" direction for objects over will be actually pointing to the side.
  • They can be still randomly rotated but relative the orientation of the parent normal.
  • This parameter is enabled only if Intersection option is checked.

Orienation disabled
Orienation disabled
Orienation enabled
Orienation enabled
Angle Just like in the case with grass, the scattering can take into account how steep the slope is.
  • By the minimum value of 0, it makes no difference how flat or how tilted the surface over which the Clutter objects are scattered.
  • The bigger the value is, the flatter the place should be for objects to be scattered over it. As the value increases, at first steep slopes are ignored and then flatter ones become bare.
  • By the maximum value of 1, the objects can be scattered only over perfectly horizontal surface.
  • This parameter is enabled only if Intersection option is checked.
Last update: 2017-10-20