Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate Armature from Animation #137

Closed
devshgraphicsprogramming opened this issue Aug 18, 2018 · 6 comments
Closed

Separate Armature from Animation #137

devshgraphicsprogramming opened this issue Aug 18, 2018 · 6 comments

Comments

@devshgraphicsprogramming
Copy link
Collaborator

CFinalBoneHierarchy right now unifies two aspects of skinned animation which can be quite orthogonal to each other, the armature and the animation keyframes.

It would be good to split CFinalBoneHierarchy into asset::IArmature and asset::IAnimationKeyframes, naturally the keyframes would need to refer to an armature (same keyframes don't make sense with different armature).

@devshgraphicsprogramming
Copy link
Collaborator Author

Refer to the glTF overview
https://raw.githubusercontent.com/KhronosGroup/glTF/master/specification/2.0/figures/gltfOverview-2.0.0a.png

Armature (Skelet) is refered to as Skin, and Animation are the keyframes.

@devshgraphicsprogramming
Copy link
Collaborator Author

We should probably add a asset::IArmatureMap that would map one armature onto another as a kind-of "animation adapter" (i.e. mapping from a skeleton with finger bones to a skeleton without fingers).

@devshgraphicsprogramming
Copy link
Collaborator Author

We need to think about the animation keyframe data layout in memory due to #97

@devshgraphicsprogramming
Copy link
Collaborator Author

CFinalBoneHierarchy has a circular dependency on ICPUSkinnedMesh mostly due to joint and keyframe struct definitions.

@devshgraphicsprogramming
Copy link
Collaborator Author

Armatures need bones with global UUIDs and keyframes can be separate per-bone.

template<class BufferType>
class IAnimationKeyframes
{
   public:
      struct alignas(4) AnimationData
      {
         uint32_t keyframeCount;
         uint32_t reserved; // the `keyframe.offset` should be here in the IGPUAnimationKeyframes
         float timestamps[1]; // actually an unbounded array
      };
      struct alignas(4) Keyframe
      {
         uint16_t rotation[3]; // in EF_R16G16B16_SNORM (yes I know format does not exist)
         uint16_t scale[3]; // in EF_R16G16B16_SFLOAT (yes I know format does not exist)
         float translation[3];
      };
   private:
      SBufferOffset<BufferType> animationdata;
      SBufferOffset<BufferType> keyframes;
};

class ICPUAnimationKeyframes : public IAnimationKeyframes<ICPUBuffer>
{
};
class IGPUAnimationKeyframes : public asset::IAnimationKeyframes<IGPUBuffer>
{
};

Then IGPUAnimationKeyframes::animationdata.offset can be used as a UUID for the input per object/node/instance data as outlined in #303

The asset::IArmature and asset::IArmatureMap objects are still to be determined.

@devshgraphicsprogramming
Copy link
Collaborator Author

Figured out how to do it and allow for blends

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant