GLTFUtility icon indicating copy to clipboard operation
GLTFUtility copied to clipboard

Fails importing mesh hierarchy from glb

Open berry4u opened this issue 4 years ago • 3 comments

Importing geometry from gltf binary format the node hierarchy is lost and the mesh's structure is flattened.

berry4u avatar Jul 16 '20 23:07 berry4u

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.

berry4u avatar Jul 19 '20 10:07 berry4u

Can you share the glb model?

Siccity avatar Jul 20 '20 06:07 Siccity

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

berry4u avatar Jul 20 '20 11:07 berry4u