Author Topic: Model badly deformed when imported  (Read 4046 times)

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Model badly deformed when imported
« on: September 19, 2011, 10:47:42 pm »
Hi Raft

Do you have any hints for a model that appears completely deformed when imported? Basically the hands and the feet get stretched far away from the body and all the body stretches in weird ways when it moves.

The export seems to have been successful, this is the log:

-- --
Skeleton created out of jME OGRE skeleton, 25 joints
Created skeleton animation clip: Walk
Loaded ogre file: girlnpc.mesh.xml, scale: 1, rotation: null
        1 sub objects, 1 skin animation(s), 0 pose animation(s)
Saved bones-group to ninja.group.bones

The model behaves ok in Bender, all vertices have been assigned weights....

Thank you for your time!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #1 on: September 19, 2011, 11:01:07 pm »
How does it look at bind pose if you don't animate it?

Code: [Select]
AnimatedGroup.get(0).getSkeletonPose().setToBindPose();
AnimatedGroup.get(0).getSkeletonPose().updateTransforms();
AnimatedGroup.applySkeletonPose();
AnimatedGroup.applyAnimation();

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #2 on: September 20, 2011, 10:05:11 am »
It looks fine. It's only when animated that it goes mayhem. Also I can't manage to launch it from the emulator, I get a OutOfMemory run time exception... The model isn't really that complex, it's only got 1600 vertices with a 512x512 JPEG texture, and there's only a cube in the scene for now...

The app does launch from my phone but it goes very slow, with the model getting distorted when animated...

Thanks for your time Raft

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #3 on: September 20, 2011, 10:40:25 am »
UPDATE:

Ok so I resolved the out of memory issue, it turns out the the model mesh was double sided, disabling that got rid of the memory problem. Also I cleared all translations and rotations of the model before exporting it

The model appears now a bit less deformed, especially when I disable the "Fix Up Axis To Y" option in the OGRE exporter, but then it faces the Y axis when animated (lies flat on floor)....

Also the Bones exporter keeps flashing a "rotation axis not normalized" warning before successfully exporting it.... Maybe that has got something to do with it?

This is the complete log from the export:

Code: [Select]
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
20-Sep-2011 09:58:55 com.jmex.model.ogrexml.anim.SkeletonLoader loadSkeleton
WARNING: Rotation axis not normalized
-- total 25 joint(s) --
0 name: foot_L, parent:
1 name: spine.base, parent:
2 name: foot_R, parent:
3 name: toe_L, parent:
4 name: toe_R, parent:
5 name: ankle_R, parent: 2:foot_R
6 name: spine.top, parent: 1:spine.base
7 name: leg.upper_L, parent: 1:spine.base
8 name: ankle_L, parent: 0:foot_L
9 name: leg.upper_R, parent: 1:spine.base
10 name: shoulder_R, parent: 6:spine.top
11 name: shoulder_L, parent: 6:spine.top
12 name: neck, parent: 6:spine.top
13 name: leg.lower_L, parent: 7:leg.upper_L
14 name: leg.lower_R, parent: 9:leg.upper_R
15 name: arm.upper_L, parent: 11:shoulder_L
16 name: arm.upper_R, parent: 10:shoulder_R
17 name: head, parent: 12:neck
18 name: head.002, parent: 12:neck
19 name: arm.lower_L, parent: 15:arm.upper_L
20 name: arm.lower_R, parent: 16:arm.upper_R
21 name: hand_R, parent: 20:arm.lower_R
22 name: hand_L, parent: 19:arm.lower_L
23 name: fingers_L, parent: 22:hand_L
24 name: fingers_R, parent: 21:hand_R
-- --
Skeleton created out of jME OGRE skeleton, 25 joints
Created skeleton animation clip: Walk
Loaded ogre file: girlnpc.mesh.xml, scale: 1, rotation: null
        1 sub objects, 1 skin animation(s), 0 pose animation(s)
Saved bones-group to ninja.group.bones
« Last Edit: September 20, 2011, 11:04:15 am by neo187 »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #4 on: September 20, 2011, 11:05:52 am »
Also the Bones exporter keeps flashing a "rotation axis not normalized" warning before successfully exporting it.... Maybe that has got something to do with it?
No, jME prints that silly warning all the time. It checks if length of vector is exactly one and if not prints that warning.

..but then it faces the Y axis when animated (lies flat on floor)....
What do you mean by this?

Also some screenshots may help

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #5 on: September 20, 2011, 01:02:26 pm »


On the left is the animated mesh in Blender and on the right the mesh in the emulator, lying flat and with deformed hands/arms....

Is there a plugin for 3DSMax to export a mesh as an ogre file? I could try to see if I get the same issue exporting from Max....

Thanks for your help!

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #6 on: September 20, 2011, 01:03:50 pm »
Yes, there is OgreMax. I really recommend it.

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #7 on: September 20, 2011, 05:09:50 pm »
Yes, there is OgreMax. I really recommend it.

Right, installed OgreMax and re rigged the character using a Max biped. No more deformations, the model animates ok, so thanks for the tip!

However the imported model is extremely tiny and upside down. I can rotate it and scale it upon loading it but when it animates it goes back to its tiny size and to being upside down. I'm guessing that rescaling at each frame is not a good idea.... should I enlarge and capsize the model or is there a better solution? Maybe there is some export option in OgreMax that shrinks it...

Thanks for your help.
« Last Edit: September 20, 2011, 05:12:46 pm by neo187 »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #8 on: September 20, 2011, 06:10:52 pm »
You should scale or rotate the model while converting from Ogre format to Bones format. Both script files and JMEOgreImporter class has support for that

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #9 on: September 20, 2011, 06:33:18 pm »
You should scale or rotate the model while converting from Ogre format to Bones format. Both script files and JMEOgreImporter class has support for that

Ok I can see that the main method of JMEOgreImporter also takes a scale and rotation method, but how do you feed those exactly from the command line? I'm guessing they'll be right after the -out and -in values... I tried "-rotation" and "-scale" followed by some values but no luck?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #10 on: September 20, 2011, 06:41:14 pm »
those script files provides help if no argument is given. anyway here is an example:

Code: [Select]
jmeOgre2Bones -scale 2 -rotation x180 -out mine.bones -in mine.ogre.xml

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #11 on: September 20, 2011, 06:55:00 pm »
those script files provides help if no argument is given. anyway here is an example:

Code: [Select]
jmeOgre2Bones -scale 2 -rotation x180 -out mine.bones -in mine.ogre.xml

Brilliant. I just couldn't find this setup anywhere in the docs... Thanks immensely, you're a really patient and devoted man ;)

One last thing and then I'll let you go (for today at least lol)... Did you set up the Ninja's animations in a specific way for them to loop continuously like they do in the Ninja's demo? Cos my one just stops after playing once...


Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #12 on: September 20, 2011, 06:58:12 pm »
yes it loops. animation index is increased every frame and when it reaches one, it starts over from zero

why don't you have a look at ninja demo's code? ;)

Offline neo187

  • int
  • **
  • Posts: 73
    • View Profile
Re: Model badly deformed when imported
« Reply #13 on: September 20, 2011, 07:07:56 pm »
well I'm actually using the Ninja demo, i have just replaced the ninja model with my own and have tweaked a few things... while with the Ninja model all animations loop with my one they just stop, that's why I thought it was a setting of the model? Mmm.. I'll try play with it a bit more....

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Model badly deformed when imported
« Reply #14 on: September 20, 2011, 07:09:58 pm »
no, no such information is imported from model. neither looping nor animation speed or duration. it's all in control of application