New Vulkan glTF examples

Moving to glTF

When I started writing my first Vulkan samples glTF was still in it’s infancy, esp. in terms of tooling. So I went with more common formats and went with the Open Asset importer library (Assimp) for loading these.

But things rapidly changed with glTF 2.0, which is now pretty much and industry standard and supported by many DCC tools. And since both Vulkan and glTF are both Khronos standards this is a perfect match.

So I decided to move away from Assimp, and started updating my Vulkan samples to use glTF instead.

And while Assimp was easy to use and build on Windows and Linux, getting a working library built for Android was always so complicated that I actually never went on to update it for around 3 years now. So the version in the repository was stuck at 3.x, and with people having other versions installed in their systems the library and header mismatch caused more and more problems.

As there’s no need for libraries with glTF thanks to the awesome tinyglTF header-only glTF loader, this will make things a lot easier, esp. in terms of supporting the mobile platforms.

New samples

The first important step for replacing Assimp with glTF was to replace the two samples that explicitly demonstrated loading models and animations via Assimp.

So over the course of the last weeks I replaced two samples with new glTF versions. These are a bit more verbose as they show how to directly interface with the glTF format.

glTF scene rendering

glTF scene

This sample shows how to load a glTF file and how to use the glTF data structures to render a static scene in Vulkan. This includes reading data via glTF accessors, uploading it to the GPU and then rendering the glTF node hierarchy for a scene consisting of multiple meshes.

It replaces the old mesh sample that was using Assimp.

glTF vertex skinning

glTF skinning)

This sample is based on the glTF sample above and adds vertex skinning and animations. It shows what glTF data structures are required to do vertex skinning and animations, and how to use these in Vulkan.

It also comes with an exhaustive tutorial that guides you through the interesting parts.

It replaces the old skeletal animation that was using Assimp.

glTF model loading class

Aside from those samples that explicitly show how to load e.g. a model, all other samples that demonstrate different things instead a model loading class that made it easy to load and draw a model.

Similar to that old model loading class based on Assimp, there is now also a VulkanglTFModel.hpp model loading class that’ll be used to easily load and draw glTF models.

I’m currently expanding and reworking that class in a separate branch to make it an easy, almost drop-in, replacement for the Assimp based model loader.

In that branch I’m also updating all examples to use glTF models instead of the random assortment of different 3D formats that my samples have been using (3DS, OBJ, DAE, etc). I don’t have an ETA on when this will be finished, but I’m making good progress.