Jump to content

Skeleton Animation Blending


root77
 Share

Recommended Posts

Hello. I've been experimenting and enjoying Babylon.JS; thanks for all the hard work on the library.

 

 

I've been trying to blend loaded model bone animations and run into issues.

 

The simplest case would be idle->walk->run loops. This has been mentioned a while back (pre v2) here, here, and here. While you can call custom animations on each bone (ie, arms get one frame set, legs get another), this doesn't help with easing between animations that use the same bone. Another suggestion was storing the combined animations in the model, but that doesn't allow for smooth transitions (or permutes up very quickly)

 

As a learning experiment, I dove into the code. Here's a demo of my results.

 

The babylon.js it references is a hack experiment where I do the following:

1) allow multiple animations per target by not calling stopAnimation(target) on beginAnimation

2) on every call to a scene's animation, pass along a cache

3) on every animation._interpolate() where datatype == Animation.ANIMATIONTYPE_MATRIX, write the matrix to the cache

4) if the animation._interpolate() has a cache hit, invoke the otherwise unused matrixInterpolateFunction() with a factor value to interpolate between the 2 matrix

 

The result plays the animations, mostly. The result is flipped, both in normals and on the z-axis, which I don't understand (my grasp of matrix math is not great).

Most of the work revolved around getting data passed between the otherwise isolated animation instances so they could be aware of the other animation to blend. This hack also doesn't handle an arbitrary number of animations to merge or an easy way to work with them, since calls to stop use the target as the common factor.

 

What is the best way to approach this? Is there something I missed in the library? Or how could I implement this correctly for Babylon.js?

 

Thanks

 

Link to comment
Share on other sites

Your approach appears to be working reasonably well.  We need a function in BJS to blend animations more smoothly - especially for bones transforms.  But I think I'll try and use your "Easing" function on characters I have to build in a week or so.  Again, it appears to be a good first approach.

 

As for the "flipping" of axis' and normals, this depends on the result of exporting from whatever 3D package you built your skeleton and animations in.  Often, it is a result of not freezing your transforms on the bones before you animate, and/or using different binding poses from one animation to another.  But I would start troubleshooting by freezing your transforms on the bones and meshes before you bind to the mesh, and then animate.  That should correct any flipping problems - unless there's something else in your pipeline I'm unaware of.

 

Thanks for this example.  Hopefully I'll apply this to a scene soon, and see what results I find.

 

Cheers,

 

DB

Link to comment
Share on other sites

WOW!  http://www.imdb.com/name/nm0062616/  Check it out!  A friggin' superstar... hangin' out right here with folks like me! 

Holy cow, db!  Nice job!  Thanks for entertaining us!  Unreal.  I'm starstruck!

I once speculated that you were a Hollywood-type superstar just because of where you lived and your mocap experience.  But, I thought I was just kidding.  :o

Welcome to the forum, Root77!  Interesting project you have going.

Wanna see dbawel REALLY blow your mind?  http://www.html5gamedevs.com/topic/3083-spaces-world-parent-pivot-local/page-2#entry63384  ... (and the next 2-50 posts, too).  I'm starting to think dbawel is a cyborg, and a well-programmed one.  ;)

Link to comment
Share on other sites

  • 2 years later...

Jeff, you always measure things.  12 pages here, 2.5 years there.  :)

I got this stuff called Lemon Haze... pretty good-at making one lose total track of time and space.

Ya know, Bohm once talked about time and space... as enfolding.  His example was... put a tiny droplet of ink into a bucket of clear, viscous bison snot.  Put the droplet deep-into the snot with a long eyedropper, and place it near the side of the bucket.  Now put a stirring stick on a drill in the center of the snot bucket, and start stirring/spinning.  The ink droplet will get longer and longer, and eventually disappear, apparently mixed-in with the snot (enfolded).

Now reverse the drill, spin the snot in the opposite direction, and after the SAME amount of rotations, the ink dot will re-appear (unfold), completely unscathed.  Ok, perhaps some MINOR scathing, but nothing Fox-newsworthy.  Bohm claimed that this is how space and time worked, as well.  Neither are what they might appear to be.

How is this information any bit apropos to measuring things?  I have no idea.  I guess I'd have to say... the enfolded ink droplet SEEMS FAR AWAY from its starting point, and appears to no longer have any structure in "the now" Yet, its enfolded portions are in concentric rings right beside each other, and completely sound/intact.  It is only enfolding and perspectives-from-edges... that makes time and space APPEAR to exist at all.

My point is... Bohm had some Lemon Haze when he thought-up this idea.  :)  heh.

Link to comment
Share on other sites

@Wingnut, I tried some of that Lemon Haze, and this is what happened!!!

extraction.gif

Actually, my smoking days have long since passed.  It was just beer, and a whiff of Lemon scented furniture polish.

@dbawel, you now have an example to follow:P.  FYI, the scene to make the GIF is here.  Be sure to size / adjust the character to fit in the window, as well as size the window to the desired GIF size.  Play first to check without checking 'Make GIF' checkbox.  The first frame takes about 10 seconds.

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.

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

Loading...
 Share

  • Recently Browsing   0 members

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