Yo @Deltakosh … Well i had to add support for the new toolkit to generate native .babylon scene files as well as .gltf and.glb (So i had to actually support BOTH file systems).
Anyways… Here is a Test Trees using Raw .babylon scene files (NO Mackey Extensions):
https://www.babylonjs-playground.com/index.html#DI1URI#4
The ONLY problem is with the billboard… If ANY of the LOD levels show a BILLBOARD. The Master tree billboard ALSO shows even though it SHOULD NOT because of its LOD level.
The submesh issue is NOT an issue when using babylon scene files. I also noticed the Instanced Meshes actually show 5 submeshes in the inspector and they render correctly…
But the GLTF version only shows 1 submesh in the inspector (Even though it actually renders as if it had all 5 submeshes)
So the issues has to be with HOW/WHEN i am creating the submeshes for the master tree:
In the GLTF exporter (Right after the geometry data is assigned to the babylonMesh) is where and when i create the sub meshes like this:
// Setup Sub Meshes
if (primitive.extras != null && primitive.extras.metadata != null && primitive.extras.metadata.multimaterial != null && primitive.extras.metadata.submeshes != null) {
const submeshes:any = primitive.extras.metadata.submeshes;
babylonMesh.subMeshes = [];
for (let subIndex = 0; subIndex < submeshes.length; subIndex++) {
const parsedSubMesh = submeshes[subIndex];
BABYLON.SubMesh.AddToMesh(parsedSubMesh.materialIndex, parsedSubMesh.verticesStart, parsedSubMesh.verticesCount, parsedSubMesh.indexStart, parsedSubMesh.indexCount, <BABYLON.AbstractMesh>babylonMesh);
}
}
I am using metadata to define the sub meshes index values and then calling: BABYLON.SubMesh.AddToMesh
Should i be creating/defining the SUB MESHES a different way ???
Is there some kind of MARK DIRTY or SOMETHING else i need to do to make the instance ACTUALLY recognize all five submeshes… so they show as 5 submeshes in the inpsector???
As A Reference… The GLTF Version that show the submeshes INCORRECTLY in inspector:
https://www.babylonjs-playground.com/index.html#DI1URI#2
So… Its gotta be HOW or WHEN i am crating the sub meshes for the GLTF Version ???
And of course that FINAL BILLBOARD issue where the MASTER BILLBOARD is rendering on the MASTER tree if ANY of the instances are showing the BILLBOARD for its final LOD Level…
Thats is what i can come up with so far… If you can lend your expertise … I know we can fix this issue