Just opened up work that I’ve been doing on Gltf here.
What is glTF?
The GL Transmission Format (glTF) is a runtime asset delivery format for GL APIs: WebGL, OpenGL ES, and OpenGL. glTF bridges the gap between 3D content creation tools and modern GL applications by providing an efficient, extensible, interoperable format for the transmission and loading of 3D content. You can see the spec and other information about it here.
What does Cinder get?
To get glTF off the ground we needed a few things, which you’ll find in the block.
A parser (
gltf::File) and a set of new types that represent the different concepts contained in the spec, which can all be found in Types.h.
A new geom, which I’m calling the
gltf::MeshLoader. This object takes a
gltf::Mesh*and creates the geometry similar to
ObjLoader. It acts exactly the same as any other geom. For instance, some objects have multiple meshes. And as you’ll see in this example combining multiple meshes into a single mesh is quite simple.
A way to represent key framed animation, which can be found here as
A representation of Skeleton, which can be found here, and SkeletalAnimation, which can be found here, and just for good measure a fast way to render the joints for debug purposes, which can be found here.
Also, two of the current extensions are also taken care of, i.e.
khr_materials_commonand we’ll be tackling the quantization extension and the forthcoming PBR extension as soon as it’s merged as well.
What doesn’t Cinder get (at least for now)?
A question that will probably come up, as I brought it up multiple times, is “What about a node renderer?” That’s a tough one. I personally would love to see
ci::Node sometime soon, however that opens up a can of worms that Cinder is not prepared to open quite yet. But getting a good Transmission Format into Cinder is certainly the best first step. Also, the absence of a scene graph doesn’t preclude you from easily representing your scene in Cinder. From the example above with combining multiple meshes, you could easily bake the
gltf::Node model matrix with the mesh by either using the
operator<< on geom or storing the model matrix alongside. There’s also not a clear way to use the
gltf::Shader's at least for now. I’ve provided a lot of useful helpers for those things but as far as creating a
gl::Batch out of that stuff, it will be forthcoming.
@chaoticbob has been doing some great work on getting geometry directly from Maya and C4D to Cinder. Right now his work exports to the Trimesh I/O format. We’ll be working together to push that into glTF ASAP. On the main page of glTF (link above), you can find a number of different utilities that convert formats like collada and fbx to glTF, which will also be very helpful here at the start. There is also one problem that we’re trying to work out with the folks at khronos about animation representation and collada to glTF that you can find here.
Anyways, I hope this excites you as much as it does me. Let me know if anything doesn’t work as you’d expect it and I’d love any PR’s, suggestions or issues that you come across.
Obligatory Rubber Ducky: