Page 1 of 1

Rotation does not export properly

Posted: Mon Aug 15, 2005 10:27 am
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.

Posted: Mon Aug 15, 2005 10:39 am
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°.

Posted: Mon Aug 15, 2005 2:35 pm
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°.

Posted: Mon Aug 15, 2005 2:50 pm
by tuan kuranes
Here's the complete Sinbad answer directly from forum search function :

http://www.ogre3d.org/phpBB2/viewtopic. ... 6718#66718

Posted: Mon Aug 15, 2005 3:13 pm
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.

Posted: Mon Aug 15, 2005 3:34 pm
by tuan kuranes

Posted: Mon Aug 15, 2005 4:07 pm
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.

Posted: Wed Aug 17, 2005 10:01 am
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.