Skip to content

Instantly share code, notes, and snippets.

@mikolalysenko
Created March 4, 2013 20:24
Show Gist options
  • Save mikolalysenko/5085308 to your computer and use it in GitHub Desktop.
Save mikolalysenko/5085308 to your computer and use it in GitHub Desktop.
Skeletal animation in JavaScript

Here is a sketch of how one might go about doing skeletal animation in JavaScript, broken down into different npm modules that would need to be written:

  • A BVH to JSON converter.
    BVH is a standard format for representing skeletal animation, there is tons of data in the format, and many tools can consume/produce it. So getting things working in this space is priority #1. I think the best way to tackle this problem would be to write a simple module that takes a stream, and produce a JSON object that exactly represents the HIERARCHY and MOTION sections of a BVH file, along with some serialize method that can produce the same output.
  • A simple animation viewer. Outside voxel.js, we should probably have a stick figure animation viewer. this could be done in THREE.js using wires to draw each of the joints.
  • A motion tweening module Or basically some method to interpolate between per-frame motions. This is necessary to perform basic animation playback
  • Motion retargetting Need some library where you can give it a skeleton + motion data and a new skeleton along with some correspondence between the old skeleton and new skeleton; and produces a new set of motion data. This could be used to remove unnecessary bones from motion data, or to retarget human bvh data to voxel.js models.
  • Voxel.js rendering Finally, the code needs to be integrated into voxel.js' character animation and rendering system

Above and beyond the above, there are other cool libraries/features that could be added on top of this:

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