In this update, we’ve added support for glTF format.
Notes:
We support both .glb and .gltf formats.
We currently only export max one skeleton per file
It supports skinning and animating meshes.
It now supports multiple meshes per model
Currently still uses one material for all meshes in a model
Currently still only support world space vertices for skinned models
Each file should still only contain one animation
Added support for tanget space uv’s
We don’t support:
multifile glTF files (i.e. no external buffers!)
embedded textures (we have our own way of handling textures)
Breaking change
The .animationset file format now requires you to select a skeleton.
This allows us to keep all our internal bone indices optimized.
Note that if you save your files with this editor version, it won’t open in an older editor. It is a single line change in the format though, so it’s easy to revert any changed files.
Near future updates:
Allowing more than one material per model (it’s in design phase)
Model Wishlist
We also have some other useful items on our wishlist for 3D models:
Increased support for material properties (e.g. import PBR settings from .gltf)
Code details:
For the interested, and perhaps future contributors, we’ve created a new modelimporter.jar that we use both in Bob.jar and in the Editor. This plugin will makes easier for us to add new formats using C++ libraries, and then present it through our pipeline. See our internal library modelc for code details.
For the glTf support, we’ve used the same importer as Roblox uses, by Johannes Kuhlmann (Twitter: @j66k) cgltf.h.
Testing
Collada support
Although we now consider the colada support deprecated, we still need it to function as before.
If you have a project using colada models, then it would be good if you could test it to see that everything still works as expected.
glTF support
Everything should work as before, but we’ve just added another file format.
Note the limitation of only currently only using one material on all the meshes in the model.
Also make note of that the gilt format has Y-up, just like Defold, while blender has Z-up. You should click the checkbox in blender when exporting, to fix the rotation.
Tested a few 3d projects that use the collada format and getting some strange results in animations and models without skeleton animations seem to not render in builds , but render in editor just fine. Set the appropriate skeleton property in animationset and results = Blinking / stretching / warping during play. Seems the vertices or vertex weights are not translating correctly. My animated 3d example on github can be used to see the issues I am describing.
Thanks for the info.
I really appreciate the testdata as it seems my own data didn’t catch enough collada issues.
I’m currently travelling so I probably won’t have a fix in the next few days.
Nice!, first time I can import my own model to Defold!
But there some things that maybe I don’t understand.
What failed: Same model converted by Sketfab, it was in two parts .glTF and .bin, is that what external buffers means that it’s not supported?
What works: Exporting from 3ds Max 2022 using Babylon exporter as .glB
Now since I never passed the importing step with .dae I just give up and I have zero experience with 3D in Defold. How I can make the animation work?
On model properties I simply set Skeleton and Animations pointing to the same .glb file. Is that correct?
Then I get the material skinning error that I have no idea how or where to fix.
Simply set a single animation to the animation property.
or
Create an animation set (no need if you only have one animation)
As mentioned above, we currently only support world space skinning (i.e. on the CPU).
To use that, copy the model.material into your project (from the builtins folder), and change
the space property from local to world.
Hehe, wrote the reply before I realised you had already solved it.
I’ll leave my note here though, if it’s helpful for anyone else ^^
I have a single file, a model with animation, so I set as animation property a reference to the same model file and it doesn’t work, or still I need some more step on code?. I don’t see anything to choose from the Default Animation list.
While creating an AnimationSet it works perfectly fine.
Test #2 :
The normals and textures seem to be much nicer. I suspect I was losing normal precision with the conversions being done.
Really good work with the loader. I’ll run some anim and multi object hierarchy stuff through Defender on the weekend. Defender automatically splits up objects into single materials, and so it should make a bunch of gltf files.
I have made Defender have an option to use old or GLTF method on the meshes. This way it still works for current builds as normal. I hope to get a release up on the weekend too.
Really awesome stuff.
< edit > A little extra note. Gltf export also supports tangents and some other fancy features. Will be interesting if we can get that data
Another nice thing. Is I can remove a root transform node that I used to get a model into the same alignment as the Defold coord space. Woot! Consistent coords!!!
Good stuff! Yes the plan is to expose tangent data, but I’ll let Mathias expand on that. We want to support a full PBR workflow so tangents and more texcoord channels will be needed.
I did some more tinkering, and it looks like the editor has some problems with perspective mode when displaying gltf/glb files? If I switch between ortho and persp the object disappears. But it actually doesnt disappear, it just gets extremely small. Then the camera bounds do some weird things.
Not really sure what is happening here. I’ll attach a video to show whats happening.
More tests. Did some hierarchy checks. And looks like its all exports properly (I need to refactor my go and collection transforms). Really looking forward to this feature being a permanent addition
Oh another note. This was using glb and it was surprisingly slow for Defold to ingest these objects. They are not huge polys or complex materials, so its a little puzzling. The largest glb was 338KB. Kinda odd.
Admittedly there are 30 cars and 120 wheels But still… took a few minutes. I expected maybe 20 secs tops?