Skip to content

rikh42/meshmerge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mesh Merge for Godot

Logo

A simple addon for Godot that can merge the selected MeshInstance3D's into a single new combined mesh.

The new mesh will have a single surface material for each unique material in the selected meshes.

It is perfect for flattening a group of meshes, such as a cluster of made up of many separate grass, flower and plant meshes, into a single mesh that would be suitable for use in a MultiMeshInstance3D.

Installing

  1. Open your project in Godot and go to the Asset Library tab at the top.
  2. Search for "mesh merge" to find the addon
  3. Choose Download to install it in your addon's folder
  4. Go to "Project -> Project Settings... -> Plugins" and enable the newly installed plugin

or, to manually install it...

  1. Download the code from Github at https://github.com/rikh42/meshmerge
  2. Unzip and copy the 'addons' folder into your project
  3. reload Godot
  4. Go to "Project -> Project Settings... -> Plugins" and enable the newly installed plugin

How to use.

  1. Select all the MeshInstance3D's in your scene that you wish to combine into a single mesh.
  2. A button will appear at the top of the viewport. Either press this button, or choose Project -> Tools -> Process Selected Meshes from the menu to open the settings dialog.
  3. Choose your settings and press OK. A new MeshInstance3D will be added to the scene that contains all the geometry from the selected meshes.

Note that the original meshes will not be modified and will still be present in the scene. Typically the new mesh and the old meshes occupy the same space, so you may need to hide or remove the original meshes to clearly see the results.

The dialog box that pops up The Dialog box

Options

Normal Threshold

When merging meshes, the tool can optionally rebuild normals. This feature is really designed for converting from flat shaded style geometry into smooth shaded meshes. This results in fewer verticies as each vertex is shared by all connecting faces instead of being duplicated to support a unique normal for each face. Set this to a high value (180 degrees) to merge every possible vertex and rebuild all the normals, or a lower value (say 30 degrees) if you want to preserve some sharp edges. Set it to zero to preserve the orginal selection of meshes unchanged.

Preserve UV Seams

When attempting to merge verticies for normal rebuilding (see above), the merging tool will also consider the meshes UVs and avoid trying to merge verticies that share the same point in space, but have different UVs.

Preserve Colour Seams

Same as above, but also avoids merging verticies that share the same point in space, but have different vertex colours.

Merge All Surface Materials

This will combine all selected MeshInstance3D's but only keep a single material for the whole lot (the first one it finds). This can be helpful if many of your selected meshes are meant to have the same material (for example, they all have the same settings), but they appear as many separate materials internally. This lets you easily tidy them all up in a single step.

Examples.

Meshes from Green Stream

A example to show the mesh smoothing feature, taking a flat shaded tree mesh and turning it into a smooth shaded tree mesh...

Before merging before

After merging after

Another example, taking a cluster of grass, plant and flower meshes and merging them all into a single mesh...

A scene with many meshes to make a new cluster of plants A scene with many meshes to make a new cluster of plants

Showing all the meshes selected and the dialog open Showing all the meshes selected and the dialog open

Finally, the original meshes have been hidden, leaving a single mesh containing everything Finally, the original meshes have been hidden, leaving a single mesh containing everything

Any bugs or queries, find me on Blue Sky at @gamehooe.bsky.social

About

An addon for Godot that merges a selection of meshes into a single mesh

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors