JglTF
JglTF copied to clipboard
Gltf builder example for skinned animations.
I noticed your example for building a gltf from scratch doens't include skinned animations. Is there any reason why not?
The README of the jgltf-model-builder
library carries the note
Note: This library is still subject to change.
One could consider many extensions for the building functionality. Many possibilities here are on the radar. But I always have to allocate enough time to make reasonable progress here.
More specifically: Animations are not very well covered by the gltf-model-builder
library in general (there's an open PR with a minor fix at https://github.com/javagl/JglTF/pull/85 , and I wanted to have a closer look - and create additiona examples for - building animations in that context, but didn't tackle this yet).
Even more specifically: Skinning is difficult. In fact, it's one of the most complex parts of glTF. So I really need to put some thought into how that could be offered on the API side.
How would you specify things like the 'weights', for example?
(Note that the builder itself offers a layer where most of this should already be possible: You can shove arbitrary data as ByteBuffer
objects into the builder and assemble your own accessor/bufferView/buffer
structures. But for a "builder" to deserve its name, there should be a bit more convenience in that on the API level...)
I actually asked about this because I'm working on a thing that requires being able to make animations. I figured out how to use the preexisting stuff to make animations. I'm not working from scratch as I'm making a pure java importer for the valve format .smd which as a standarized easily read format. I managed to create a gltf but it wasn't valid. The issues that came out is exactly what you just fixed.
If I may be bold, when might a version of gltf with #85 might be available on maven repo?
Unknown if I got the actual animations imported correctly so future question may arise after the one fixed by #85 is passed.
As I said, the linked PR was a first attempt of fixing the issues that I noticed when creating animations. I'll have to add more test cases (and this would basically include examples of how to build them with the jgltf-model-builder
- essentially, some sort of "regression/integration test" for that part).
If I may be bold ;-) : Can you try whether #85 fixes the issues and works for you?
I'd hesitate to create a new Maven release "just for that fix". So if you have specific, practical requirements from your attempts to build animations, further updates/extensions might be included in the next release. Otherwise, I'd try to finalize that PR, including test/demo cases, and schedule a release at some point (that might be only a few days, but it's hard to make promises here...)
Fair enough. I'll investigate if it works. I'll let you know if it works.
The fix does works. I can produce gltf that render. My attempts at my converting have been painful. Not sure how much is due to my feeding the data incorrectly and how much not knowing translate the data.
I know your busy do you happen to know anything about the smd format from Valve. That's the one I'm converting.
I don't know anything about the SMD format in particular. From a quick search, it appears to be "one of the bazillions of formats out there". If the goal is rather a conversion of certain types of input models (like SMD) to glTF, then I'd be very careful with recommending someone to write that down on the code level. (The OBJ-to-glTF example in JglTF is a special case, because OBJ is very common, and I already had that Obj library...).
If the goal is a pure conversion from input- to output formats, then
- when trying to do this programmatically, https://assimp.sourceforge.net/lib_html/index.html is usually the first start (there even seem to be Java bindings, via LWJGL - see https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/chapter27/chapter27.html )
- Blender can be used for converting models. A short tutorial showing how to do that is at https://github.com/KhronosGroup/glTF-Tutorials/tree/master/BlenderGltfConverter
However, I'll leave this issue open for a while, until I manage to merge that open PR.
No further actionable items here.