для этой страницы,
отображается код на другом
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.
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.
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.
To load the Mesh Combiner plugin via UnigineEditor:
- Run UnigineEditor.
- On the Menu bar, click Plugins -> Manage.
- In the Plugins window that opens, set the Mesh Combiner plugin enabled.
List of available plugins for UnigineEditor
The Mesh Combiner plugin will open:
After loading the plugin, you can bake all the required meshes into one as follows:
- Click New in the plugin window and specify a name for the resulting mesh in the file dialog window that opens:
- Select the required nodes and click Add in the plugin window.
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:The nodes can also be selected via the Nodes panel.List of meshes to be baked. The mesh without the name is highlighted.
- Specify the Grid step if it is required.
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.
- Click Combine in the plugin window.
To check, whether the baking has improved the performance, you can do the following:
- Check performance data after baking (FPS and data displayed by the Performance Profiler).
- Click Hide in the Mesh Combiner window.
- Check performance data again. If the application performance has improved, click Show in the plugin window in order to render the baked mesh.
|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.|