Ozz-Animation in Defold

I have been working on animations systems recently (in work and in my flix project) and I really wanted some runtime capability that is complicated in Defold atm (doable, but complicated).

I decided to look at Ozz Animation (since I had been doing this for my work) and see if I could integrate it into Defold as an extension. And viola!

Initial pass is done. It requires ozz animation files atm, but it will natively load gltf in a few days (maybe a week). The main features I need:

  • runtime load/unload
  • IK capabilities for feet on terrain and hands handling items
  • Blendtrees for being able to configure a state machine to react to events and properties

Ozz Animation has much of this capability built-in, so I should be able to get these working fairly quickly.

Will update here and on Flix about the progress. Repo is here - all MIT… use as youd like.

17 Likes

Interesting! What tools can export ozz files?

There are cli tools that should be in the repo ozz-animation/tools which does gltf to ozz (will add them if they arent there).
Works the same as the fbx2ozz (which I will add as well):
https://guillaumeblanc.github.io/ozz-animation/documentation/toolset/
Note: these are windows cli tools. I’ll add OSX and Linux too.

This is only interim though. I wanted to make sure I could actually apply the animation first :slight_smile:
The ozz format will disappear in the next few days and gltf/glb will be the main format.

Word of warning: I wouldnt use this in its current state for product. Theres a number of core issues that need resolving:

  1. Performance. Like Defold its all CPU atm. The skinning will move to GPU and I will also move the animation and instancing there too. Want to have hundreds of anim obj in a scene :slight_smile:
  2. Structure/Org is very rudimentary. It will evolve - I have some plans for caching and various other features, this is a very first step along this process.
  3. Tools - currently I dont want people using cli tools, because its just a pain. So it is interim as well. Which I hope to have resolved first. I probably will keep ozz anim loading support (since the file sizes are quite small) but the intent is to have gltf as main loader. FBX wont be supported natively. Its a horrible format with a SDK that is a pain, and its not worth the hassle.
  4. Materials are fixed std model materials. This will change. I will support this always tho, since its a default form of Defold rendering.

I might also support a custom pipeline down the track too. Since ozz-lib has quite a good support for this.

5 Likes

Little update: Still working on this. Got side tracked and rebuilding my scripted geometry lib into a runtime gltf loader and geometry native extension. I need this, so the animation is faster to load and I can fetch directly from a gltf/glb.

I was going to do this in steps, now the gltf loader and anim loading will be built into one - seems to be more sensible :slight_smile: The gltf loader will be built _without ozz anim in it, but it will build a go hierarchy (just like default Defold) that can be used at runtime (no skinning of course).

The defold-ozz-animation extension will be the gltf extension + all the ozz-animation extension together. People wanting to use models and objects themselves at runtime (load/unload etc) can basically just use the gltf plugin by itself.
https://github.com/dlannan/defold-gltf - Warning: Under construction. Will be a few days to finalize this.

5 Likes