Skeleton deformations

Started by Redman, January 03, 2016, 03:00:14 PM

Previous topic - Next topic

Redman

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!

Redman

#1
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.

raft

I've sent you a PM with my email. can you please send me the xml files?

raft

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)

Redman

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!

raft

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?

Redman

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.

raft

if it's the same, no need actually. you can check it yourself with OgreSample

Redman

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.

Redman

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.

raft

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.

Redman

I wrote a quick script to automate applying the scale to the pose positions in the XML.  The animations now load properly in jPCT.

raft

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?


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

Redman

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.