Creating a mesh file in code results in larger file size

Godot Version

4.3

Question

When I create a .mesh file using code (tried using ArrayMesh, SurfaceTool and ImmediateMesh) then save it using ‘ResourceSaver.save’ the saved file size is bigger than expected (~30kb compared to 7kb when loading the obj with load(“path”) and saving).

Saving this larger mesh locally inside a scene locally reduces the size to about 8kb. However if you do that with the .mesh godot created that one goes down to 5kb.

The context is that I want to convert about half a million or more .obj files into .mesh files. Then I save them locally in a few hundred scenes. The problems are:

-Can’t load an .obj file outside the project folder
-Putting the files into the project results in Importing the files which takes FOREVER
-If they do import, Godot crashes with that many files
-Loading the obj as text works but I can’t find a way to make it into a .mesh without the file size ballooning
-Opening the .mesh in notepad and comparing with the smaller one, I can see it has a bunch of readable text that the other doesn’t, for example: ‘lightmap_size_hint_blend_shaps_surfaces’

I know 3kb seems like a ridiculous difference to worry about but with this many files it adds up to quite a bit. Any help would be much appreciated!

Hi Jesterrr

Can you maybe add an small example of the .obj and a converted .mesh file? Then we could have a look at the differences which would help us with a possible solution.

Accept from the large waiting time for conversion/import is there an other reason why the more space is a problem? E.g. memory limit at the desired implementation platform? A windows PC has normally more disk-space and RAM memory than a mobile device.

With kind regards

Ludo