Mesh Cluster
A cluster is an object that can contain a great number of identical meshes with the same material, which are managed as one object. Cluster meshes can be scattered either automatically, or each mesh can be positioned, rotated and scaled manually.
The cluster mesh is usually used for objects of the same type, for example, houses in neighborhoods.
Meshes of the cluster object that will be visible in the viewing frustum will be loaded, those ones that will not be visible will be culled. Using clusters is very efficient performance-wise: it substantially speeds up rendering and allows you to handle a lot of objects without any performance drop.
There are two ways to create a cluster in UnigineEditor:
- Create a cluster by baking all of the identical child meshes.
- Collect a cluster by baking all of the identical meshes in the world.
See also
- An ObjectMeshCluster class to edit clusters via UnigineScript
- A set of samples located in the data/samples/objects/ directory:
Creating a Cluster
To create a cluster by baking the child meshes, do the following:
- On the Menu bar, click Create -> Object -> Mesh Cluster.
- In the dialog window that opens, choose the path to the .mesh file. This mesh would be used as the source one for the cluster.
- Place the cluster somewhere in the world. It won't be seen as it serves just like a source mesh for child meshes.
- Manually position identical meshes in the world and make them children of the created cluster.
To make a node a child of another node, drag it to the left under the parent node.
- To bake the child meshes to the cluster, click Create in the Mesh Cluster tab. The child meshes won't be no longer seen in the nodes hierarchy.
Parameters window, Mesh Cluster tabOnly enabled meshes are baked into a cluster. Disabled ones are left as simple child nodes.
To add more meshes into the same cluster, simply make them its children and click Create once again to rebake the cluster.
To change all of the child meshes at the same time just change the path to the source cluster mesh in the Mesh field of the Mesh Cluster tab.
Collecting a Cluster
To create a cluster by baking all of the identical meshes in the world, do the following:
- On the Menu bar, click Create -> Object -> Mesh Cluster.
- In the dialog window that opens, choose the path to the .mesh file. This mesh would be used as the source one for the cluster.
- Place the cluster somewhere in the world. It won't be seen as it serves just like a source mesh for child meshes. Meshes that are going to be baked should have the same .mesh file as a cluster mesh.
- Specify the same material that is assigned to meshes going to be baked for the cluster in the Node tab of the Parameters window (the Surfaces section).
- Click Collect in the Mesh Cluster tab. All of the meshes having the same mesh and material assigned will be baked to the cluster. This meshes won't be no longer seen in the nodes hierarchy.
Parameters window, Mesh Cluster tab
To change all of the child meshes at the same time just change the path to the source cluster mesh in the Mesh field of the Mesh Cluster tab.
Expanding a Cluster
To expand a cluster (either created or collected) click Expand in the Mesh Cluster tab. It may be necessary for some meshes repositioning or removing.
Clearing a Cluster
To delete all of the meshes baked to cluster click Clear. Make sure that the meshes are created or collected, as the operation won't be performed if they are rebaked.
Mesh Cluster Parameters
The following parameters are available for a cluster in the Mesh Cluster tab:
Mesh | Change the source cluster mesh thus changing all of the children meshes. |
---|---|
Visible | The distance up to which all of the cluster meshes are visible.
To avoid flickering of cluster meshes, the object maximum visibility distance should be greater than the sum of minimum visibility distance and minimum fade out distance:
Max Visibility > Min Visibility + Min Fade
|
Fade | The distance up to which the number of rendered cluster meshes gradually decreases, as they disappear randomly one by one. The fade distance follows the visibility distance. Without the fade distance set meshes disappear sharply, 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.
For the best result, it is also recommended to combine this effect with objects fade-out. |