Animations just straight up wrong?

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
Skwint
Gnoblar
Posts: 9
Joined: Mon May 21, 2012 3:51 pm
x 2

Animations just straight up wrong?

Post by Skwint »

Someone had an issue that looked a bit like mine, but he solved his, so I've decided I should have my own thread. I started in here (no replies):
http://www.ogre3d.org/forums/viewtopic.php?f=8&t=78486

I have made a very simple model - a sphere with two "arms" extruded from it - and attached a very simple armature (root->shoulders->arms).
It basically wiggles the arms around a bit in an animation, in blender. Exported to Ogre, both my app and Tiger Viewer, it seems to leave the ends of the arms stationary and wave the shoulders.

Could anyone who has time please take a look at it and tell me if they have the same problem? Or even what I've done wrong?
Attached is a link to a junk.7z which contains the .blend file and the exported .mesh and .skeleton.

http://sites.google.com/site/squirmy/junk.7z

Thankyou for any help!
Skwint
Gnoblar
Posts: 9
Joined: Mon May 21, 2012 3:51 pm
x 2

Re: Animations just straight up wrong?

Post by Skwint »

I've narrowed this down to a chain of 3 bones, 4 vertices and 2 triangles. Still broken. Looks distinctly like it is rotating the correct vertices the correct amount around the correct axis but around the wrong origin. Trying to follow the source code to debug this, but anyone who knows the area and can help would be very welcome!

It would appear to be outputting a .mesh.xml file in which the positions of vertices are only half what they should be (scaled 0.5 to their coordinate values indicated in ogre), but a .skeleton.xml file in which the bones are at the size specified in blender, with the result being that bones which rotate around a point other than the origin distort the mesh around a point twice as far from the origin as it should be, relative to the vertices.

The most obvious thing to look for would be a scaling factor somewhere, but honestly, I can't find one. My object and armature both claim a scale of 1.0 in blender.

Can anyone help? please?
Skwint
Gnoblar
Posts: 9
Joined: Mon May 21, 2012 3:51 pm
x 2

Re: Animations just straight up wrong?

Post by Skwint »

Oooo-kay - think I've got it. It's a combination of two "bugs", one in Blender and one in Ogre. I'm sure the Blender people will tell me it's not a bug, and the Ogre people will tell me it's unimplemented. Sod that.

In Blender it would appear to be possible to scale your object in object mode without it showing up as scaled in the object properties, if the object has an armature. The only way to find out is to delete the armature completely - simply deleting all the bones is not sufficient. In Ogre it would appear that if you export an object in this state, the vertices scale but the bones don't, resulting in the wrong origins being used for rotations.

So, in short, never apply scaling to anything in object mode, and if you export your model which animates just fine in Blender and ogre tries to twist it's arms and legs off, you've scaled it without realising it, and need to delete your armature completely, then make sure your object is scaled to 1.0, and then rebuild your armature again.
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Animations just straight up wrong?

Post by cyrfer »

What happens if you 'apply' the scale? In Blender's 3D view, try the menu Object->Apply.
http://wiki.blender.org/index.php/User: ... formations
Skwint
Gnoblar
Posts: 9
Joined: Mon May 21, 2012 3:51 pm
x 2

Re: Animations just straight up wrong?

Post by Skwint »

Just tried. No effect, in blender or in ogre after export.
Post Reply