GLTFKit2 icon indicating copy to clipboard operation
GLTFKit2 copied to clipboard

Feature Request: Add GLB Export Functionality

Open thomas-hut opened this issue 1 year ago • 2 comments

Hello,

Could you please consider adding a .glb export function to GLTFKit2? This feature would enhance versatility, especially since USD/USDZ lacks broader support. Thanks for all your work on this valuable tool!

thomas-hut avatar Nov 01 '24 08:11 thomas-hut

This is a reasonable request.

Technically, export is already implemented on the feature/export branch, and it does allow round-tripping of static assets from .gltf/.glb files to GLTFAsset and back.

But creating a GLTFAsset from a scene that didn't begin life as a glTF asset is another story; you'd need to manually create all of the model objects, images, buffers, etc. first, and then use the export machinery. The reason we've been slow to implement export is that it's not guaranteed that we'll have feature parity with any of the common places you'd want to export from (i.e. SceneKit and RealityKit).

For that reason, it would be helpful to know more about your use cases. What kinds of scenes are you exporting, and what form do you want to export them from? It's not a goal of this project to be a generic format converter (that's why things like usd2gltf exist), but I'm open to trying to support limited use cases as long as the expectation is set that we're simply not going to attain 1:1 feature parity with arbitrary RealityKit scenes or whatever.

warrenm avatar Nov 04 '24 18:11 warrenm

hi @warrenm.

Thank you for your response and for the work you’re doing on this valuable tool!

I’m currently developing a 3D asset manager for iOS. While Apple’s ModelIO and SceneKit support exporting textured 3D assets in formats like OBJ and USDZ, I would prefer to save assets in the .glb format due to its high compression and reduced file size.

After researching available solutions, I’ve found that there aren’t many options on iOS for this specific need. Having .glb export functionality in GLTFKit2 would be incredibly helpful and greatly enhance the tool’s versatility.

Thank you again for considering this feature, and I appreciate all the thought you’ve put into making GLTFKit2 as powerful as it is!

thomas-hut avatar Nov 05 '24 02:11 thomas-hut

I also have this same need. I create models from images in realityKit on my swift app, but then I want to embed them in web pages for easy 3D preview, and that seems only possible with .glb not .usdz (in browser support, not AR quick look previews) but I'm at a loss how to convert from apple's ecosystem to .glb. What I've ended up doing is having a server pipeline using https://sirv.com where i send them usdz and they return me glb files to my supabase. But I don't want to pay them $20/mo to do this for my hobby project.

What is the correct way to do this? I'm surprised its so difficult. I'll look into usd2gltf but also this library looks promising so I hope you'd consider adding support.

MadeByDouglas avatar Aug 30 '25 05:08 MadeByDouglas

I also have this same need. I create models from images in realityKit on my swift app, but then I want to embed them in web pages for easy 3D preview, and that seems only possible with .glb not .usdz (in browser support, not AR quick look previews) but I'm at a loss how to convert from apple's ecosystem to .glb. What I've ended up doing is having a server pipeline using https://sirv.com where i send them usdz and they return me glb files to my supabase. But I don't want to pay them $20/mo to do this for my hobby project.

What is the correct way to do this? I'm surprised its so difficult. I'll look into usd2gltf but also this library looks promising so I hope you'd consider adding support.

😏 It turned out to be harder than I expected. Finally got it solved with realityKit+Assimp

thomas-hut avatar Aug 30 '25 06:08 thomas-hut

@thomas-hut can you elaborate on that? what was the process of getting this setup via Assimp?

lanxinger avatar Sep 01 '25 15:09 lanxinger

@thomas-hut can you elaborate on that? what was the process of getting this setup via Assimp?

Basically transfer USDZ to OBJ using RealityKit or SceneKit, then using Assimp transfer from OBJ to glb.

Good Luck, xD.

thomas-hut avatar Sep 03 '25 08:09 thomas-hut

got it. so it's via an intermediate (obj). the assimp library is quite heavy to hesitating to include the whole library in a project vs just doing this via a web service conversion for now. currently using the Adobe USD tools for this running in a docker. but I agree that it would be great to have export in this library so we can do a native export on device. then again I understand that is a bit of an engineering effort.

lanxinger avatar Sep 03 '25 09:09 lanxinger

agreed, I ended up just deploying this to fly.io https://github.com/mikelyndon/usd2gltf but native without needing all of assimp and the steps would be great.

MadeByDouglas avatar Sep 03 '25 12:09 MadeByDouglas