glTF import produces invalid meshes

Hi folks!

I’ve been getting pretty mixed results when importing GLB files into Rhino using the new Import Content Grasshopper component in Rhino 8. For some context, I am experimenting with loading Google Maps 3D Tiles: I make a POST request to the API, get the glTF geometry back as binary, save it to disk as GLB files, and then load them back into Grasshopper with Import Content.

For some strange reason, when I drag GLB files into Rhino directly, it imports valid meshes (although, texture mapping on some tiles looks a bit wonky). When I import the same files using Grasshopper, I get a lot of invalid meshes:

The Import Content component loads all GLBs as a Model Mesh. I then try to cast it into a regular mesh, which works for some tiles but also makes a good chunk of them invalid.

I tried fixing invalid meshes by running CullDegenerateFaces() in C# and unifying normals, but had no luck so far. Rhino’s import command clearly goes through some extra repair steps that I was unable to replicate in Grasshopper.

So my questions are as follows:

  1. Is there a better way to import glTF geometry into Rhino 8 using Grasshopper? I am open to 3rd-party plugins.
  2. Are there other mesh repair mechanisms I can try in Grasshopper?
  3. Is there any obvious reason for texture mapping being broken on some tiles and not others?

I am attaching the GLB files as an example.
Thanks!

3D_tiles_GLBs.zip (2.0 MB)

1 Like

Another data point: these tiles look perfectly fine when imported into Blender, which means that there is definitely a bug in how Rhino reads glTF meshes

1 Like

Hi,

These glb files use draco mesh compression to keep the file size low. From my investigation we seem to be decoding this compression incorrectly. Some of the meshes are still “bad” anyway. Mainly degenerate faces where all the points of the face are coincident. That needs fixed in the importer. I opened an issue here.

1 Like

Great to know! Thanks for looking into it!