Jump to content

  • Log In with Google      Sign In   
  • Create Account


How to calculate bind pose for bones that are not attached to the skin, but which are in a hierarchy where some bones are attached to the skin

  • You cannot reply to this topic
14 replies to this topic

#1 MarkJSmith   Members   -  Reputation: 104

Like
0Likes
Like

Posted 16 June 2014 - 05:26 PM

Hi

 

I am having problem with calculating bind pose for some bones of a given skeleton using FBX SDK.

 

I can easily get bind pose matrices for the bones affecting a mesh from the FbxClusters.

 

I can also calculate bind pose matrices of bones which have no FbxClusters assigned to them if these bones have parent bones which have clusters assigned to them by the method described in the last post here: http://forums.autodesk.com/t5/FBX-SDK/Skeleton-Bind-Pose-for-bones-not-linked-to-clusters/m-p/417362...

 

Now the problem I am having is how to calculate bind pose matrices for the bones which have no FbxClusters assigned to them and which have either no parent nodes or their parent nodes have no FbxClusters assigned to themselves as well. (Please note that FbxPose has no matrices for these bones either)

 

In the image below I have outlined examples of such bones in red:

 

pic2.png

 

Any help would be highly appreciated.

 

Thanks



Sponsor:

#2 ankhd   Members   -  Reputation: 1116

Like
0Likes
Like

Posted 16 June 2014 - 10:00 PM

Hi.

I take it that the bones ont getting exported. You say there is no transform??.

Iis it in the fbx file??.

May be you need to see if you can export it correct.

//give it a weight of 0.1 so it not effect the skin and it may work does in .X file



#3 MarkJSmith   Members   -  Reputation: 104

Like
0Likes
Like

Posted 17 June 2014 - 01:03 AM

Hi.

I take it that the bones ont getting exported. You say there is no transform??.

Iis it in the fbx file??.

May be you need to see if you can export it correct.

//give it a weight of 0.1 so it not effect the skin and it may work does in .X file

 

I am not trying to export an FBX file. I already have an FBX file with a model and what I am trying to do is write a converter using FBX SDK which would convert a given FBX file to my own format. The problem is that I am not able to get/compute bind pose for certain bones(the ones described in my first post).

 

P.S. I know that an FBX file I am dealing with is correct, because Autodesk FBX Viewer displays and animates it correctly.



#4 MarkJSmith   Members   -  Reputation: 104

Like
0Likes
Like

Posted 21 June 2014 - 05:09 PM

I would greatly appreciate it if anybody could provide suggestions which could help me to solve this problem.

 

P.S. I would be more than happy to further explain and/or clarify the problem.



#5 ankhd   Members   -  Reputation: 1116

Like
0Likes
Like

Posted 21 June 2014 - 05:49 PM

The best way to fix this is assign the bone a small weight then export it again an they will have a transform then. Or you will need to make a transform offset some how. See when you say it works in the viewer there not using them bones.

#6 Buckshag   Members   -  Reputation: 468

Like
0Likes
Like

Posted 22 June 2014 - 05:12 AM

You can check if there is a bind pose stored in the FBX file.

Calculate the world space matrix based on that pose, and use the inverse of that.

That's what I would try at least. I'm not an FBX expert really so I am not sure if this is the correct solution, but it would make a lot of sense.

If there is no bind pose stored, just try to get the world space matrix and inverse it.



#7 MarkJSmith   Members   -  Reputation: 104

Like
0Likes
Like

Posted 22 June 2014 - 05:42 AM

The best way to fix this is assign the bone a small weight then export it again an they will have a transform then. Or you will need to make a transform offset some how. See when you say it works in the viewer there not using them bones.

 

I have tried this workaround and it looks like it does the job.

 

You can check if there is a bind pose stored in the FBX file.

Calculate the world space matrix based on that pose, and use the inverse of that.

That's what I would try at least. I'm not an FBX expert really so I am not sure if this is the correct solution, but it would make a lot of sense.

If there is no bind pose stored, just try to get the world space matrix and inverse it.

 

Unfortunately there is no Pose data available in the FBX file I am dealing with and the global matrices look to be way off the right position.

 

 

 

Thanks



#8 Buckshag   Members   -  Reputation: 468

Like
0Likes
Like

