GLTFUtility
GLTFUtility copied to clipboard
Fails importing mesh hierarchy from glb
Importing geometry from gltf binary format the node hierarchy is lost and the mesh's structure is flattened.
Understood the issue which is related to the sharing of vertices (due to gltf optimization) among meshes so that normals cannot be calculated in a correct way in case of sharp solid's edges. This is made evident i.e. analysing a standard cube (made within unity3d) which contains 24 vertices 12 triangles and a glb imported cube which contains 8 vertices and 12 triangles (sharing corner vertices). To correctly render scenes with sharp solids (i.e. low poly) an option about generating shared or not shared vertices could be useful.
Can you share the glb model?
IFCmesh.zip
This is a simple model which I've obtained by parsing IFC format (a standard for Building information modeling).
As you can see the rendering shows something strange on any solid (i.e. walls). This is due not only to metallic shader (which is not the best choice in this case) but to the mesh optimization made by gltf conversion.
I wrote the simple function attached here to split vertices so that with a mesh postprocessing you can obtain again sharp edges. this function can be optimized (splitting only when different normal are needed so saving some space vertex list but to me it is more important to save processing time).
unshareVerts.zip