World Cluster is a convenient and performance-friendly method to manage a great number of objects (node references) that are placed in the scene. Whether it is five objects or fifty thousand, World Cluster bakes them and stores in the memory only those objects that are inside a specified range.
It is also a handy tool to automatically scatter randomly sized objects across a definite area. Unlike a World Clutter, a World Cluster objects can be moved and rotated after they were randomly scattered. It means though that as a result Cluster is less memory-efficient, because it stores coordinates transformations for each of the node.
There are two ways to create a World Cluster:
- A WorldCluster class to edit world clusters via UnigineScript
Creating a World Cluster
|Create||To use a World Cluster for managing a number of objects, you will simply need to do the following:
|Expand||If it is necessary to reposition or edit the nodes, use Expand option to un-bake the nodes. They will appear in the list as children and can be transformed or otherwise edited. Do not forget to use rebake them again with Create option.
|Clear||To remove all node references that were baked into a World Cluster, use Clear option.
World Cluster Parameters
|Visible distance||Up to the visible distance all node references are rendered that were baked into a World Cluster and are found within this range.
|Fade Distance||Across the fade distance the number of rendered node references gradually decreases, as they disappear randomly one by one. The fade distance follows the Visible distance. Without the fade distance node references disappear abruptly, as a clearly seen line. Using fade distance allows the objects to disappear one by one until up to the fade distance only a few left. It makes the disappearing smooth and much less noticeable.
|Shadow||The distance to draw objects outside the view frustum. This option allows to eliminate popping of shadows at the edges of the screen when the camera is turning.
The generator helps to randomly scatter and scale node references. After they were automatically positioned, objects that do not fit into a right place can be moved to a better position or deleted. If no manual editing is not planned, it is better to use more memory-efficient World Clutter instead.
To use random generator, simply do the following:
- Add node references to be scattered.
- Specify the mask for scattering areas.
- Adjust generation parameters.
- Click Generate button to scatter nodes.
All nodes that has been previously baked into a World Cluster will be removed. To avoid this, expand the nonempty World Cluster before using random generator.
- Click Expand and move nodes to place, rotate them or scale as necessary.
- Use Create to rebake nodes into a World Cluster again.
Node references that will be scattered throughout a definite area appear in the list. For each of them the probability of appearing is controlled.
|Add||Add a reference node to the list of Cluster objects that will be randomly scattered.|
|Remove||Delete all selected node references from the list. To select an object, a box near it should be checked.|
|Probability slider||The higher the probability, the more often the node reference can be seen if compared to other Cluster object. Let's say we create a mixed forest with birches and pines. If the probability slider for pines is near to zero, almost all of the forest consists of birches and only several pines will be seen among them. Changing appearing probability does not influence the number of rendered objects, it only specifies the proportion between several objects.
|Generate||Randomly position objects across a specified area by a mask. Each time this button is clicked a random seed value is used. Scattered objects are automatically baked into the current World Cluster.|
Random generator scatters objects across a 2D grid with a pre-defined step. Cluster objects is randomly placed (in a new pattern each time generation is performed, because a random seed value is used) depending on the density and above mentioned probability of appearing.
|The size of the scattering area along X and Y axis. Within this area objects will be scattered with specified density.
|Density||Density specifies how many objects there are per square unit. In case there are more than one object in the Cluster, probability will be taken into account, but will not change the resulting number of all rendered objects.
|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 stones across the rocky areas, while leaving the grassy ones rock free.
|Threshold||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.
To randomize the appearance of scattered objects, 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.
Orienting along the Relief
Unless objects in the Cluster list 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 me made a parent of the World Cluster node.
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.
|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.
The collector makes adding of node references as easy as a click of the mouse button. To bake a World Cluster, simply do the following:
- Add node references into the world.
- Press Update button on the Collector tab. The list of all node reference present in the world (and how many instances of them there are) will be shown.
- Select node references to bake by checking corresponding boxes.
- Hit Collect button to make the selected nodes children of World Cluster.
- Go to the Cluster tab and choose Create.