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.
@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.
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
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:
Export the rhino model as a .json file. This functionality is provided by Iris.
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.
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.
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