GameMonetize Posted March 12, 2018 Share Posted March 12, 2018 Hey team! @MackeyK24 asked for it with so much energy that I spent my entire week end working on a new feature: the animation weights support To learn more about it, please read the doc here: http://doc.babylonjs.com/babylon101/animations#animation-weights A demo can be found here: https://www.babylonjs-playground.com/#IQN716#3 As always, any feedback is welcome! Note: I could have added a third animation to the demo (a run animation) but the model animation for run is a bit bad (it looked like the model was flying). If you have a better model, feel free to let me know Gijs, BitOfGold, Samuel Girardin and 10 others 13 Quote Link to comment Share on other sites More sharing options...
HeadClot Posted March 12, 2018 Share Posted March 12, 2018 Oh nice! This will be really useful for the Unity tool kit Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 12, 2018 Share Posted March 12, 2018 It looks cool, I'll test that soon. So we can made walk a character and play a second animation of shooting for example? Thank you Dk for that. Quote Link to comment Share on other sites More sharing options...
inteja Posted March 12, 2018 Share Posted March 12, 2018 So cool! Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted March 12, 2018 Share Posted March 12, 2018 52 minutes ago, Dad72 said: It looks cool, I'll test that soon. So we can made walk a character and play a second animation of shooting for example? Thank you Dk for that. Yes and no... You can BLEND similar animations like your ground locomotions. This blend ALL the bones and play weighted animations on ALL the bones. Our next setup would be to create some kind of BONE MASKING system we could them implement LAYERS so you play then base animations and blend in the TOP HALF of body masked of and play either a blend or a total weight of 1.0 to top half of body bones. IE ... Walk or running while swinging a sword or shooting weapon. This is how unity does it and how i will capturing the Animation Controller Layers as metadata and not only blend the ground locomotion animation but also apply any LAYER animations that should be running based on the Animation State Machine. Exactly how unity does it. That way you can use the Unity Editor to setup all the animations (or use existing animation controllers from the asset store something). At least that is my goal for the babylon toolkit Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted March 12, 2018 Share Posted March 12, 2018 Very Freakin Kool. Thanks sooooooooooooo much @Deltakosh Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted March 13, 2018 Share Posted March 13, 2018 Yo @Deltakosh I need some advice.... Using the new animation weight system from a Unity Controller Blend Tree... Often each BlendTree may have up to 16 or more BlendTree Branches (The bendable animations that I loop thru calling scene.beginWeightedAnimation). Now that thechnically starts running all 16 or more animations. The first one has a full weight of 1.0 and the other fifteen are at ZERO. Then in the game loop I would loop thru the returned BABYLON.IAnimatable[] array and change each weight according to which ones should actually be contributing a weight GREATER than ZERO. I cant see how that would be no more than 2 or 3 animations out of the 16 that actually get used depending on your input values... Like gamepad stick forward. Should I: A... Just load all 16 or more animations for blending and just live with the performance cost of the dozen or more animations that are not getting used (at least for that update frame check) but actually still playing the animation as far as the engine is concerned. B... Figure out which few of the 16 animations SHOULD be contributing on that frame and if those animations are NOT currently playing... call scene.beginWeightAnimation from that frame update with ONLY the few animations that should be contributing. But this too has a performance cost as well . Especially if the user is doing ALOT of gamepad stick movement. Could be calling beginWeightAnimation every few frames. C... Load all 16 by calling scene.beginWeightedAnimation. Then immediately STOP all of them. Then in the frame update figure out what ones should contribute weight, assign the weights accordingly and then figure out what frame we should be on and then each animatable.goToFrame (so timing still in sync) and finally animatable.restart on the ones that SHOULD be contributing. I dont know about what kind of performance cost constantly STOPPING and RESTART the weighted animations that should be contributing VS Loading them all and just changing the weights on 16 currently blendable playing animations VS constantly scene.beginWeightAnimation with only the few animations that should contribute on that frame. What do you think ??? Do have any other suggestions on how to handle this ??? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 13, 2018 Share Posted March 13, 2018 I would recommend to keep the number of animations to the lowest level possible. You can use stopAnimation(target, name) to hand pick which animations to stop But I have a good news for you: The new version will ignore all animations with weight = 0; So your point A should be fine Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted March 13, 2018 Share Posted March 13, 2018 2 hours ago, Deltakosh said: I would recommend to keep the number of animations to the lowest level possible. You can use stopAnimation(target, name) to hand pick which animations to stop But I have a good news for you: The new version will ignore all animations with weight = 0; So your point A should be fine Sweet... cant wait for the next commit.... Thanks @Deltakosh ... You da man Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted March 13, 2018 Share Posted March 13, 2018 Yo @Deltakosh ... I think the changes were in that last "Impoved Deep Copy" commit... Now I DONT get T-POSE and I have 18 bendable animation tree branches load (but I am only playing IDLE in this screenshot)... But it is only costing me 1MS ... The scene without the animatied character is 1MS .. for a total of 2MS GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted March 14, 2018 Share Posted March 14, 2018 A demo with run animation (we are still working on the timing) : http://playground.babylonjs.com/#K6L9FM#1 JackFalcon 1 Quote Link to comment Share on other sites More sharing options...
HoloLite Posted March 15, 2018 Share Posted March 15, 2018 This is very cool feature. Lots of good stuff going into 3.2 release. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted April 2, 2018 Share Posted April 2, 2018 Yo @Deltakosh and anyone who is interested in Animation Blending. This is my first little demo of my Frame By Frame Animation State Machine. That Supports Animation Blending (Both Blending Speed And Final Composition) Note the Play Blend button with play a Walk Forward animation with a 50% blend of the Left Strafe Walk ... Giving a Diagonal Walk Forward result Clear your browser cache and take a look: http://mackey.cloud/games/tester/ 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.