Jump to content

What is the best practice for multiple animations on a skinned character?


Recommended Posts

That is not the only way, though it might be the most practical way given the capabilities of exporters.  The other way, if you are using skeletons / bones would be to put each in it own BABYLON.Animation, inside of the animations ARRAY of each Bone.  


It is not surprising that very few people know this. Exporters dump everything in animations[0] & Fileloader.parseSkeleton() will only load the first, if there was more than 1.  


I have just coded a MORPH.SkeletonInterpolator as a subclass of POV.BeforeRenderer.  This subclass will process MORH.SkeletalDeformation objects in it's event queue. SkeletalDeformations are a subclass of POV.MotionEvent, so they can actually incrementally move and rotate as the skeleton deforms, not just 'walk in place'.  This is not a frame by frame replay system, so an animation could be expressed in as little as 2 poses.  Walking probably 4, not 20.  Not sure if it too late to mark a skeleton dirty in a before render or not.  It has not been tested yet.  May have to switch to an after render.


The other great thing about an animations ARRAY for a bone that no one has a clue about:   Having a reference skeleton for copying the animations from.  Every time you wish have a rig do a common task like walking, you have to do all phases, even though someone less might have already done it.  


BabylonJS sorely needs a common humanoid skeleton.  Unity has one.  Right now for a MakeHuman runtime I am developing, 2 rigs are being looked at.  I am not the expert in this area, so others are advising.  The really good part is the new MHX2 importer for Blender is it creates the same shape keys I used in my speech testing, so the MH_runtime looks like it will be able to talk too.

Link to comment
Share on other sites

Yes, there is an extension called MORPH.  It used a Mesh subclass, that the Tower of Babel exporter for Blender referenced if it found Blender shape keys.  There was an experiment to see if meshes could talk, using a hand built head by Gryff.  The tool is here: https://googledrive.com/host/0B6-s6ZjHyEwUSDVBUGpHOXdtbHc/ 


It was not perfect, but it quickly became obvious that unless a supply of bodies could be found that already had the mouth shape keys, speech could not be a "real" project.  Make Human was coming out with a new version, 1.1, that looked like it would work, but it was not ready in December, so the project was mothballed.


In the last week, I have restarted it.  MH 1.1 is not yet production, but we are getting all the shape keys plus extras.  I have fixed the exporter to get shape keys exported when you also have a skeleton.  Have also written a skeleton interpolator in the MORPH extension, so it can run within the same before render as the vertex interpolator for shape keys.  Lots of work still to be done.

Link to comment
Share on other sites

ohh, you're talking about morph targets / blend shapes.  I was actually going to ask about that because I'm experimenting with it now.  My original post was actually about combining armature animation, like a walking animation and a shooting animation together or smoothly transitioning from walking to standing idle

Link to comment
Share on other sites

At first, I thought I would be not "combining animations", but realized we just have a terminology conflict.  In my terminology, the skeletonInterpolator, only works with poses.  It "performs" the animation from the current state to the desired pose.  This is done in the time allotted, with integrated position & rotation changes.


The base extension, POV, is queue based.  You would use that directly is your mesh did not deform with either shape keys or armature.  The MOPRH extension is built on top of POV,  so position & rotation are in addition to deforming.


So, you might have 4 poses that define running.  You can construct an re-usable event series, which groups them.  You could add that event series along with a # of repeats & acceleration to the queue.  If events cause you to want change to a shooting pose, you can queue that series, deleting anything else in the queue if you wish.


As discussed earlier, the poses would be frames of a BABYLON.Animation object inside the BABYLON.Bone.animations[].  I would just be reusing them for a slightly different purpose.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...