Describe the project you are working on:
3d racing game
Describe the problem or limitation you are having in your project:
Collada files import as several meshes instead of one.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
An option to merge meshes.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
It could be an import-time switch, but a more generic solution (preferably exposed to GDScript so that I could merge already imported assets/scenes via tool scripts) would also be necessary.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Nope
Is there a reason why this should be core and not an add-on in the asset library?:
Import-time switch cannot be done via an add-on. There was an asset that claimed to do the generic kind, but it crashed on Collada imported meshes, it only worked for Godot primitives.
Original issue: https://github.com/godotengine/godot/issues/7844
I have a custom_module for this https://github.com/godot-extended-libraries/scene_merge/tree/master. Please review. It's not in the Godot Engine pipeline for submission, but you know how to ping me on Discord.
I didn't consider custom modules, thanks for the ping - IIRC they became easier to use with a very recent PR, didn't they?
Why can't this be done in Blender or another 3D graphics application before creating the collada file?
The closest attempts are either proprietary or don’t work.
https://www.rizom-lab.com/ One draw call tech.
https://github.com/Grim-es/material-combiner-addon This doesn’t work.
There is a unity tool to bake avatars to one mesh, but I only have pictures that it exists. Can't find the git repo. It relies on the flattening materials to a square and render via the camera.
Microsoft’ Simplygon and Unreal Engine’s voxel lod tools exist too.
The closest viable project to contribute is Blender’s GPL plugin. I prefer mit for remixing.
My plan is to chain merging -> mesh tri decimation -> export to gltf or fbx inside of Godot. The ui is already being worked on Concept Graph.
https://github.com/HungryProton/concept_graph
The described pipeline works manually.
Thanks
There is a unity tool to bake avatars
In case it wasn't clear, I was thinking of static meshes, not characters.
@fire: Unity has a built-in function: https://docs.unity3d.com/ScriptReference/Mesh.CombineMeshes.html
An open-source asset: https://github.com/mogoson/MeshCombiner (and at least one more on the asset store that I once used, but can't remember the name of)
@aaronfranke: In many cases, the assets are gotten from elsewhere (asset stores, Blender Kit, free sites like turbosquid) and a programmer cannot be expected to know his or her way around Blender (I have used Blender a bit, but I wouldn't even know where to start looking).
This is also a requirement for hierarchal lods in Godot Engine. The idea behind that is you combine arbitrary clusters of meshes and then decimate.
This is not needed for lod imposters though.
Since this was repeatedly mentioned:
The cats plugin requires you to install https://github.com/Grim-es/material-combiner-addon and I had trouble getting meshes to merge. It might be me though.
I see a need for merge meshes as well. As far as I understand there is only one way to regenerate the NavigationMesh by calling create_from_mesh, but you can only add one mesh. If I dynamically need to generate the level at runtime it would be so good to have this feature.
I wrote a simple function on a script that can merge the meshinstance array into one. I'm not sure about performance and so on, but it seems to work for simple meshes with one uv, tangents, and vertices. If it would be fast and would be a part of the engine, in C++, perhaps it would make sense to merge static objects for the sake of reducing the number drawcalls. I would like to consult and ask if such a function makes sense for merging into a single collision shapes grid?
CombineMeshes.zip
Most helpful comment
I have a custom_module for this https://github.com/godot-extended-libraries/scene_merge/tree/master. Please review. It's not in the Godot Engine pipeline for submission, but you know how to ping me on Discord.