Posted 22 June 2014 - 05:53 AM

Actually why do you need the bind pose matrix of the bones that do not directly deform any mesh?

Maybe the internals of your engine are not designed to handle this correctly?

I mean as you do not perform skinning using this bone the inverse bind pose matrix is not needed, so it can be skipped/ignored during any calculations if you do not need it for anything else.

 

I'm pretty sure this is also what the FBX viewer you tried will be doing.

 

This assuming your bone local transforms in your animation data are stored relative to the parent.


Edited by Buckshag, 22 June 2014 - 06:04 AM.


#9 MarkJSmith   Members   -  Reputation: 104

Like
0Likes
Like

Posted 22 June 2014 - 07:40 AM

Actually why do you need the bind pose matrix of the bones that do not directly deform any mesh?

Maybe the internals of your engine are not designed to handle this correctly?

I mean as you do not perform skinning using this bone the inverse bind pose matrix is not needed, so it can be skipped/ignored during any calculations if you do not need it for anything else.

 

I'm pretty sure this is also what the FBX viewer you tried will be doing.

 

This assuming your bone local transforms in your animation data are stored relative to the parent.

 

I would like to store a skeleton hierarchy in local space(i.e. each bone relative to its parent). Since FBX only provides bind pose in world space matrices I need these matrices for every bone in order to calculate local space matrices myself.



#10 Buckshag   Members   -  Reputation: 468

Like
0Likes
Like

Posted 22 June 2014 - 11:15 AM

Can I ask you why you need this local space hierarchy in bind pose? You won't need it to play back an animation at least. It is possible you need it for retargeting, but I assume here you are not needing that right now.

 

So basically the question is, what are you trying to achieve? Let's see if you really need the local space bind pose transforms.

 

It sounds like there is no real way to get the correct bind pose transforms of those first bones, but they will not be needed for playing back animation on the skeleton or to render the skeleton correctly. But you might be trying to do something that just isn't possible here as the information isn't stored in the FBX. This can be solved by doing some art changes though, but again it shouldn't be needed unless you really need a bind pose for all nodes.

 

There is one more workaround you could otherwise do, and that is to store the vertex data in world space, and use the first frame as bind pose. I'm not sure however if the FBX sdk allows you to get the skinned vertex data in world space already. Also the quality of the skinning can be lower this way.

 

Also you could just try to get the world space transform of frame 0. Use that to calculate the local space bind pose transform (so using the scene evaluator for those bones that have no cluster). As long as you end up with the correct world space bind transform during skinning it should be fine. But normally you don't calculate the bind pose world transforms yourself, you just store them once without needing the local space bind pose transforms to reconstruct them.


Edited by Buckshag, 22 June 2014 - 11:27 AM.


#11 L. Spiro   Crossbones+   -  Reputation: 12338

Like
0Likes
Like

Posted 22 June 2014 - 04:29 PM

I am also not sure what you really want.
Do you not want to make a standard skinned animation play?
Is there some reason the standard way of doing this won’t work?

Every FbxNode has a translation matrix, both local and world (that includes the bind pose).

Your approach in determining what matrix to use is exactly backwards.
It’s not, “If no cluster influence, then what?”, it’s, “Use the node’s matrix unless influenced by a cluster.”
You don’t need a pose, shape, influence, cluster, or even a skin to determine what matrix to use. These things are add-ons, not foundational/necessary elements.


In any case, getting a local matrix is trivial.
If there is no parent, the world matrix is its local matrix, otherwise the local matrix is the inverse of the parent’s matrix multiplied by the node’s world matrix.
I just hesitate before giving you this answer because you seem really lost and I feel as though I am just helping you further down the spider hole.


L. Spiro
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#12 ankhd   Members   -  Reputation: 1116

Like
0Likes
Like

Posted 22 June 2014 - 06:46 PM

Looks like it's needed to attach weapons.

#13 Buckshag   Members   -  Reputation: 468

Like
0Likes
Like

Posted 22 June 2014 - 07:31 PM

In any case, getting a local matrix is trivial.
If there is no parent, the world matrix is its local matrix, otherwise the local matrix is the inverse of the parent’s matrix multiplied by the node’s world matrix.
I just hesitate before giving you this answer because you seem really lost and I feel as though I am just helping you further down the spider hole.

 

 

