ozRocker Posted May 17, 2016 Author Share Posted May 17, 2016 For sure @JCPalmer its not like you have a 3D avatar scanner to test everything with if you want to see what I'm trying to do check out my demo in the demo section of this forum. Also, thank you for your hard work! It's helped me make some amazing demos JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted May 17, 2016 Share Posted May 17, 2016 @JCPalmer: Jeff - keep up the good work. I've been impressed with the exporter - particularly the reduction in file size for animated figures. I finally found my "Blue Lady" blend file and ran it through version 4.5.0. File size went from 7.0Mb to 2.7MB. And that animated model had 900+ frames of animation. cheers, gryff JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
adam Posted May 17, 2016 Share Posted May 17, 2016 I changed the way the ratio is computed (used parent lengths) along with JCPalmer's fix: http://www.babylonjs-playground.com/#25M97N#10 The skeleton now looks good, but has shifted downward a bit. gryff 1 Quote Link to comment Share on other sites More sharing options...
adam Posted May 17, 2016 Share Posted May 17, 2016 I added some code to copy the bone's translation if the bone doesn't have a parent and we are rescaling. I'm sure it isn't the best solution, but it works for this case. http://www.babylonjs-playground.com/#25M97N#11 gryff 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted May 17, 2016 Share Posted May 17, 2016 Quote The skeleton now looks good, but has shifted downward a bit. @adam : except the "hip" bone. Quote I added some code to copy the bone's translation if the bone doesn't have a parent and we are rescaling. which does not have a parent. cheers, gryff Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 17, 2016 Share Posted May 17, 2016 great job. I consolidated your logic. If anything is changed, you should not do it to the original in library, cloning. Dropped the parent bone check (might need to go back). Also, switched to the rest pose as source, since it never changes. http://www.babylonjs-playground.com/#25M97N#12 Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 19, 2016 Author Share Posted May 19, 2016 On 17/05/2016 at 3:59 AM, JCPalmer said: great job. I consolidated your logic. If anything is changed, you should not do it to the original in library, cloning. Dropped the parent bone check (might need to go back). Also, switched to the rest pose as source, since it never changes. I'm using this new code here: http://www.babylonjs-playground.com/#25M97N#13 My mesh still gets warped though :/ Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 19, 2016 Share Posted May 19, 2016 Line 71, is defaulting to false Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 19, 2016 Author Share Posted May 19, 2016 20 minutes ago, JCPalmer said: Line 71, is defaulting to false This is line 71 avatar.skeleton.copyAnimationRange(animator.skeleton, "Idle"); I'm not sure which part ends up being false Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 19, 2016 Share Posted May 19, 2016 copyAnimationRange @ the bone level is being defined right above. avatar.skeleton.copyAnimationRange(animator.skeleton, "Idle", true); Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 20, 2016 Author Share Posted May 20, 2016 You are all GENIUSES!! Thank you so much @JCPalmer , @gryff and @adam That code has fixed my problem Fkn outstanding! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 23, 2016 Share Posted May 23, 2016 Ok, now that 2.4 is in Beta, the change to Bone.copyAnimationRange() needs to be PR'ed. I cannot think of what to do about root bone translation here. It would seem to get removed if rescaling is required. Going to ship up #12. Clearly the 2.3 attempt is wrong. BJS's animation system does not support root bone translation, anyway. FYI, right after I got my bone interpolator working, I decided to drop using BABYLON.Animation classes and BABYLON.AnimationRanges for my animation extension, Queued Interpolation. Next to the shape key groups, it was still way too under powered. I instead wrote a pose based system that is time based not frame based, which just ran for the first time. The Queued Interpolation pose libraries are actually exported separately, from the contents of Blender Pose Libraries only. If you are going from a mocap loaded in Blender, you might start by deleting frames, and run using Blenders interpolator to see you picked good frames. Once you got the frames you wish to use for poses, create a pose library & copy all those remaining frames to poses. I am not breaking out the root bone translation & rotation yet, but I want to do this in Python. Here is what is being generated right now for the library above. Not sure I really need to add an internal "rest" pose. That may not be needed. // File generated with Tower of Babel version: 5.0.0 on 05/19/16 var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var PoseLib; (function (PoseLib) { var B = BABYLON; var M = B.Matrix.FromValues; var boneLengths = { "hips":.1589,"thigh.L":.4176,"shin.L":.4362,"foot.L":.1406,"toe.L":.082,"thigh.R":.4176,"shin.R":.4362,"foot.R":.1406,"toe.R":.082,"spine":.0605,"chest":.3452,"clavicle.R":.1699,"upper_arm.R":.252,"forearm.R":.2683,"hand.R":.1221,"thumb.02.R":.0414,"thumb.03.R":.0269,"f_ring.01.R":.0325,"f_index.01.R":.0291,"clavicle.L":.1699,"upper_arm.L":.252,"forearm.L":.2683,"hand.L":.1221,"thumb.02.L":.0414,"thumb.03.L":.0269,"f_ring.01.L":.0325,"f_index.01.L":.0291,"neck":.1096,"head":.1318,"jaw":.1155,"eye.R":.0228,"eye.L":.0228 }; var lib = new QI.SkeletonPoseLibrary("PoseLib", boneLengths); new QI.Pose("rest", lib, { "hips": M(1,0,0,0,0,.9895,.1443,0,0,.1443,-.9895,0,0,.9236,-.003,1), "thigh.L": M(.9938,.0996,.0483,0,.1025,-.9928,-.0612,0,.0419,.0658,-.997,0,.1085,-.0034,-.0113,1), "shin.L": M(1,0,0,0,0,.994,.1094,0,0,-.1094,.994,0,0,.4176,0,1), "foot.L": M(.9993,.0265,.0248,0,.0112,.4262,-.9046,0,-.0345,.9043,.4256,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.8924,-.4511,0,0,.4511,.8925,0,0,.1406,0,1), "thigh.R": M(.9938,-.0996,-.0483,0,-.1025,-.9928,-.0612,0,-.0419,.0658,-.997,0,-.1085,-.0034,-.0113,1), "shin.R": M(1,0,0,0,0,.994,.1094,0,0,-.1094,.994,0,0,.4176,0,1), "foot.R": M(.9993,-.0265,-.0248,0,-.0112,.4262,-.9046,0,.0345,.9043,.4256,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.8925,-.4511,0,0,.4511,.8925,0,0,.1406,0,1), "spine": M(1,0,0,0,0,1,.0011,0,0,-.0011,1,0,0,.1589,0,1), "chest": M(.9997,.0063,-.0235,0,0,.9664,.2572,0,.0243,-.2571,.9661,0,0,.0605,0,1), "clavicle.R": M(.2259,-.2535,-.9406,0,-.9637,-.1994,-.1777,0,-.1425,.9466,-.2893,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.1477,.6279,.7641,0,-.0328,.7691,-.6383,0,-.9885,-.1193,-.093,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.6817,.7316,0,0,-.7316,.6817,0,0,.252,0,1), "hand.R": M(.054,-.036,.9979,0,-.3306,.9423,.0519,0,-.9422,-.3327,.039,0,0,.2683,0,1), "thumb.02.R": M(-.0533,-.3797,.9236,0,.4161,.8323,.3662,0,-.9077,.4038,.1137,0,.0414,.0622,.0251,1), "thumb.03.R": M(.9998,-.0064,-.0199,0,.0078,.9973,.0726,0,.0194,-.0728,.9972,0,0,.0414,0,1), "f_ring.01.R": M(.9555,.2835,-.0817,0,-.2906,.9521,-.0954,0,.0507,.1149,.9921,0,-.0231,.1027,-.0143,1), "f_index.01.R": M(.9143,-.1338,.3823,0,.1352,.9905,.0233,0,-.3818,.0304,.9238,0,.0266,.112,-.008,1), "clavicle.L": M(.2259,.2535,.9406,0,.9637,-.1994,-.1777,0,.1425,.9466,-.2893,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.1477,-.6279,-.7641,0,.0328,.7691,-.6383,0,.9885,-.1193,-.093,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.6817,.7316,0,0,-.7316,.6817,0,0,.252,0,1), "hand.L": M(.054,.036,-.9979,0,.3306,.9423,.0519,0,.9422,-.3327,.039,0,0,.2683,0,1), "thumb.02.L": M(-.0532,.3797,-.9236,0,-.4161,.8323,.3662,0,.9077,.4038,.1137,0,-.0414,.0622,.0251,1), "thumb.03.L": M(.9998,.0064,.0199,0,-.0078,.9973,.0726,0,-.0194,-.0728,.9972,0,0,.0414,0,1), "f_ring.01.L": M(.9555,-.2835,.0817,0,.2906,.9521,-.0954,0,-.0507,.1149,.9921,0,.0231,.1027,-.0143,1), "f_index.01.L": M(.9143,.1338,-.3823,0,-.1352,.9905,.0233,0,.3818,.0304,.9238,0,-.0266,.112,-.008,1), "neck": M(1,0,0,0,0,.9814,-.1919,0,0,.1919,.9814,0,0,.3452,0,1), "head": M(1,0,0,0,0,.9955,.0951,0,0,-.0951,.9955,0,0,.1096,0,1), "jaw": M(1,0,0,0,0,-.6887,.7251,0,0,-.7251,-.6887,0,0,-.0035,.0557,1), "eye.R": M(.7612,-.6473,.0389,0,-.0854,-.0407,.9955,0,-.6428,-.7611,-.0863,0,-.0295,.0307,.123,1), "eye.L": M(.7612,.6473,-.0389,0,.0854,-.0407,.9955,0,.6428,-.7611,-.0863,0,.0295,.0307,.123,1) }); new QI.Pose("headLeft", lib, { "neck": M(.6885,-.0839,-.7204,0,-.0552,.9843,-.1674,0,.7232,.155,.6731,0,0,.3452,0,1) }); new QI.Pose("headBack", lib, { "neck": M(.984,-.0516,.1704,0,.1729,.5057,-.8452,0,-.0425,.8612,.5065,0,0,.3452,0,1) }); new QI.Pose("headForward", lib, { "neck": M(.9904,.1194,-.0703,0,-.0766,.8948,.4398,0,.1155,-.4301,.8954,0,0,.3452,0,1) }); new QI.Pose("headRight", lib, { "neck": M(.6352,.0908,.767,0,.0603,.9842,-.1665,0,-.77,.152,.6197,0,0,.3452,0,1) }); new QI.Pose("walk@7", lib, { "hips": M(.9865,.093,.1349,0,-.0985,.9945,.0352,0,.1309,.048,-.9902,0,0,.874,-.0058,1), "thigh.L": M(.99,-.1353,.039,0,-.0982,-.8618,-.4976,0,.1009,.4888,-.8665,0,.1085,-.0034,-.0113,1), "foot.L": M(.9966,-.0827,-.0011,0,.0285,.3563,-.934,0,.0777,.9307,.3574,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.9774,-.2113,0,0,.2113,.9774,0,0,.1406,0,1), "thigh.R": M(.9881,-.1387,-.0669,0,-.0491,-.6957,.7167,0,-.146,-.7049,-.6942,0,-.1085,-.0034,-.0113,1), "shin.R": M(.9998,.0102,-.0158,0,0,.8399,.5427,0,.0189,-.5426,.8398,0,0,.4176,0,1), "foot.R": M(.9732,.1552,-.1699,0,-.1917,.138,-.9717,0,-.1274,.9782,.164,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.7785,-.6276,0,0,.6276,.7785,0,0,.1406,0,1), "spine": M(.995,-.0936,.034,0,.094,.9955,-.0119,0,-.0327,.015,.9994,0,0,.1589,0,1), "clavicle.R": M(.3614,-.233,-.9029,0,-.9324,-.0877,-.3506,0,.0025,.9685,-.2489,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.2685,.9602,.0766,0,.7296,.2547,-.6347,0,-.629,-.1145,-.7689,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.8479,.5301,0,0,-.5301,.8479,0,0,.252,0,1), "hand.R": M(-.1398,-.0497,.9889,0,-.1501,.9883,.0284,0,-.9787,-.1444,-.1456,0,0,.2683,0,1), "clavicle.L": M(.1787,.3343,.9254,0,.9832,-.0247,-.1809,0,-.0377,.9422,-.3331,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.9048,-.34,-.2565,0,.1524,.3041,-.9404,0,.3977,-.8899,-.2233,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.4918,.8707,0,0,-.8707,.4918,0,0,.252,0,1), "hand.L": M(.1304,.1442,-.9809,0,.0382,.9879,.1503,0,.9907,-.0571,.1233,0,0,.2683,0,1), "neck": M(.9955,.0162,.093,0,-.0064,.9945,-.1041,0,-.0942,.103,.9902,0,0,.3452,0,1), "head": M(1,-.0064,-.0003,0,.0064,.9839,.1787,0,-.0009,-.1787,.9839,0,0,.1096,0,1) }); new QI.Pose("walk@11", lib, { "hips": M(.9878,.0786,.1344,0,-.0783,.9969,-.0076,0,.1346,.003,-.9909,0,0,.8685,-.007,1), "thigh.L": M(.9908,-.1118,.0756,0,-.0456,-.8045,-.5922,0,.127,.5833,-.8023,0,.1085,-.0034,-.0113,1), "foot.L": M(.9765,-.071,.2035,0,.194,.7012,-.6861,0,-.094,.7094,.6985,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.8127,-.5827,0,0,.5827,.8127,0,0,.1406,0,1), "thigh.R": M(.9937,-.091,-.0656,0,-.0059,-.6261,.7797,0,-.1121,-.7744,-.6227,0,-.1085,-.0034,-.0113,1), "shin.R": M(.9998,.0157,-.0104,0,0,.5535,.8328,0,.0189,-.8327,.5534,0,0,.4176,0,1), "foot.R": M(.9847,.136,-.109,0,-.1453,.2955,-.9442,0,-.0962,.9456,.3107,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.9008,-.4342,0,0,.4342,.9008,0,0,.1406,0,1), "spine": M(.9993,-.0338,.0174,0,.0329,.9984,.0462,0,-.019,-.0456,.9988,0,0,.1589,0,1), "clavicle.R": M(.3614,-.233,-.9029,0,-.9324,-.0877,-.3506,0,.0025,.9685,-.2489,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.2735,.9526,.1333,0,.7211,.2948,-.627,0,-.6366,-.0753,-.7675,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.8477,.5304,0,0,-.5304,.8477,0,0,.252,0,1), "hand.R": M(-.1877,-.0567,.9806,0,-.1501,.9883,.0284,0,-.9707,-.1418,-.194,0,0,.2683,0,1), "clavicle.L": M(.1787,.3343,.9254,0,.9832,-.0247,-.1809,0,-.0377,.9422,-.3331,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.8811,-.4587,-.115,0,-.0441,.3217,-.9458,0,.4708,-.8283,-.3037,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.5836,.812,0,0,-.812,.5836,0,0,.252,0,1), "hand.L": M(.0729,.1252,-.9895,0,.0395,.991,.1283,0,.9966,-.0484,.0672,0,0,.2683,0,1), "neck": M(.9966,-.0142,.0812,0,.0337,.9692,-.2441,0,-.0752,.246,.9663,0,0,.3452,0,1), "head": M(1,-.007,.0043,0,.0062,.9851,.1721,0,-.0054,-.1721,.9851,0,0,.1096,0,1) }); new QI.Pose("walk@18", lib, { "hips": M(.998,.0089,.062,0,-.0087,1,-.0027,0,.062,-.0022,-.9981,0,0,.934,.0018,1), "thigh.L": M(.9968,.0072,-.0797,0,.0212,-.9841,.1765,0,-.0772,-.1777,-.9811,0,.1085,-.0034,-.0113,1), "shin.L": M(.9998,-.018,.0086,0,0,.4311,.9023,0,-.02,-.9021,.431,0,0,.4176,0,1), "foot.L": M(.9918,-.0478,.1184,0,.1269,.2645,-.956,0,.0144,.9632,.2684,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.7008,-.7134,0,0,.7134,.7008,0,0,.1406,0,1), "thigh.R": M(.9949,.0742,-.0688,0,.0965,-.8997,.4257,0,-.0304,-.4302,-.9022,0,-.1085,-.0034,-.0113,1), "shin.R": M(.9998,.0141,-.0126,0,0,.6668,.7453,0,.0189,-.7451,.6667,0,0,.4176,0,1), "foot.R": M(.996,.0876,.0193,0,.0097,.1086,-.994,0,-.0891,.9902,.1073,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.9373,-.3485,0,0,.3485,.9373,0,0,.1406,0,1), "spine": M(.9986,.0515,-.008,0,-.0514,.9986,.0131,0,.0087,-.0127,.9999,0,0,.1589,0,1), "clavicle.R": M(.242,-.2513,-.9372,0,-.9703,-.0573,-.2352,0,.0054,.9662,-.2577,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.4694,.8778,.0958,0,.4795,.3444,-.8071,0,-.7415,-.333,-.5825,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.7412,.6713,0,0,-.6713,.7412,0,0,.252,0,1), "hand.R": M(-.1083,-.0696,.9917,0,-.0979,.9934,.059,0,-.9893,-.0907,-.1144,0,0,.2683,0,1), "clavicle.L": M(.3001,.319,.899,0,.9531,-.0608,-.2965,0,-.0399,.9458,-.3223,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.5795,-.812,-.0696,0,-.3646,.3347,-.8689,0,.7288,-.4782,-.4901,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.9125,.4091,0,0,-.4091,.9125,0,0,.252,0,1), "hand.L": M(-.1206,.0782,-.9896,0,.1976,.9788,.0532,0,.9728,-.1892,-.1335,0,0,.2683,0,1), "neck": M(.9997,-.018,.0153,0,.02,.9887,-.1484,0,-.0125,.1486,.9888,0,0,.3452,0,1), "head": M(.9999,-.0071,.0122,0,.0044,.9795,.2014,0,-.0134,-.2014,.9794,0,0,.1096,0,1) }); new QI.Pose("walk@27", lib, { "hips": M(.9719,-.1585,-.1739,0,.1606,.987,-.0016,0,-.1719,.0263,-.9848,0,0,.9071,-.0031,1), "thigh.L": M(.9346,.3359,.1173,0,.1895,-.7491,.6348,0,.3011,-.571,-.7637,0,.1085,-.0034,-.0113,1), "shin.L": M(.9998,-.0089,.0172,0,0,.8878,.4602,0,-.0194,-.4602,.8876,0,0,.4176,0,1), "foot.L": M(.8894,-.1956,.4131,0,.4118,-.0495,-.9099,0,.1985,.9794,.0365,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.795,-.6067,0,0,.6067,.795,0,0,.1406,0,1), "thigh.R": M(.9892,.1307,.0663,0,.1423,-.9653,-.219,0,.0354,.226,-.9735,0,-.1085,-.0034,-.0113,1), "shin.R": M(.9998,.0065,-.0177,0,0,.9378,.3473,0,.0189,-.3472,.9376,0,0,.4176,0,1), "foot.R": M(.9202,.2179,.3253,0,.189,.4804,-.8564,0,-.3428,.8496,.4009,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.9925,-.1226,0,0,.1226,.9925,0,0,.1406,0,1), "spine": M(.9843,.1586,-.0777,0,-.1602,.987,-.0144,0,.0744,.0267,.9969,0,0,.1589,0,1), "clavicle.R": M(.0595,-.2711,-.9607,0,-.9982,-.0089,-.0593,0,.0075,.9625,-.2712,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.7316,.5892,.3429,0,-.0349,.4699,-.882,0,-.6808,-.6572,-.3233,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.6047,.7964,0,0,-.7964,.6047,0,0,.252,0,1), "hand.R": M(.0252,-.1091,.9937,0,-.0518,.9925,.1103,0,-.9983,-.0543,.0194,0,0,.2683,0,1), "clavicle.L": M(.4662,.2952,.834,0,.8803,-.0607,-.4706,0,-.0883,.9535,-.2882,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.3553,-.9101,-.2132,0,-.7069,.4108,-.5758,0,.6116,-.0538,-.7893,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.8957,.4447,0,0,-.4447,.8957,0,0,.252,0,1), "hand.L": M(.0313,.1063,-.9938,0,.1796,.9776,.1102,0,.9832,-.1819,.0115,0,0,.2683,0,1), "neck": M(.984,.0024,-.1781,0,-.0216,.9941,-.1062,0,.1768,.1083,.9783,0,0,.3452,0,1), "head": M(.9998,.0135,.0149,0,-.0162,.98,.1984,0,-.0119,-.1986,.98,0,0,.1096,0,1) }); new QI.Pose("walk@32", lib, { "hips": M(.9651,-.1596,-.2074,0,.1446,.9858,-.0857,0,-.2181,-.0527,-.9745,0,0,.8671,-.0094,1), "thigh.L": M(.9673,.2191,-.1276,0,.2261,-.5171,.8255,0,.1149,-.8274,-.5498,0,.1085,-.0034,-.0113,1), "shin.L": M(.9998,-.0158,.0106,0,0,.556,.8312,0,-.0191,-.8311,.5559,0,0,.4176,0,1), "foot.L": M(.9656,-.0623,.2524,0,.2589,.3185,-.9119,0,-.0236,.9459,.3237,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.8585,-.5128,0,0,.5128,.8585,0,0,.1406,0,1), "thigh.R": M(.9839,.1243,-.1283,0,.0636,-.9147,-.3991,0,-.167,.3846,-.9079,0,-.1085,-.0034,-.0113,1), "shin.R": M(.9998,.0059,-.0179,0,0,.9498,.3129,0,.0189,-.3128,.9496,0,0,.4176,0,1), "foot.R": M(.9695,.2293,.0867,0,-.07,.5978,-.7986,0,-.2349,.7682,.5956,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.9625,-.2713,0,0,.2713,.9625,0,0,.1406,0,1), "spine": M(.9881,.101,-.116,0,-.1054,.9939,-.0322,0,.112,.044,.9927,0,0,.1589,0,1), "clavicle.R": M(.0332,-.2732,-.9614,0,-.9994,-.0017,-.0341,0,.0076,.962,-.2731,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.7237,.65,.2321,0,.1529,.4789,-.8645,0,-.673,-.5901,-.4459,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.5196,.8544,0,0,-.8544,.5196,0,0,.252,0,1), "hand.R": M(.0224,-.0882,.9958,0,-.029,.9956,.0888,0,-.9993,-.0309,.0198,0,0,.2683,0,1), "clavicle.L": M(.4888,.2909,.8225,0,.868,-.0672,-.4921,0,-.0879,.9544,-.2853,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.1342,-.8926,-.4304,0,-.7462,.3768,-.5488,0,.652,.2475,-.7167,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.928,.3726,0,0,-.3726,.928,0,0,.252,0,1), "hand.L": M(-.1719,.071,-.9825,0,.2113,.9768,.0336,0,.9622,-.2018,-.183,0,0,.2683,0,1), "neck": M(.9853,-.0055,-.1708,0,-.0309,.9773,-.2097,0,.1681,.2119,.9627,0,0,.3452,0,1), "head": M(.9996,.025,.0166,0,-.0277,.9801,.1967,0,-.0113,-.1971,.9803,0,0,.1096,0,1) }); new QI.Pose("walk@45", lib, { "hips": M(.998,.035,-.0523,0,-.0344,.9993,.0132,0,-.0527,.0114,-.9985,0,0,.9578,.0024,1), "thigh.L": M(.9948,-.1017,-.0099,0,-.1012,-.9941,.0402,0,-.0139,-.039,-.9991,0,.1085,-.0034,-.0113,1), "shin.L": M(.9999,-.0069,.0107,0,0,.8398,.543,0,-.0127,-.5429,.8397,0,0,.4176,0,1), "foot.L": M(.9953,-.0444,.0859,0,.0876,.0387,-.9954,0,.0409,.9983,.0424,0,0,.4362,0,1), "toe.L": M(1,0,0,0,0,.9286,-.3711,0,0,.3711,.9286,0,0,.1406,0,1), "thigh.R": M(.9987,.0119,-.0493,0,.0394,-.7934,.6075,0,-.0319,-.6086,-.7928,0,-.1085,-.0034,-.0113,1), "shin.R": M(.9998,.0148,-.0117,0,0,.6227,.7824,0,.0189,-.7823,.6226,0,0,.4176,0,1), "foot.R": M(.9721,.1482,-.1817,0,-.1951,.0817,-.9774,0,-.13,.9856,.1083,0,0,.4362,0,1), "toe.R": M(1,0,0,0,0,.7623,-.6473,0,0,.6473,.7623,0,0,.1406,0,1), "spine": M(.9892,-.0913,-.1147,0,.0924,.9957,.0043,0,.1138,-.0148,.9934,0,0,.1589,0,1), "clavicle.R": M(.2299,-.2529,-.9398,0,-.9732,-.0542,-.2235,0,.0056,.966,-.2586,0,-.0228,.2759,.0486,1), "upper_arm.R": M(-.3545,.934,.0443,0,.6849,.2916,-.6678,0,-.6366,-.2064,-.743,0,0,.1699,0,1), "forearm.R": M(1,0,0,0,0,.844,.5364,0,0,-.5364,.844,0,0,.252,0,1), "hand.R": M(-.154,-.0406,.9872,0,-.0319,.9988,.0361,0,-.9876,-.0259,-.1551,0,0,.2683,0,1), "clavicle.L": M(.3098,.3194,.8956,0,.9466,-.015,-.3221,0,-.0894,.9475,-.307,0,.0228,.2759,.0486,1), "upper_arm.L": M(-.6902,-.6593,-.2981,0,.0475,.3699,-.9279,0,.7221,-.6546,-.224,0,0,.1699,0,1), "forearm.L": M(1,0,0,0,0,.807,.5905,0,0,-.5905,.807,0,0,.252,0,1), "hand.L": M(.1485,.1374,-.9793,0,.1143,.9813,.1551,0,.9823,-.135,.13,0,0,.2683,0,1), "neck": M(.9853,-.0055,-.1708,0,-.0309,.9773,-.2097,0,.1681,.2119,.9627,0,0,.3452,0,1), "head": M(.9996,.025,.0165,0,-.0277,.9809,.1925,0,-.0114,-.1929,.9812,0,0,.1096,0,1) }); })(PoseLib || (PoseLib = {})); The real power is you can assign sub-poses to a skeleton with only some of the bones. If you had a walking animation of 45 frames, then needed the one where the head was looking right, then you would need another 45 frames. Frames are a major problem for mixing. This is simple for poses. ozRocker 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted May 23, 2016 Share Posted May 23, 2016 Jeff, I like where this might be going If I understand what you are saying - using poses would allow you to have a single walk animation then apply a head left or a head right pose to effectively change the walk animation. So immediately I thought, can this be done while the base walk is running and looping? cheers, gryff Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 24, 2016 Author Share Posted May 24, 2016 oh yeh, I only just noticed that with the new bone rescaling code the hips aren't moving. It looks like their feet are sliding around Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted May 24, 2016 Share Posted May 24, 2016 @gryff the one word answer is Yes. I am leary about some of your terminology. specifically "looping". I call them nRepeats. When every new target pose is being prepped to start running (whether for the first time or a repeat), the _subPoses array in the Skeleton subclass is merged with the target pose. Should someone have a button with the code below, and it was clicked, this would be taken into account when the next target pose ran. mesh.addSubPose("headLeft"); // 2nd arg is boolean to do immediately, useful if nothing queued. "headLeft" would continue to be merged until one of the following is executed: mesh.removeSubPose("headLeft"); or mesh.clearAllSubPoses(); You can also call these methods on the skeleton too. The beforeRender is on the mesh. The mesh versions just wrapper the skeleton's version of the calls. Skeletons can still handle multiple meshes, but they must be parented to the mesh with the beforeRender. @ozRocker, an "idle" animation is not great for detecting problems. Could you swap this for another? Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 29, 2016 Author Share Posted May 29, 2016 @JCPalmer I've put up a playground with some rumba dancing instead where the issue is obvious http://www.babylonjs-playground.com/#25M97N#50 With rescaling turned on you can see her hip bone doesn't move and the dance looks weird 'cos her feet are sliding around. When you turn off rescaling she moves as expected. JCPalmer 1 Quote Link to comment Share on other sites More sharing options...
adam Posted May 29, 2016 Share Posted May 29, 2016 @ozRocker I still think you need to do this: Your root bone shouldn't move (in local space). Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 29, 2016 Author Share Posted May 29, 2016 @adam The other thread you are referencing is about root-motion but this issue here is different. I don't need root-motion. I just need the hip bone to move like it does when the rescaling is disabled. Quote Link to comment Share on other sites More sharing options...
adam Posted May 29, 2016 Share Posted May 29, 2016 I contributed to the fix for the rescaling issue. You need a root bone that is a parent of the hips for the rescaling to work correctly on the hips. The root bone for all your characters should be on the ground. Quote Link to comment Share on other sites More sharing options...
adam Posted May 29, 2016 Share Posted May 29, 2016 Like these: Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 29, 2016 Author Share Posted May 29, 2016 Is there a way to add a bone as a parent to the hip via Babylon.js code? or do I need to manually add a new parent bone to the hip to all my characters using Blender? I'm trying this but its not working. I can't find any examples online on how to properly add a single bone via code: var hipBone: BABYLON.Bone = this.mesh.skeleton.bones[0]; //0 is "mixamorig_Hips" var rootBone: BABYLON.Bone = new BABYLON.Bone("root", this.mesh.skeleton, null, null); hipBone.parent = rootBone; Quote Link to comment Share on other sites More sharing options...
adam Posted May 29, 2016 Share Posted May 29, 2016 I'd do it in Blender. Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 29, 2016 Author Share Posted May 29, 2016 So there really is no other way to do this than by adding an extra bone that serves no purpose other than making the rescaling code work? I feel like I'm hacking my 3D models as a workaround for the code. Quote Link to comment Share on other sites More sharing options...
adam Posted May 29, 2016 Share Posted May 29, 2016 This is a very common way of rigging characters. another example: gryff 1 Quote Link to comment Share on other sites More sharing options...
ozRocker Posted May 29, 2016 Author Share Posted May 29, 2016 The only reason people use the kind of skeleton you posted above is if you'd want root motion which is not dictated by the hip. Mixamo, Blender meta-rig and the Second Life skeleton don't have a separate bone for the root. This is because most 3D packages will pick the top-most parent bone (which is technically the root) as the "root" bone. I've never used anything other than the hip as the root bone in all my other Babylon.js animations and any time I've used Unity3D. That's why I feel like this is a hack to make that particular code work. I hope I don't sound too defensive or argumentative. I appreciate the code bro! Just want to get this working as clean as possible. 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.