Remove bones per name at load/runtime (kilowatt anim lib)

Hi!

I'm currently playing around with the AnimViewer-sample and like to use composed animation.
The situation is like following:
1. I create my e.g. walk animation (full body animated).
2. I compile the model
3. When loading it in the app, I'd like to say something like splitIntoLowerAndUpperBody, which duplicates the animation sequence and in the first one, it deletes the lowerbody tracks (bones), and in the second one the upperbody tracks.
I would be cool if one could delete the bones per name, like "head" or "neck".

Do you have a basic idea how I should accomplish this?

Thanks!
Chris

PS: Splitting the animation sequences in 3dsmax into lower an upperbody isn't satisfying for me, allthough certainly possible.

jwatte's picture

I think the easiest way to do

I think the easiest way to do that would be to implement feathering per bone, where the blend weight of each bone is specified in an array of weights (as many floats as the number of bones).
Then you could set whatever weights for whatever bones you want, and blend them like crazy!
It wouldn't be terribly hard to do, assuming you know how to program C#, but I don't have the time right now to just do it. It's actually something I'll need myself in the future, too, so at some point I'll probably do it, though.
If you beat me to it, please consider making the changes available under the MIT license (or another compatible license, including public domain) so that everyone can benefit!

Thanks for the reply, it

Thanks for the reply, it sounds reasonable!

Before digging into the code:
How do you suggest to find out what bone name corresponds to the bone index?
Must I do this in the content pipeline? (as there you can exclude bones per name)?
Maybe make a property like a mask array, where people can add bones and when compiling the model, it creates the weight array which can then be used in code?

The coding shouldn't be the problem, and of course I'll inform you as soon as it's done ;)

jwatte's picture

The bone indices are saved in

The bone indices are saved in the bone objects, which hold both name and index.
Look at the SkinnedBone structure:

  //  SkinnedBone contains information needed for each bone in a skinned mesh pose.
  //  This is information that is additional to that of a ModelBone.
  public struct SkinnedBone
  {
    //  The name -- used for linking up later.
    public string     Name;
    //  The inverse of the bind transform of this bone (go from vertex to bone space).
    public Matrix     InverseBindTransform;
    //  Index of this bone in the Model.Bones collection.
    public int        Index;
  }

Thanks!

Thanks!