He cannot extract a bind pose if it isn't there.

But he might think he needs the bind pose transforms for those nodes, while he probably doesn't need them.

Using the node matrix can be incorrect, as it is not the real bind pose, but again it shouldn't matter as for skinning you only need the bind pose matrices of the nodes that are inside a cluster anyway. So we have to find out what he really is trying to do here.



#14 L. Spiro   Crossbones+   -  Reputation: 12338

Like
0Likes
Like

Posted 22 June 2014 - 07:45 PM

Looks like it's needed to attach weapons.

But joints are part of the scene graph just as meshes and models are.
Attaching something to it is just a matter of making it a child of that object and is an entirely separate issue from extracting skin weights from FBX files.
There is extreme confusion all around. I pray the fire topic-started be clearer.
 

He cannot extract a bind pose if it isn't there.

He says he can get the bind pose easily in his first post. The problem seems to be about some bones having no clusters (the FBX term for skin weights) attached to them.
My confusion begins here: Why does he think all bones need skin weights? If the bone doesn’t influence any vertices directly, there will be no skin weights. So?

The bone he circled in the image would be examples of joints that are not influencing any vertices.

Then he goes on to ask how to calculate the bind-pose matrices for joints with no skinning weights.
HUH??
The locations of the joints/bones is nothing to do with whether or not they have skinning weights/clusters.  They are all nodes, all nodes except root nodes have a parent, and all bones/joints in a skeleton can be put into bind pose simply by traversing the bind-pose hierarchy via only this information.  Never does a bind pose relate to skin weights/clusters at all.
 
 
So I (and everyone else) am confused on 2 points:
#1: Some bones/joints don’t have clusters.  SO?
#2: Why does he think they need clusters to calculate a bind pose??


“Buckshag, what does the C-Meter say about his confused level?”
It’s over 9,000!!!!



L. Spiro

Edited by L. Spiro, 22 June 2014 - 07:46 PM.

It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
I went to my local Subway once to find some guy yelling at the staff. When someone finally came to take my order and asked, “May I help you?”, I replied, “Yeah, I’ll have one asshole to go.”
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

#15 Buckshag   Members   -  Reputation: 468

Like
0Likes
Like

Posted 22 June 2014 - 07:53 PM

He says he can get the bind pose easily in his first post. The problem seems to be about some bones having no clusters (the FBX term for skin weights) attached to them.
My confusion begins here: Why does he think all bones need skin weights? If the bone doesn’t influence any vertices directly, there will be no skin weights. So?

The bone he circled in the image would be examples of joints that are not influencing any vertices.

Then he goes on to ask how to calculate the bind-pose matrices for joints with no skinning weights.
HUH??
The locations of the joints/bones is nothing to do with whether or not they have skinning weights/clusters.  They are all nodes, all nodes except root nodes have a parent, and all bones/joints in a skeleton can be put into bind pose simply by traversing the bind-pose hierarchy via only this information.  Never does a bind pose relate to skin weights/clusters at all.
 
 
So I (and everyone else) am confused on 2 points:
#1: Some bones/joints don’t have clusters.  SO?
#2: Why does he think they need clusters to calculate a bind pose??

 

 

I think he thinks he needs the bind pose world space matrices for the node without cluster as he wants to store a bind pose in local space.

In order to calculate the local space transform in bind pose he needs to get the bind pose transform of the node with red circle. This is true IF you really would need the local space bind pose for all nodes. But this is not needed for regular animation as you know.

 

I have the feeling he is trying to reconstruct the full bind pose in world space by doing forward kinematics on those local space transforms.

But instead he should just store the bind pose matrices in world space of all nodes that act as real bone in the skinning info of the mesh. And as for skinning you do not need the bind pose transform of the red circled node it would solve his full problem.

 

So unless he really needs the correct bind pose he should just do it that way and skip the whole local space bind pose extracting as that info just isn't there, unless an artist adds a bind pose to the FBX.

 

 

“Buckshag, what does the C-Meter say about his confused level?”
It’s over 9,000!!!!

 

 

Haha :) I think its clear what he wants, he just needs to understand he doesn't need this bind pose transform of the red marked node and that he should just store the bind pose transforms as world space matrix for the other nodes.







PARTNERS