GLTFUtility - A simple glTF plugin

For far too long I've been annoyed by the lack of glTF 2.0 support in Unity, so I decided to make a plugin on my own.

A few months of loose development later I've checked most of the things I wanted off the list.

GLTFUtility supports meshes with submeshes, up to 8 uv channels, vertex colors, normals, tangents, embedded textures, materials, rigs and animations. And it's easy to set up. Just drop it anywhere in your project and you're ready to go.

Currently only edit-time import is supported, but export and runtime capabilities are on the roadmap as well.

The project is opensource and available on github.

Feedback, contributions and requests all welcome.

22 Likes

Just discovered rencently about GLTF and also found https://github.com/KhronosGroup/UnityGLTF from the Khronos Group itself, so was curious about what's GLTFUtility capable vs the UnityGLTF one. No hostilty, just asking.

The key differences lie in their complexity and features. While UnityGLTF boasts more features, it seems like an extremely messy project, and having to compile a DLL for it to work makes it inaccessible to most of the people who actually need it.

GLTFUtility is built with simplicity as the main focus, uses no external libraries, and is easy to navigate for potential contributors. It's plug and play.

10 Likes

Hi!

How would one go about actually configuring a model in Unity using the GLTFUtility?|
What I mean is, setting up all the animation clips like I would with a .blend or .fbx, setting up colliders, changing the rig to humanoid etc. Also extracting the embedded materials out of the file into the project so I can change to a custom shader etc.

All I get is a model I can drag into the scene with no configuration options.

When will you support BlendShapes/vertex animation?

The UnityGLTF seems like a HUGE mess, with a lot of stuff that is completely useless for an average user that just wants to import a model into Unity and set it up, with a ton of weird server stuff that I have absolutely no use for.

Cheers!

1 Like

Hey,

Sorry for the lack of reply.
What you mentioned is on the roadmap, but this plugin is developed entirely out of personal interest, so there is no saying when certain features arrive.

Hi, I'm pretty sure I just emailed you also...Anyway, I'm wondering when (or if) runtime imports for GLTF will be added?

I think it might work already, actually. Try experimenting with something like this

GLTFObject gltfObject = GLTFObject.Load(filepath);
GameObject[] roots = gltfObject.Create();

Thanks, I'll try it. So how do you use this in the Editor? I don't see any new menu's and the documentation is sparce.
The gltfObject.Load takes 2 arguments, not 1. Should this work?

gltfObject.Load("C:\Users\stephen\AppData\LocalLow\BuilderWorldVR\BuilderWorldVR\unzip\SkyCastle", "scene.gltf") ;

where scene.gltf is a file within the SkyCastle folder.

When I try the above, it's showing an error. It would be good to include a sample!

4878689--470726--upload_2019-8-20_19-48-44.png

4878692--470729--upload_2019-8-20_19-50-9.png

Please update GLTFUtility to latest version and try again.

Hmm, did you make a change? I just downloaded this a couple days ago, and GitHub says that last commit was 12 days ago. Unless I'm mistaken, I do have the latest version.

Hey could you try testing with the 2 attached GLTF files? Both of these are from Sketchfab (both are creative commons license, but I don't have the authors handy to give proper credit)

Both of these I can open using the "Sketchfab for Unity" asset and they work fine. Both fail with errors when I use UniGLTF-1.28. I was curious to see if they worked with your asset.

I need runtime GLTF loading, and I can't use "Sketchfab for Unity" because it seems coded so that when you load a GLTF file, it imports the file and creates a prefab. I'm pretty certain a prefab can only be created in the Editor, and not in a standalone application. But it's also really slow because if the GLTF has 100 pieces within it (meshes or whatever) then Unity takes its sweet time doing the import for all of these.

So "Sketchfab for Unity" seems to lack a simple method that lets you load a GLTF and return a Unity Game Object. That's what I need.

I'm not sure if UnityGLTF has this (the Khronos asset), but getting it working is a nightmare. As others have mentioned, it's a mess! I spent a whole day messing with it.

Regarding UniGLTF-1.28, when it works, it works quite well, and I'm pleased with how quickly it can create a GameObject. The only problem is that, as I pointed out above, I see errors with some of the files I have tried. I wanted to try out your asset to see if it works better than UniGLTF

4881638--471197--MedievalFantasyBook.zip (1.67 MB)
4881638--471200--R2-D2.zip (1.53 MB)

Also, can you explain how to use your asset in the Editor? I was expecting a new menu that could be used to import files, but I don't see anything. thanks!

I made a few changes regarding runtime loading, yes. Loading only takes a single parameter now. If yours takes two parameters, you got the wrong version.

I can’t test your files till next week

In the editor, the asset should do what it does automatically. Put the gltf/glb files in your assets folder and it will be imported as if it were an fbx or obj. This works for all of the official example files. If it doesn’t work for yours, then I got some work to do

1 Like

Does this project supports runtime loading of GLTF from remote url?

[quote=“danilo-defilippis”, post:15, topic: 737870]
Does this project supports runtime loading of GLTF from remote url?
[/quote]
Not yet. It focuses on local files.

Great work on this so far! Is runtime import from a remote URL prioritized on your roadmap?

Our team is evaluating the various gltf runtime importers that are available right now that support animation. Our plan is to use the Sketchfab API to download models and then use GLTFUtility to import the gltf models.

Our team is working on a mobile AR app, and this is one of our most important features to implement. So if you’re already working on it, we would rather work with GLTFUtiltiy since it’s open-source and written well instead of the alternatives.

Remote import is definitely on the roadmap, but right now i’m working on switching the serialization out with Json.NET which will enable exports.

HOWEVER, if the sketchfab API allows .glb files, you could maybe feed that binary data directly into GLTFUtility without too much modification. Would this be an option for you?

1 Like

Sketchfab only supports downloading models in the standard .gltf format in a .zip archive. It would be pretty awesome if there was also a .glb file for simple downloading and use at runtime, but that’s not something they plan on supporting.

.glb support is also important though! We could instead download the .gltf on our web server and convert it to .glb format there, and then download the .glb formatted file during mobile runtime. That would basically do the same thing.

So yeah, downloading and using a .glb would also be a good way to go. Is this something you’ll need to add to GLTFUtility or is it already possible?

As a side question, does GLTFUtility support animations for the .glb format?

It is not already possible, although it could probably be done with slight modifications. Loading .glb with raw data input will probably come before remote .gltf does.

And yeah, animations are supported for both formats already.