glTF support in Rhino?

I need to publish some Rhino models to the web and I found that the best way to do so is the glTF format.

glTF™ (GL Transmission Format) is a royalty-free specification for the efficient transmission and loading of 3D scenes and models by applications. glTF minimizes both the size of 3D assets, and the runtime processing needed to unpack and use those assets. glTF defines an extensible, common publishing format for 3D content tools and services that streamlines authoring workflows and enables interoperable use of content across the industry.

Any chance to see support for this file format in future? Will help to communicate with other softwares like SubstancePainter.

2 Likes

Added to the heap, thanks.

https://mcneel.myjetbrains.com/youtrack/issue/RH-42754

-Pascal

2 Likes

@fraguada, didn’t you do some work in this area for Iris?

@Macuso once you export the data from the Rhino model, what do you expect to do with it? You can try Iris which exports a json format that can be opened with a small app that comes with the plugin or with the three.js editor.

While there is no direct way to export glTF from Rhino today, you can export the json through Iris, open it in the Three.js Editor, and export glTF from the editor.

More info on what you want to do with the models will help me to add any relevant info.

@stevebaer yes, I began to look at it, but I have not begun that implementation. Given what I know now from creating Iris, and looking at several glTF files, I think that creating an exporter / converter (and eventual importer) should be very doable. A few things to note, glTF mainly focuses on exporting geometry. Things like lights are supported through extensions. There are many examples of extensions in case we need references when things get beyond exporting meshes.

Facebook recently supports richer 3d post, in GLTF format. Sample:

2 Likes

There is an extension for gltf in sketchup, which can the be turned into a glb with an online file conversion. It looked promising when I put together the first facebook 3D post. I was able to rotate my object and choose the background color but now it takes ages to upload. I hope it works

https://extensions.sketchup.com/en/content/gltf-exporter

https://glb-packer.glitch.me/

Substane Painter will have glTF support:

glTF import can be facilitated by the reference KhronosGroup glTF c# loader. I’ve tested the use of this code and it works. The nice thing is that they provide a way to generate a library of related glTF object types needed to create glTF files.

The importer loads a file from a path on the hard drive and it results in a glTF object. Now we must convert the information in that glTF object to Rhino objects (meshes in this case), materials, etc. This is the trickier part, and involves understanding how the files are structured and information packed. Once this is worked on and tested, developing an exporter should be straightforward.

I’m working on this in the context of Iris, though it is hard to say when something useful will be available for you to test. When it is, I’ll let you know.

For the moment, you could use the following workflow which I mentioned above:

  1. Export the rhino model as a .json file. This functionality is provided by Iris.
  2. Open the resulting .json file in the Three.js editor.
  3. In the three.js editor, Export the model as .glb or .gltf
1 Like

Glad to hear this!

I’ve achieved the most basic (but arguably the most difficult) task, which is to get meshes importing into Rhino. Next week I’ll post a plugin you can test for importing. In case anyone is interested, the code is here.


BrainStem model created by Keith Hunter and owned by Smith Micro Software, Inc.

2 Likes

Wow. Almost there. Waiting for the plugin release to get my hands dirty.

If I understand correctly this is an gltf model imported into Rhino? What about export from Rhino to gltf?

yup:

That was this part:

Thank you for replay, I just wanted to be sure that I do understand correctly!

If I understand correctly …

Hi Luis,

I’d like to bump this thread to ask if there is anything on the horizon for a glTF exporter?

Thanks
-Willem

6 Likes

Hi @fraguada,

Any testable release?

Thanks.

Still waiting also myself for this, more than a year and half now!

I have been working on integrating draco compression support into rhino3dm and RhinoCommon.
https://google.github.io/draco/
This is a key piece to getting glTF support with the compression that people want from this format. Currently rhino3dm.js and rhino3dm.py have draco compression support and I am trying to get this into RhinoCommon. Once that is done we can further investigate glTF support.

7 Likes

Today’s V7 WIP now contains support for Draco compression in RhinoCommon.
Rhino.FileIO.DracoCompression
Rhino.FileIO.DracoCompressionOptions
are what can be used to compress and decompression Rhino meshes

4 Likes

Good to know that at least it is some progress here. Waiting for the release!

You can export an .obj file in Rhino and convert it to .gltf. There’s an OBJtoGLTF converter on GitHub.