shown in other instead.
Mesh Clutter is an object that can contain a great number of identical meshes which are positioned, oriented and scaled randomly and cannot be managed manually. Meshes of the mesh clutter object can be scattered in the certain areas by using an image or mesh mask.
The clutter mesh object is usually used for vegetation (for example, forest, leaves on the ground), for strewing identical objects (for example, rubbish).
Mesh Clutter is used to scatter identical meshes across the world (or the part of the world) or terrain. Mesh Clutter scatters objects procedurally, and renders only those object which are in the viewing frustum. This allows to render the large number of meshes while keeping performance high.
- An ObjectMeshClutter class to edit clutters via UnigineScript
- A set of samples located in the data/samples/objects/ directory:
Creating Mesh Clutter
To create Mesh Clutter, simply perform the following steps:
On the Menu bar, click Create -> Object -> Mesh Clutter.
- In the dialog window that opens, choose the path to the .mesh file. This mesh would be used as the source one for the clutter.
- Place the clutter object somewhere in the world.
- Specify the Mesh Clutter parameters.
Mesh Clutter Parameters
The Mesh Clutter is very much the same as World Clutter (that operates on different node references). It is rendered as a 2D grid, in each cell of which a number of meshes 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.
|Mesh||Mesh, the copies of which will be scattered.|
|The size of the clutter bounding box along X and Y axis. Within this area objects will be scattered with specified density.
|Step for cells||Cell size in units. The resulting number of cells in the Clutter is defined in the following way: size of the Clutter (both along X and Y) is divided by the step.
|Density||Density specifies how many objects there are per square unit.
|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.
|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 meshes abruptly disappear. Instead, a few left smoothly blend into the background without any visual noise.
|Radius||The distance to draw objects outside the view frustum. This option allows eliminating popping of shadows at the edges of the screen when the camera is turning.
|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 meshes scattered by Mesh 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:
|Scale||This parameter allows to randomly scale all scattered objects making some bigger and some smaller.
|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.
Rotation Y Rotation Z
|These parameters allow to randomly orient the scattered objects.
Masking Areas with Objects
Besides scattering the meshes evenly across the whole area, a mask for their positioning can be used. It controls where the meshes should be placed.
|Image Mask||Mask determines 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 stones across the rocky areas, while leaving the grassy ones free from rocks.
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.
|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.
Mesh used as a mask
|Inverse||The Inverse flag toggles if the objects are placed inside or outside the mesh contour.
Orienting along the Relief
Mesh Clutter can also scatter objects along the relief. For that, an underlying surface should me made a parent of the Mesh Clutter node. (If there are some nodes in the hierarchy between a terrain or mesh node and Mesh 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.
|Intersection||After the Intersection box is checked, objects will be scattered across the surface of the parent object.
|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.
|Angle||Just like in the case with grass, the scattering can take into account how steep the slope is.