MeshOptimisationTools, Detect duplicate meshes and merge them

MeshOptimisationTools
MeshSwitcher
This is a paid for plugin.

This plugin is an iteration on the idea behind my previous plugin, MeshSwitcher. It is able to recognise identical meshes by their vertices, and automatically merge them together under a single MeshId. You can use the plugin on any selection, including your entire workspace, and it fully supports undo/redo (ChangeHistoryService) and has detailed error reporting.

Demo

Behind the scenes, this plugin uses the EditableMesh class to gather information on the vertices of the mesh and generate an MD5 hash representing them, allowing fast real-time comparison of meshes. To do this, I used BoatBomber’s HashLib module, so thanks go to him.

Additional Functionality

Press 'Download unique meshes' to view the problem meshes

image

This will place a file in ReplicatedStorage, with the meshes grouped by their identifying hash, i.e. meshes that are the same but appear with different MeshIds.

image

You can also view the attributes of these meshes to see the ‘OriginalLocation’ of that specific instance of the mesh. This does not place every instance of every mesh ID in the folder for performance reasons, it shows one instance of each MeshId. ‘OriginalLocation’ is intended to help you understand what the mesh is for particularly unidentifiable meshes.

Note: The plugin struggles with meshes that have different orientations built in to the mesh itself, for example, a window on the front of a building and a window on the side of a building will be recognised as identical meshes, as they are, but when the MeshIds are unified, the window on the side of the building will be incorrectly scaled due to the originally uploaded mesh having orientation built into it. The result is a manual step needed rescaling those meshes. This is something I would like to resolve but is difficult to find a solution to, but when I find one it will be built directly into this plugin.

Change Log
26th Sep 2024

MeshOptimisationTools, Detect duplicate meshes and merge them - #14 by SteadyOn

27th Sep 2024

MeshOptimisationTools, Detect duplicate meshes and merge them - #15 by SteadyOn

Get it now for $14.99!

21 Likes

So it checks and fixes for meshes that has been uploaded multiple times thus gaining unique IDs despite being the same mesh. If I’m understanding right.

I assume the chosen meshid is random, it would be nice to receive a list of the ids of duplicate meshes, that way I could archive duplicates from my inventory. (Archiving actively used IDs is my own responsibility)

1 Like

Yep that’s exactly right. The chosen MeshId is random, yes. I could implement that as an option next to merge duplicates such as ‘Save MeshIds’, and output a JSON table into files or something - I’m not sure how easy it is to export files like that but I know DataStore editor does it. The JSON output could easily contain the full paths to all the meshes too if that’s useful.

1 Like

See the post edit above! I have added functionality that is I think what you were looking for.

1 Like

This is no doubt a useful time saving tool but I question why this plugin is 15 dollars, while its prior edition? was 5. I recognize the work it takes to build these tools but surely a 5 dollar price point would be a lot more accessible to a wider demographic of developers and would be a lot easier to recommend to people.

To be honest, initially I thought this plugin was about merging duplicate vertices. It would be cool to see a plugin on the market that can automatically simplify and optimize mesh topology, once publishing EditableMesh becomes available.

4 Likes

This is a fair point, I may reduce the price in future - the reason for the cost is that it’s a very specific mostly niche use case and I’m planning on frequently updating and adding features to it.

For example, fixing the orientation bug because of the orientation meshes were uploaded at is a huge task that I’ll attempt to fix and release as part of this plugin, there being some decent revenue from this helps with that , and relatively speaking the time I’m spending on this even with the price will probably generate at least 10-20x less than working on my games does. Essentially, I want to set this up as a premium plugin that with time will hopefully progress into a larger suite of tools.

1 Like

make it 5 bucks or less or i aint buying it

1 Like

@SteadyOn I ran this on an environment that I had already combed through manually and merged duplicate meshes on. It works alright for the most part and does a fine job at actually detecting duplicate meshes – it found 83 additional duplicates (out of 338 total) that I’d missed. However, there’s a bug in the replacement code.

The system doesn’t seem to detect differences in pivot points/bounding boxes between meshes and so it can end up scaling/orienting replaced meshes incorrectly, since meshes are scaled based on their bounding box.

As an example, these overhead lights end up getting totally mangled because whichever meshes were chosen as the “source” meshes had different bounding boxes or pivot points.


Would love to see this bug get fixed ASAP, as I can’t use the plugin until it is.

1 Like

Got it, I’d revert anything that’s changed for now as I’m sure this is something I can fix quite quickly

1 Like

I’m getting these warnings when I try to find duplicates.


1 Like

I thought EditableMesh was fully open, I must be wrong, it looks like you need to enable the EditableMesh flag.

thanks I enabled editablemeshes. I’m still having issues though. The meshes remain unaltered after I merge.

I’d also like to know how many meshes were merged

1 Like

The plugin does not appear in the plugin dock bar so I have to toggle it on and off in order to get the window to appear.

1 Like

Just released a series of Changes & Improvements:

  • Attachment, Joints and Constraints support, requested by @Quenty, this has been tested on a few different models, but may not work perfectly in every case. The plugin will attempt to maintain all of the constraint attachments on things like cars.
  • Further split out the output file into ‘DuplicateMeshes’ and ‘NonProblemMeshes’, where the former are meshes that the plugin has identified to be identical with different MeshIds, and the latter meshes where there is only one MeshId for that set of vertices across the game (therefore, not a problem)
  • Performance & potential negative impact improvement, stupidly, the plugin would previously replace the meshes that were not problematic as well as those that are, this is resolved.
  • Added support for PivotOffset, to resolve the problem @Rocky28447 encountered
  • Various fixes for SpecialMeshes breaking the ‘Fix Duplicates’ step, meaning SpecialMeshes should just have their MeshId changed from now on, and not come under any of the MeshPart logic, to fix a problem @dogwarrior24 encountered.
  • Widget button under plugins now toggles the window, plugin is closed by default. Widget button requested by @Dued1
  • Improved messaging around problematic messaging, requested by @Dued1
Improved messaging

When there are no duplicate meshes in the selection (i.e. no issues)
image

When there are duplicate meshes under the same ID, and an opportunity to merge them
image

3 Likes

I’ve implemented a new checkbox that will attempt to fix orientation and sizing for you, in many cases it works perfectly but in others it will cause small inaccuracies in positioning, that are quite large up close.

Read more in my Twitter thread:
https://x.com/2Steady4U/status/1839740235430650340


Getting this warning when trying to merge duplicates

1 Like

Is this happening on everything you try to use the plugin on? I assume there’s something different about these meshes (not to say that the plugin shouldn’t work with them, it should)

Just released an update that should mean meshes that have been processed before do not need to be reprocessed, significantly speeding up running the plugin on selections that it has been run on before. You can check the usage of the plugin in

C:\Users\ {Your Username}\AppData\Local\Roblox\ {Your UserId}\InstalledPlugins\0\settings.json