Yo @Deltakosh and Maybe Gary @bghgary can tell what to do with this one.
GLTF vs Babylon Instance Meshes In Scene Files.
Using native babylon scene files, instacnes are serialized as an array of AbtractMeshes on the the BabylonMesh entity. This mode DOES NOT actually create node that get represented in the SCENE hierarchy. When the loader create the the babylon mesh… it will iterate all the mesh.instances and create the an INSTANCE of the mesh at the serialized abstract mesh location. So when setting up the original master mesh… everything gets setup first… submeshes, LODs, etc… then when the loader creates all the instances (WHICH DOES NOT EXIST IN SCENE YET, NOT UNITIL WE CREATE THE INSTANCE) … The instances will have everything the MASTER mesh did.
Well GLTF handles instances a bit different… There is an ACTUAL node that gets serialized in the GLTF Node hierarchy… And the babylon GLTF importer does some MAGIC to detect that a node is an instance and creates and instance mesh to use CreateInstance instead of actually creating a new Babylon.Mesh for that GLTF Node… The point is everything is always represented in the scene… even the LOD and Instance Meshes
I have setup a sample TestTrees.glb scene in the playground to show this problem.
You will notice there are TWO trees
So in gltf all this created because that is what in scene files… So there will be a problem when trying yo create attach LODs using InstancedMesh. The second tree and its LOD’s are really the same meshes as TREE1 so TREE2 ends up as InstancedMesh for the whole TREE2 hierarchy.
How would handle this situation… I have two trees… each of which has lods and one of them will be made purely of instance meshes…
Here is the test playground with a TWO test trees common for a UnityGLTF export:
can you please try and get LODs going on both trees… Please