Programming
Fundamentals
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
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
Rendering-Related Classes

Baking Meshes into One Mesh with Mesh Combiner Plugin

Mesh Combiner is a UnigineEditor plugin designed for baking several static meshes into one mesh. The plugin can be used to increase the application performance, for example, by baking a large number of different meshes into one in order to render them as a single mesh.

Notice
The plugin is not designed for baking meshes with LODs. If you try to bake such meshes, you will get an incorrect result.

Buildings on the picture are baked into one mesh via Mesh Combiner

General Concepts

When selecting meshes that need to be added to the Mesh Combiner plugin, you can select both static meshes and node references. If you select a node reference and add it to the Mesh Combiner plugin, all the meshes, to which the node reference refers, will be added to the list for baking. The child nodes (that are static meshes) are also added to this list. However, the hierarchy is not saved.

Notice
In general, you can select any node to which the static meshes or node references are assigned as the child nodes.

Meshes with the same material are baked into the resulting mesh as a single surface. Such surface will have the same name as the material.

As the baked meshes are rendered as the single mesh, the performance can drop, for example, when the number of the baked meshes or the distance between the baked meshes is too large, so that only a part of them is visible in the current viewport.

To avoid performance loss, the meshes can be split into groups by specifying the Grid step before baking. The surfaces of the resulting mesh will also be split in this case.

Notice
However, the size of the grid step depends not only on the number of the meshes to be baked and the distance between them. The additional project-specific conditions should also be taken into account.
Then it is possible to specify rendering conditions for the surfaces of each group (for example, minimum or maximum visible distance and so on).

Loading Plugin

To load the Mesh Combiner plugin via UnigineEditor:

  1. Run UnigineEditor.
  2. On the Menu bar, click Plugins -> Manage.
  3. In the Plugins window that opens, set the Mesh Combiner plugin enabled.

    List of available plugins for UnigineEditor

The Mesh Combiner plugin will open:

Mesh Combiner plugin window

Baking Meshes

After loading the plugin, you can bake all the required meshes into one as follows:

  1. Click New in the plugin window and specify a name for the resulting mesh in the file dialog window that opens:

    The path to the new mesh will be shown in the Mesh field:

    Also a new mesh static node will be added to the nodes hierarchy. The default name of the node will consist of the prefix Combined mesh and the name of the mesh that you have specified. For example:

  2. Select the required nodes and click Add in the plugin window.
    Notice
    The nodes can also be selected via the Nodes panel.
    Names of all added meshes will be listed in the plugin window. If a mesh has no name, an empty string will be displayed in the list. For example:

    List of meshes to be baked. The mesh without the name is highlighted.
  3. Specify the Grid step if it is required.
    Notice
    Too small or too large step can decrease the performance instead of increasing it. So you should set this value carefully. See also the chapter on General Concepts.
  4. Click Combine in the plugin window.

To check, whether the baking has improved the performance, you can do the following:

  1. Check performance data after baking (FPS and data displayed by the Performance Profiler).
  2. Click Hide in the Mesh Combiner window.
  3. Check performance data again. If the application performance has improved, click Show in the plugin window in order to render the baked mesh.

Plugin Options

Mesh Path to a .mesh file into which the resulting mesh will be saved.
Grid Grid step (size of a grid cell in units) along the axes for splitting the resulting mesh.
Add Adds the meshes, which are selected in the scene, to the list for baking.
Remove Remove the meshes, which are selected in the scene, from the list for baking.
Show Show the resulting mesh in the scene.
Hide Hide the resulting mesh.
Combine Bake all meshes from the list into one mesh.
New Create a mesh into which meshes will be baked.
Last update: 2017-07-03