Author Topic: Skeleton deformations  (Read 15901 times)

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Skeleton deformations
« on: January 03, 2016, 03:00:14 pm »
I'm having an issue hopefully somebody else has faced.  I'm exporting from 3dsmax using OgreMax.  The binary loads properly with animations in the Ogre3D viewer, but the when converting the exported XML to *.bones format and loading the file into my jPCT-ae app, there's an issue where the skeleton bones don't appear to transforming the animation properly in the hierarchy.  Please see the attached screenshot.  Any help you may provide is greatly appreciated!

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #1 on: January 03, 2016, 04:51:38 pm »
I should explain a little what you're looking at in the screenshot.  It's an animation test since my full animations were not being properly transformed.  The knee should be straight out and bent down.  It appears that the shin bone is not properly inheriting the parent bone's transformed position.
« Last Edit: January 03, 2016, 04:54:53 pm by Redman »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Skeleton deformations
« Reply #2 on: January 03, 2016, 05:03:38 pm »
I've sent you a PM with my email. can you please send me the xml files?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Skeleton deformations
« Reply #3 on: January 03, 2016, 06:02:54 pm »
did you manually modify the mesh.xml? because it cant be loaded as it is, the skeleton name does not match skeleton file name.

anyway, I edited mesh.xml to match the skeleton file, and opened it in desktop OgreSample. (which I strongly suggest to test your models and animations before going Android. you can see individual animations and skeleton there in all angles)

and I saw a totally different animation and skeleton.

this is how your model looks (with ninja's texture) the nucleus like thing in the middle is skeleton :o


I hide the mesh and zoomed in, here is your skeleton:


not sure where it's messed up. I'm really surprised Ogre3D viewer can display it properly.

what do you use to convert from binary to xml format? OgreMax's own converter? maybe you should try Ogre command line tools to do that (though I dont think it will help)

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #4 on: January 04, 2016, 01:04:39 am »
Thank you for your time.  I did notice the skeletal anomaly when adding a SkeletonHelper, but I wasn't sure exactly what it was doing as it didn't really match up at all to the mesh.  The animations didn't seem as off as the skeleton was showing.  I'm also new to this engine so I'm still learning its classes and structure.

The only thing I changed in the mesh XML was an XML node attr value of "float2" to "2" as the converter was failing due to an unknown value.  This was on the parent node for the vert UVs, which were displaying correctly.

The XML I've been using is directly generated from OgreMax during export.  I will look into a binary converter as the Ogre3D binary files are loading properly.  I will also start testing/using the Desktop OgreSample.

Thank you and I will let you know what I find!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Skeleton deformations
« Reply #5 on: January 04, 2016, 01:48:03 am »
but Bones cannot load the model, throwing exception due to mismatched skeleton file name? maybe you send me a wrong skeleton file? or renamed it?

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #6 on: January 04, 2016, 02:13:13 am »
Sorry, I was playing with the export options in OgreMax and set a skeleton name.  Looks like it changes the export filename.  It should be the same XML file, but I could send it to you later on tonight of you'd like when I get a chance to get back on my computer.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Skeleton deformations
« Reply #7 on: January 04, 2016, 09:52:29 am »
if it's the same, no need actually. you can check it yourself with OgreSample

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #8 on: January 04, 2016, 02:44:15 pm »
I did some testing last night.  I started using the OgreSample to quickly load the model for testing.

I downloaded the Ogre Command line tools (OCLT) for windows which only supports up to 1.7.9.  I had to export the model out to 1.7 to use the tools.  This model format of 1.7 did the same thing as 1.8 in both ogre3d and jPCT.  I then converted the binary to XML using the OCLT to see if it was the OgreMax generating bad XML.  Same issue in jPCT.  I then converted the XML back into binary using the OCLT and loaded it in the OgreViewer.  It loaded properly again.

Using the OgreSample, I bypassed the step of converting the XML to bones although it appears to have the same issue.

Will test again tonight after work to see if I can get it to work.

Thoughts:
1) Compare XML to ninja XML to see if there are any notable differences in format that perhaps Bones is not interpreting correctly or causing loading issues.
2) try test reskinning the model quickly with new bones and exporting.

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #9 on: January 05, 2016, 05:49:35 am »
I discovered what the issue is.  It doesn't appear that scaling for bones is working.  My root node skeleton pose in the XML has a scale of 19.47.  This is not being applied and so the skeleton is 5% of its normal size in the mesh.

The reason why you see the nucleus is because the size of the bones and how small the skeleton is scaled.

I did another test scaling a bone in an animation.  The scaling did not transform when imported in jPCT, but it transforms in Ogre3d.

More to follow tomorrow when I verify either manually scaling the XML positions or finding a good way to normalize the skeleton scaling.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Skeleton deformations
« Reply #10 on: January 05, 2016, 10:55:52 am »
interesting. I've checked ninja and blend sample's skeleton, they have no scale element in xml.

also in jME code, there are some parts to load scale element from xml, but they are all commented out. dont have any idea why.

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #11 on: January 06, 2016, 12:17:33 am »
I wrote a quick script to automate applying the scale to the pose positions in the XML.  The animations now load properly in jPCT.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Skeleton deformations
« Reply #12 on: January 06, 2016, 02:25:12 pm »
there is only one scale element and it's for bone named "Root"

you mean you applied it to translate element of only "Root" bone as below?

Code: [Select]
                <track bone="Root">
                    <keyframes>
                        <keyframe time="0">
                            <translate x="-0.0029649" y="3.49693" z="-1.52855e-007"/>
...

Offline Redman

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Skeleton deformations
« Reply #13 on: January 08, 2016, 01:51:33 am »
No, I scaled the positions of all other bones by the factor.  In the skeleton, the bones all contain relative position and rotation offsets of their parent.  The scale needs to be multipled down the tree.