Skip to content

Animation Improvements #1015

Description

@bjornbytes

There are a few issues with animation (skeletal animation and blend shapes) that could be improved:

  • The animation machinery is tied to Model. You can't animate a Mesh without implementing your own animation system.
  • You can't share animation state between different Model objects right now.
  • Having to clone Models to get different animation states is clunky.

Some ideas for improvements:

  • Add a Skeleton object:
    • It contains:
      • List of joint transforms
      • An inverse bind matrix for each joint
      • Possibly joint names
      • No keyframe/animation info
      • No blend shapes
    • Similar to how Mesh can have a Material attached, it can have a Skeleton attached too, which is used to animate its vertices.
    • There are new builtin vertex attributes you can add, VertexJoint and VertexWeight, used for skinning.
      • (While we're here we might want to make it possible to have multiple vertex buffers on a mesh).
    • Model probably creates a default skeleton, but it can be changed with e.g. Model:setSkeleton.
    • Model:animate continues to exist and sets joint transforms on the Model's skeleton.
  • Add a generic system for animated draws in Pass. Pass probably stores a list of its animated draws, which is like a draw index, a skeleton, and mesh info. It can use this to batch all of the animation dispatches on submit, which provides some opportunities to improve performance / reduce memory usage (pooling, culling, temp buffer data for skinned vertices).
  • For blend shapes, Mesh could probably get a "blend shape count" declared when it's created, and then there could be methods to set data for a given blend shape index and vertex index, along with the weight for each blend shape.

Should this be implemented? Meh. It's kind of a high effort task for medium-level payoff, but it does clean up the animation stuff a lot.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions