glTF Exporter for Grasshopper

Is there any possibility that the ShapeDiver tool to export in glTF comes from GH and not from Rhinoceros plugin?

It would be great to be able to do this; I want to export scenes quickly from Grasshopper without baking all the geometries and prepare the scene in Rhinoceros. For example, I have multiple iterations from a GH definition, and I want to automate the creation of glTF for the different results.

Thanks!

Some plugins may bake and clean up the scenario for you. Try mine, Pancake, or another plugin Lunchbox.

You may need to customize export options.

So far you may export geometry only. Material/texture mapping aren’t supported by either of the plugins I believe.

Thanks!

I tried the plugin and found it quite interesting. What I am looking for specifically is the glTF format since as I know is one of the best formats for web visualization with Three.JS.

Three.JS seems to be moving toward glTF and leaving in the past .json format.

I tried Triceratops, for exporting geometry and materials directly from grasshopper to a JSON file to be viewed with Three.JS, It works, but .json files are not as optimazed as .gltf files.

Thank you!

As for my plugin, you may use “Export As” to export to any format Rhino supports, which includes glb, if you have ShapeDiver’s plugin installed. Set the output file’s extension as glb, and the plugin will take care of it.

1 Like

That is correct, since the ShapeDiver gltf exporter is built as a standard export plugin for Rhino, you should be able to use @gankeyu’s plugin.

1 Like

Is there a reason why SD’s exporter plugin registers the extension glb but the file is exported as gltf?

(Anyway, the export is actually successful. Don’t be scared by the big red balloon)

Thanks @gankeyu and @mathieu1

I will try how the export works. It looks pretty good!, I didn’t know that the plugin allowed to export in other rhino formats. I thought you could only choose the ones that came out in the output icons. Thanks!

I think @snabela in this post talks about glb and glTF export.

1 Like

We will improve the handling of gltf versions in a future update but indeed for now, refer to this answer by Alex for some explanations:

1 Like

Just a notice for new-comers: the latest version of Pancake has fixed the fake red/error with Shapediver’s gltf export plugin.

1 Like

Hi @gankeyu,

your plugin looks cool!

Is it possible to export gltf format with the hierarchy?

Don’t quite get what you mean. :joy: (sorry i’m not familiar with glTF format)

The structure of the target file depends entirely on the exporter plugin. So you should be able to do whatever you can do as if you are manually exporting. Other than that, no.

If you are referring to exporting to multiple files, yes it’s supported by Pancake.

Hi, thanks for your reply.

Sorry, if it not clear enough.
So, what I mean is that I am wondering if Pancake can keep the data structure from Gh when exporting to glTF?

I am looking the structure similar to json, for example:
{
“hello”: “hello”,
“colors”: {
“red”: “red”,
“blue”: “blue”,
“green”: “green”
}
}

Do you think it is possible?

It depends on how ShapeDiver’s plugin will export. But sadly it may not work as what you said.
Pancake itself requires all input as lists (or one single item), so it is flattened as tree structure is not preserved. The result will be just like you bake geometry and conduct a glTF export from Rhino’s menu.

Oh, finally I understand why my object did not export properly.

Thanks for your explanation.

Sorry about that. I will add a notification in the newer release if Pancake detects such a situation.

edit:

Really thank you for bringing me that.

1 Like

Hello!

First - awesome plugin!

I have been testing the pancake export as plugin with .glb to save as gltf. The file exports, but when inputting the options as_Materials=Yes _MaterialSource=DisplayColor When I bring the exported gltf file into Three.js editor or even my own editor it shows as only black. When I export the geometry from rhino by selecting it and going through export selection it shows in three.js editor with the display colors.

:thinking: Let me take a look

Hi @gankeyu, any update regarding exporting multiple layer (as a structure) in one gltf/glb format?

:thinking: Sadly, glTF’s hierarchy is not supported due to how Shapediver’s exporter works.

If I have free time, I may create a glTF writer that supports hierachy. It depends.

For now, you may try program your exporting script by using libraries, e.g. SharpGLTF