Wartorle

Animation Bind Poses and Multiple .babylon Files

Recommended Posts

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

SS1.png

SS2.png

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

@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

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.