# Gltf: Initial Release (WIP)

**URL:** <https://discourse.libcinder.org/t/gltf-initial-release-wip/212>\
**Category:** CinderBlocks\
**Created:** [August 8, 2016, 3:37pm UTC](https://discourse.libcinder.org/t/gltf-initial-release-wip/212 "2016-08-08T15:37:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanbartley](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/ryanbartley/32/5_2.png) [@ryanbartley](https://discourse.libcinder.org/u/ryanbartley)\
**Post date:** [August 8, 2016, 3:37pm UTC](https://discourse.libcinder.org/t/gltf-initial-release-wip/212/1 "2016-08-08T15:37:00Z")

</div>

Hey Everyone,

Just opened up work that I’ve been doing on Gltf [here](https://github.com/ryanbartley/gltf).

**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](https://github.com/KhronosGroup/glTF).

**What does Cinder get?**

To get glTF off the ground we needed a few things, which you’ll find in the block.

1. 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](https://github.com/ryanbartley/gltf/blob/master/src/cinder/gltf/Types.h).

2. 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](https://github.com/ryanbartley/gltf/blob/master/samples/SkeletalAnimation/src/SkeletalAnimationApp.cpp#L83) combining multiple meshes into a single mesh is quite simple.

3. A way to represent key framed animation, which can be found [here](https://github.com/ryanbartley/gltf/blob/master/src/cinder/Animation.h) as `ci::Clip`.

4. A representation of Skeleton, which can be found [here](https://github.com/ryanbartley/gltf/blob/master/src/cinder/Skeleton.h#L17), and SkeletalAnimation, which can be found [here](https://github.com/ryanbartley/gltf/blob/master/src/cinder/Skeleton.h#L105), and just for good measure a fast way to render the joints for debug purposes, which can be found [here](https://github.com/ryanbartley/gltf/blob/master/src/cinder/Skeleton.h#L197).

5. Also, two of the current extensions are also taken care of, i.e. [`khr_binary_gltf`](https://github.com/KhronosGroup/glTF/blob/master/extensions/Khronos/KHR_binary_glTF/README.md) and [`khr_materials_common`](https://github.com/KhronosGroup/glTF/tree/master/extensions/Khronos/KHR_materials_common) and 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::Technique`'s `gltf::Material`'s and `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.

**Future**

@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](https://github.com/KhronosGroup/glTF/issues/580).

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.

Thanks,  
Ryan

Obligatory Rubber Ducky:

 ![](https://canada1.discourse-cdn.com/flex030/uploads/libcinder/original/1X/a61a02bdc2c777e8fe3b72efd2e30fd35a25d982.png)

---

<div class="post-metadata">

**Author:** ![rich.e](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/rich.e/32/1025_2.png) [@rich.e](https://discourse.libcinder.org/u/rich.e)\
**Post date:** [August 9, 2016, 4:11pm UTC](https://discourse.libcinder.org/t/gltf-initial-release-wip/212/2 "2016-08-09T16:11:24Z")

</div>

Sweeet. I know this has been a long time coming, so great to see an initial release, congrats Ryan!

Really looking forward to having a tool where artists can export their scenes directly from within Maya or C4D and we can import them, this will be huge for collaboration.

cheers,  
Rich

---

<div class="post-metadata">

**Author:** ![eight\_io](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/eight_io/32/57_2.png) [@eight\_io](https://discourse.libcinder.org/u/eight_io)\
**Post date:** [May 16, 2018, 9:15pm UTC](https://discourse.libcinder.org/t/gltf-initial-release-wip/212/3 "2018-05-16T21:15:11Z")

</div>

I have generated gltfs in blender, however when imported into Cinder it produces

```auto
|error | void cinder::app::AppBase::executeLaunch()[137] Uncaught exception, type: std::runtime_error, what : in Json::Value::getMemberNames(), value must be objectValue
libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: in Json::Value::getMemberNames(), value must be objectValue

```

Are there specific ways to produce a compatible gltf?

Thanks.

---

<div class="post-metadata">

**Author:** ![gabor\_papp](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/gabor_papp/32/769_2.png) [@gabor\_papp](https://discourse.libcinder.org/u/gabor_papp)\
**Post date:** [May 17, 2018, 5:01am UTC](https://discourse.libcinder.org/t/gltf-initial-release-wip/212/4 "2018-05-17T05:01:38Z")

</div>

I think Blender is glft 2.0 while this block only supports gltf 1.0.
