glTF support in Rhino?

Any chance the DracoCompression can be backported to v6?

I have no plans on backporting this to V6

1 Like

Sorry to resurrect this topic. Where did we land on exporting glTF/GLB files? Is IRIS still the way to go?

I hand rolled a basic glTF Binary export we use internally now. It just takes the mesh from the RhinoObjects and writes it to a glb that we then load with threejs. Plenty to be improved, but that’s all we needed for a start.

Steve’s DracoCompression would be a huge improvement, but I haven’t looked into that yet.

Here’s a Mac plugin with a single export command: glTFBinExport in it: gltf_binexporter.macrhi (268.8 KB)

I’ll compile a Windows version within the next few days so you can play around with it.

3 Likes

Thanks so much. I look forward to the windows version.

I assume this won’t bring material information along with it?

Here it is for Windows. It only works for Rhino WIP 7.20295.18003

glTF-BinExporter.rhi (278.1 KB) edit: See the answer below instead.

It does export materials, but only the base color of the render material as far as I remember. It’s been a month or two since I made it.

1 Like

Thanks so much. I’ll give this a go tonight!

Bumped the Rhino version to latest beta, and put it up on food4rhino now: https://www.food4rhino.com/app/gltfbinexport See the answer below instead.
I won’t pollute the thread with further updates :grin:

3 Likes

Okay, okay, one final update, because I moved it to a new package…

  • Follow along in this thread for updates: glTF-BinExport
  • Moved it to a different package. Install with the new PackageManager in Rhino 7. It’s called glTFBin-Exporter (maybe marked as pre-release).
  • Released it as Open Source and collaborating with McNeel to improve it https://github.com/Stykka/glTF-Bin (go give it a star on Github if you like it!)
1 Like

How do we install this plugin that was shared a while ago? There are no instructions, and I cannot find a “download” link. Maybe I am looking at the wrong place?

To be fair, it’s the Importer that’s being asked for in the post that you are replying to, not the Exporter.

@Cape_Olive , see this post:

-wim

My bad. I have brought great shame upon myself. :grimacing: :flushed:

1 Like

Hi there,
I am trying to get proper glTF formats from Rhino and i must say it´s a real PitA. We want to make an online manual for building a machine. For that we need glTF files.
Now i discovered this viewer (Online 3D Viewer) which can export Rhino 3dm files to GLB and glTF . It works great but…it doesn´t do curves (Bsplines, polylines)
Anybody has a solution for getting those GLB,glTF files with curves?
Gr.
Marc

Hi Marc, GLB,glTF only support meshes. You can develop a script/macro/tool that converts all your curves to meshes as pipes, with a thickness and tesselation that makes sense for your scale and target file size. Pipes are very intense in polygon count so be careful.

G

1 Like

Hi Gustavo, Thanx for the quick reply.
Yeah i was thinking about that as a workaround but with the same thoughts as you have on file size.
But are you sure about that thing that GLB glTF only supports meshes? Because i made a export to glTF using the ShapeDiver plugin and with Three.js I opened it and all curves were there!?

Curves are not part of gltf. See this post by ShapeDiver as to why this is working from their plug-in

1 Like

Thanx Steve
Now I´m a bit confused. So, glTF doesn´t support curves but when made with ShapeDiver and their viewer curves will show up?
Then why do they show up, as red lines, in our Test Page? We are using Three.js (nothing from ShapeDiver) and it reads from a glTF file(Shapediver, glTF 2.0)

I think this is because GLTF 2.0 supports straight lines, so these are coming in. You can also test and see that lines with any curvature (circles) will not be supported. But if you convert those to polylines (small straight segments that look like curves/circles) those should come in.


https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#glb-file-format-specification

1 Like

I opened an issue here to add an option for meshing and exporting curves. I was hesitant to add it before but it seems like there’s need.

2 Likes

Joshua, are you thinking strictly meshing? (As in mesh pipes/strips)? Or having an option to export as polylines too? (With no thickness). If I read the spec correctly those likes are supported.

G