Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModelImporter misses root bone if its not used in the mesh #3168

Open
theZMan opened this issue Nov 12, 2014 · 2 comments
Open

ModelImporter misses root bone if its not used in the mesh #3168

theZMan opened this issue Nov 12, 2014 · 2 comments
Labels
ContentPipeline Content processing issues

Comments

@theZMan
Copy link
Contributor

theZMan commented Nov 12, 2014

OpenAssetImporter.cs::FindSkeletonRoot looks for the skeleton root by finding the bone that is closest to the scene root. However its candidate bones are only bones that are skinned - if you have a root bone which is not skinned to any vertices but purely a root node then it is ignored along with any transforms. This behavior is different to the XNA importer and means the model is not rendered correctly. We are using .X files but this may also happen in FBX

There is no obvious way to determine the skeleton root that i can tell - hence the above algorithm. All of our models have 2 child nodes from the scene root - one is the mesh, the other is the skeleton but that also seems a naive solution and I don't know if it works for FBX as well as .X

If I 'rig' the code for our models then we also get IK chains included in the skeleton - I'm not 100% sure if thats what happens with XNA too.

My proposal is to simplify the search to

  1. Choose any bone.
  2. Walk back to sceneroot
  3. The node you visit before sceneRoot is the skeleton root

This makes the assumption that all bones are in 1 skeleton and the skeleton is always a child of the scene root.

My other alternate is

  1. Choose any bone
  2. Walk back to scene root
  3. Remember the highest parent with a non identity transform - that is the skeleton root.

This makes the assumption that nodes that are just there for organization have identity transform. SideEffect - a skeleton root with no transform would get ignore incorrectly.

Any ideas from people who have looked at this more than me.

@theZMan
Copy link
Contributor Author

theZMan commented Nov 12, 2014

So proposal #1 fixes the orientation and position of our models... there's still some rendering issues with bones to track down but ading back the root node seems to be a good step #1

I have no idea how to begin to test that my code won't break other games though... we really dont have a wide enough selection of 3d models to do test do we?

@tomspilman
Copy link
Member

This makes the assumption that all bones are in 1 skeleton

I think this assumption is generally safe. I say go for it.

We do however need to see about setting up some sort of tests for this soon. Because this can become hard to maintain without it.

@Jjagg Jjagg added the ContentPipeline Content processing issues label Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ContentPipeline Content processing issues
Projects
None yet
Development

No branches or pull requests

3 participants