Wartorle Posted August 8, 2017 Share Posted August 8, 2017 Hi Everyone, I'm trying to do something like this: Load a .babylon scene using SceneLoader.Load. This scene has a skinned mesh and an idle animation. Then, I want to load a second .babylon file using SceneLoader.ImportMesh. This file has multiple LODs so I only want one of them (hence the ImportMesh) and has no animation. The mesh is also skinned using the same number of bones as the first. When I load this, I replace the Skeleton on the imported mesh with the one from the main scene so that it animates. However, here's the rub. The first frame of the idle animation has the arms down by the side of the character but the second skin has the arms in the typical T-Pose. When it's animating, the arms are adjusted but relative to the T-Pose and not the first frame of the anim. I *think* this is because something isn't correctly getting configured for the skin bind pose. I've tried all sorts of things to correct the problem so if anyone has any ideas or insight, it would be most welcome! Thanks, Roc Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 8, 2017 Share Posted August 8, 2017 Hello to make this works you may need to flag your skeleton with skeleton.needInitialSkinMatrix = true in order to make it independent Quote Link to comment Share on other sites More sharing options...
Wartorle Posted August 9, 2017 Author Share Posted August 9, 2017 Hi Deltakosh, Thanks for the response. As far as I can tell, this made no difference and it has behaved as it did before. I've zipped up an archive of minimal assets that demonstrates the problem. Totally understand if you've not got any time to look but, if you have, that would be most awesome. Thanks, Roc BabylonJS_Test.zip Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 9, 2017 Share Posted August 9, 2017 Do you mind saving these assets to github or onedrive and create a repro in the PG? This will help me a lot to fix the problem Quote Link to comment Share on other sites More sharing options...
Wartorle Posted August 10, 2017 Author Share Posted August 10, 2017 Here you go: https://www.babylonjs-playground.com/#QM3AAE Many thanks for looking into this. Roc Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 10, 2017 Share Posted August 10, 2017 Hello based on the rest pose, it works as expected: The skeleton is animating from rest pose so what you get is kinda expected Quote Link to comment Share on other sites More sharing options...
Wartorle Posted August 11, 2017 Author Share Posted August 11, 2017 @Deltakosh well, yes, that's kinda what I was referring to with the initial post. However, what I'd like to be able to do is to take the Pose transforms from the animation and apply them to the Skinned Mesh (replacing the Pose transforms in that) so that they animate in tune with what the animation intended. Is that possible, somehow? Thanks, Roc Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 11, 2017 Share Posted August 11, 2017 It should be possible to some extends. The initial pose is defined by the pose matrix that you can update to whatever you want with mesh.updatePoseMatrix(). https://www.babylonjs-playground.com/#QM3AAE#1 But I'm not sure this will be enough. I clearly recommend to create both meshes with same initial posture. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 11, 2017 Share Posted August 11, 2017 Hi @Wartorle where are you exporting the models from? There are a lot of places a setup like this can go wrong. Make sure the skeletons/bones used are the exact same, as in; pre-export, all models should be skinned to the same skeleton/bones. when exporting, make sure everything is exported in the same pose as Deltakosh also said, e.g; have a t-pose at frame 0 then export the secondary hands with only frame 0 & the "export only selected" option (select hands & all bones the hands uses), if you're using 3ds max, it should automaticly avoid exporting bones the hands are not skinned to. you can then load your animations and export the main body in the same manner (keep t-pose at frame 0). if you do the above steps and it doesn't work out of the box, feel free to ping me, i believe i have some code hidden away somewhere that will work in the above situation (non-animated mesh's skeleton should only contain bones the mesh is skinned to). Quote Link to comment Share on other sites More sharing options...
Wartorle Posted August 11, 2017 Author Share Posted August 11, 2017 @DeltaKosh and @aWeirdo thanks for the responses. Yes, sure, ideally all anims/meshes would have the same Bind Pose at export but we're trying to work with some existing data for a game. They've got a custom engine and they support more flexibility in terms of bind pose control and this is how their data is structured. Getting these changed is not an option (too much data) so we're trying to make things work as-is. Pose Matrix: A single pose matrix for the mesh won't ever be enough - what we would need is a pose matrix for each bone in the skeleton to allow more control. Currently, we're just trialing solutions to allow us to bring existing game content to the Web. These (and other) tests have simply involved using FBXExporter command line to convert source game files to .babylon files. However, we already know we're going to have to move to proprietary loading of asset files since the model/anim/material/shader setup is so very specific, existing pipelines won't be able to cope. As things stand, we've already started this proprietary loading pipeline so the importance of getting the default pipeline working isn't that high any more. Thanks, Roc Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 11, 2017 Share Posted August 11, 2017 Ok gotcha. You can also control the individual bones with: - setScale() - setAbsolutePosition() - rotate() etc... https://github.com/BabylonJS/Babylon.js/blob/master/src/Bones/babylon.bone.ts#L252 Quote Link to comment Share on other sites More sharing options...
Wartorle Posted August 15, 2017 Author Share Posted August 15, 2017 Cool, thanks @Deltakosh 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.