Skinned Animation in Vulkan
It's been nearly a year since I made the decision to port our OpenGL renderer over to Vulkan, and it has been very difficult work, but we are getting back up to speed. I was able to get skinned animation working for the first time in Vulkan yesterday, using a slightly modified version of our original animation shader code.
The system works exactly the same as in Leadwerks 4, with a few differences:
- Animation features are confined to the Model class only, and are no longer a general Entity feature.
- Bones are no longer an entity. This reduces a lot of overhead when animation is processed. There will be some type of "AttachToBone" method in the entity class you can use to place a weapon in a character's hand.
- The Model class has a new Skeleton member. A skeleton is only present in animated models.
- Skeletons can be shared between models. This allows the engine to process animation once and multiple models can share the skeleton. The models can be instances of the same model, or different models. This is very good for rendering large crowds of enemies. (However, you might not even need to bother with this type of optimization, because 1000 unique skeletons works with no issues, as seen below.)
- Animation is executed on one or more separate threads which makes it very very fast.
- Animated characters are now batched instead of drawn one at a time.
With the OpenGL prototype renderer we saw very good performance with this technique, so it will be interesting to see how Vulkan compares:
I have not added support for GLTF animation loading yet, which will give us a wide variety of ready-to-use animated models.
- 3
5 Comments
Recommended Comments