Return to Rest not Behaving as Expected?

I feel like we are really really close.

@Evgeni_Popov discover anything new on this?
I mainly mean in regards to after getting them into this rest pose how do we get them back into their action pose?
https://playground.babylonjs.com/#BRC10K#2

Because I think we finished the first half of this question about getting it to restPose. It just seems going back is a struggle.

Or its that some of these models are just way to out of scope for me to do that to them?

Sorry my PC is down, can’t work at least until tuesday.

1 Like

So, working on this again.

I have a hard time understanding what is the rest pose for the gym file…

I tried to open it in Blender, it’s a big mess (note: I never used Blender, I’m a total newbie):

  • in perspective mode, I can’t zoom out enough to see anything
  • in orthographic mode I get:

Is there a button or something somewhere in Blender that I can use to set the scene in ā€œrest poseā€ and see how it should be in Babylon when calling returnToRest?

Yeah you click on the armature icon:
image

Thanks @Pryme8.

I think I got it.

The thing is that we tried to fit a circle into a squre. The rest pose in Babylon is the (matrix) state where the local matrix of each bone is the matrix read from the file, without any changes (from animation, for eg). Notably, it’s not what you get by applying the inverse transform matrices (which usually leads you to the T-pose).

So, after having understood this with the help of @Deltakosh, I corrected the code accordingly.

Here’s a PG with all the files you linked to: just comment / uncomment the one you want to test.

https://playground.babylonjs.com/#G8S01T#1

The PR:

1 Like

This is live.

2 Likes

@Drigax or @Evgeni_Popov What would have caused this:

To stop working now? Its the same one that we proofed initially the process was working. Now I go back and look and its broken again?

It was working back at this post:

XD

In this version of the PG if you wait for it to load and then go into the inspector select the bone viewers mesh and toggle compute bones using shaders first on then off the viewers spurs end up in the correct location.
image
image

… this is starting to get nutty.

Having a look at that.

@Pryme8 What is your most up to date code: the one from the PG or the one currently in the Babylonjs repository (they are not the same)?

And what about the PR:


?
1 Like

The PR is the most up to date code, but they both use the same math to position the bones.

The crazy part is that old PG worked and the only thing that changed was the BJS version.

Here’s a new PR, hopefully fixing the problems:

I have used this PG to test and all 11 models do work:

https://playground.babylonjs.com/#EBBE0Z

2 Likes

I love you long time!

Dude Evgeni, I wan to give you a hug sometimes, you and Delta save my ass so much.

1 Like

I can confirm this did the trick!

1 Like

Hey Evgeni,

I’ve read the whole conversation. That was quite a war.

I’m wondering if your last example should give the correct t-pose when all the animations are stopped and returnToRest is called for all the skeletons.

Here is an updated playground example. Shouldn’t this be a T-pose now? Or something has changed since August?

Welcome aboard!

I guess it depends on how the T-pose is defined at modeling time: it’s not mandatory that this pose be modelized as a ā€œTā€.

I think @Pryme8 will know more about this as this character is his.

Yeah. We are actually from the same place. He redirected me to this part of the forum and to you to be exact :grin:

Not the T-pose but A-pose for the girl. My bad. But she has the pose in which she was exported.
The other models are not in the rest-pose (T or A) for me as well.

I’m just trying to understand the concept behind the rest poses in Babylon.

So it seems the rest pose is the pose the character is in when it is exported (I think it is the pose linked to the inverse bind matrices that are read from the file).

If you want to set the character to the bind pose, you should copy the bind matrix to the rest matrix before calling returnToRest:

https://playground.babylonjs.com/#EBBE0Z#2

Or if you don’t want to loose the rest matrix, you can write a returnToBind function in the same way than what returnToRest is doing:

https://playground.babylonjs.com/#EBBE0Z#3

They were not telling lies about Babylon community. Support is really beyond any comparison.
Thank you. That’s exactly what I needed!

It seems the idea of the rest pose has changed since alpha.26. My example returned the skeleton to A-pose on that version. Though, now I understand what Rest/Bind mean.

2 Likes

So they can be the same sometimes then, correct?

That’s what was giving me the confusion and why I wanted him to talk to you about it @Evgeni_Popov. I kind of said the same thing as you but was not so confident in my answer, which is why I directed him to your way. Thank you for clarifying.

I do think so, depending on how you did your modelization (again, I’m no expert in this and I don’t know anything on the modelization side…).