Jump to content

Skinned Animation in Vulkan


Josh

6,098 views

 Share

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.

  • Like 3
 Share

5 Comments


Recommended Comments

I'm not sure if it's an animator decision or something with the engine but the neck seems to stretch and head stays in place during the right-arm attack starting at 5 seconds.  In contrast, the left-arm attack at 13 seconds seems much more fluid and the head moves down with the body.

Link to comment
Quote

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.

I feel like this was already discussed but I forgot. Can you still move bones in script? How can you do procedural animation if bones aren't entities?

Link to comment
19 hours ago, Genebris said:

I feel like this was already discussed but I forgot. Can you still move bones in script? How can you do procedural animation if bones aren't entities?

They still have a position and rotation, they just don’t have all the extra features of the entity class.

  • Like 1
Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...