root77 Posted May 1, 2015 Share Posted May 1, 2015 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 beginAnimation2) on every call to a scene's animation, pass along a cache3) on every animation._interpolate() where datatype == Animation.ANIMATIONTYPE_MATRIX, write the matrix to the cache4) 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 jerome, adam and Wingnut 3 Quote Link to comment Share on other sites More sharing options...
dbawel Posted May 1, 2015 Share Posted May 1, 2015 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 JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted May 2, 2015 Share Posted May 2, 2015 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. 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. JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted November 10, 2017 Share Posted November 10, 2017 @Wingnut Now if I could only separate my head from my ass.... You're the superstar on this forum, my friend. DB Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 10, 2017 Share Posted November 10, 2017 Could be a risky operation, since you just replied to a 2 1/2 year old topic. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 10, 2017 Share Posted November 10, 2017 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. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted November 11, 2017 Share Posted November 11, 2017 @Wingnut, I tried some of that Lemon Haze, and this is what happened!!! 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. 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. Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.