Rotation does not export properly

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Rotation does not export properly

Post by Gräck »

Hello,

the Ogre exporter for Max does not export the rotation of bones properly. There is a very important difference between the way how rotations are displayed in Max and what value they really have. You can see the real values in the graph editor for example, in the transform tool you have only values up to 180°. If the rotation in your animation goes over 180°, the value automatically switches for example from 185° to -175°. However in the graph editor the correct value 185° is shown.

The problem is that the Ogre exporter exports the values displayed in the transform tool, the wrong values. The result in the engine is twitching and shrugging of bones, because Ogre interpolates between 180° and -180° for example, so the bone does a complete 360° rotation which does not look nice.

My question is: Is there a reason why the exporter takes the displayed values rather than the real values?

Thank you very much in advance.
genva
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1603
Joined: Wed Oct 20, 2004 7:54 am
Location: Beijing, China
x 1

Post by genva »

Ogre by default rotation is done using shortest-path algorithm. I think there no difference between rotate 180° to 185°, or rotate 180° to -175°.
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

Thanks for your reply, Genva. If there is no difference, why does my bone animation look like this?:

http://www.graeck.de/showroom/anim_example.avi

You see, arms and legs are twitching heavily.

Here's one of the concerning parts (example left upper arm) in the xml file:

Code: Select all

	
						<keyframe time="4.29978">
							<translate x="0.0" y="0.0" z="0.0" />
							<rotate angle="-0.357451">
								<axis x="-0.718313" y="0.323051" z="0.616169" />
							</rotate>
						</keyframe>
						<keyframe time="4.33312">
							<translate x="0.0" y="0.0" z="0.0" />
							<rotate angle="-0.357082">
								<axis x="0.585809" y="0.389987" z="0.710449" />
							</rotate>
You see, x rotation jumps from + to - with a quite high value.

And what max is doing here with the x rotation:

frame 129 (keyframe time="4.29978"): -355.834
frame 130 (keyframe time="4.33312"): -375.93

You see, the problem occurs when the rotation gets lower than -360°.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

Here's the complete Sinbad answer directly from forum search function :

http://www.ogre3d.org/phpBB2/viewtopic. ... 6718#66718
User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

Thanks for reply, tuan kuranes, but this does not solve the problem. I can use as many keyframes I want, nothing changes. There will still be the interpolation from for example 180 to -180, it doen't matter if the time between those keyframes is long or short. You will still see the problem in the engine.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Post by tuan kuranes »

User avatar
Gräck
Gnoblar
Posts: 14
Joined: Thu Sep 23, 2004 2:05 pm
Location: Frankfurt, Germany
Contact:

Post by Gräck »

This would work for propellers or tyres, but not for character animation I think. Before exporting I create one key for every frame (collapse transform) and then use key reduction, because I want to convert my spline curves to linear curves without losing animation accuracy. So there are different keyframes dependantly of the size of the rotation angles. So reoperations would be much too complicated or even impossible.
User avatar
BlasterN
Gnome
Posts: 378
Joined: Thu Mar 24, 2005 1:07 am
Location: Spain
Contact:

Post by BlasterN »

I solve the problem once.

I use biped so if you don't use it maybe you can't solve it with this aproach.
I have an animation of jump & turn like UT2K3. When i see the bone is "twitching" i make two KEY FRAME in the next two frames.
Supose 0 is the last good frame 1,2 the two new ones.
I select the biped in "0" i copy the pose. goto frame "2" & paste the pose.
You have to Add two blank frames after the 2, (because you changed two frames into key frames)

When you export the animation you have to delete the keyframe 0 & 1 in the XML.

Why create two keyframes? I try it with one but don't work, so i create 2.
Works:
MapToMesh | Bengine B9 @ www.sourceforge.net/projects/maptoogremesh/
3DWorldStudio exporter@ www.blastern.info
Post Reply