Log In
New Account
Home My Page Projects Blender 2.x BF release
Summary Activity Tracker SCM Files

Blender 2.6 Bug Tracker: Browse

[#25700] 2.56: Rotation Mode: Quaternion shows wrong orientation of the object

Date:
2011-01-18 12:09
Priority:
3
State:
Closed
Submitted by:
Sebastian Herholz (sherholz)
Assigned to:
Konrad Kleine (kwk)
Category:
Modifiers
Status:
Fixed / Closed
Relates to:
Duplicates:
Patches:
[#25701]
 
Summary:
2.56: Rotation Mode: Quaternion shows wrong orientation of the object
Detailed description
Hi,
First off all props for the Blender 2.5 development Team. I really love blender 2.5
Since I switched to the version 2.56/2.56a I realized that ther might be something wrong with the
calculations or handleing of the quaternions.
When I change the Rotation Mode of an Object from Euler XYZ or anything else to Quaternion.
The object changes its Orientation. The Quaternion presented in the GUI seems to be okay. But the orientation of the object is
messed up.

Here is a small example:
-open blender (you will se se standard cube in the middle)
-in the object propety change the rotation mode to Euler XYZ
- set X rotation to 45deg (Y and Z to 0.0) (see image1)
-change the rotation mode to Quaternion (quaterion presented is (w:0.924 x:0.383 y:0 z:0) which is a correct roation of 45deg around the X axis)
-you will see that the orientation of the object changes (image2)

This is a problem when setting up your scene using Quaternions cause what you se is not what you get.
This Problem also influences an exporter I am using to export blend scenes to ogre.

In blender 2.55 everything works fine.

Cheers

Sebastian

Followup

Message
  • Date: 2011-01-18 13:56
  • Sender: Konrad Kleine
  • Hi,

    I have no experience in using quaternions in blender but one thing I do notice is that one can manipulate all the parameters (WXYZ) of the rotation quaternion. As far a I remember, if you want a quaternion to rotate some object, the quaternion needs to be normalized. If you mess with the rotation quaternion parameters you could end up with a quaternion that is not normalized. In fact in most cases you would need to renormalize it. Which is done automatically by blender when switching between Euler and Quaternion rotation type.

    No back to your problem. I can confirm the behavior you described in a recent SVN build. And what is even more dramatic is this:

    A quaternion rotation around 45 degrees is actually displayed as a rotation around 90 degrees. In fact a quaternion rotation around an arbitrary axis is applied with a double of the angle.

    Here's how you can try it:

    1) Open Blender with default cube scene.
    2) In the object properties change the rotation type from "XYZ Euler" to "Quaternion (WXYZ)".
    3) Switch to orthograpic side view (Hit NUMPAD3 and then NUMPAD5).
    4) Rotate around the x axis with the mouse (Hit RKEY + XKEY and then move your mouse).
    5) Watch the angle in the lower left side of the 3D view window as you move your mouse. And notice that if you roughly rotate around angle "alpha", "alpha/2" is displayed. You can also hit CTRLKEY to use stepwise rotation.

    If you want you can repeat the same in "XYZ Euler" rotation mode and see that the indicated rotation is correct. Meanwhile I try to find out what's wrong with the quaternion rotation display and from where the angle number comes. In other words, which part of the code is responsible for displaying this number and where is it calculated it. My first searches brought me to "source/blender/blenlib/intern/math_rotation.c" but we'll see.

    One last note: Since objects and armatures share the same rotation code you can easily repeat the behavior with a single armature bode. It'll also rotate twice the magnitude of the angle you've entered.

    In other words: Sebastian, what you've found is a general error with quaternion calculation. Since a 45 degree rotation in quaternion mode currently is displayed as a 90 degree rotation, it looks like your cube's rotation is reset to zero rotation. But in fact it has rotated!!!

    I hope this helps!

    -Konrad-
  • Date: 2011-01-18 13:59
  • Sender: Konrad Kleine
  • Sorry, I've made a few typos but here is an essential one. It had to be "2*alpha" instead of "alpha/2":

    5) Watch the angle in the lower left side of the 3D view window as you move your mouse. And notice that if you roughly rotate around angle "alpha", "2*alpha" is displayed. You can also hit CTRLKEY to use stepwise rotation.
  • Date: 2011-01-18 16:04
  • Sender: Konrad Kleine
  • Your reported issue has been fixed in SVN. Thanks for taking the
    time to report!.
  • Date: 2011-01-18 16:04
  • Sender: Konrad Kleine
  • I've committed the patch to SVN and from revision 34390 on your bug should be fixed.
  • Date: 2011-01-18 16:10
  • Sender: Konrad Kleine
  • Attached patch number to provide more info on the fix.
  • Date: 2011-01-20 17:27
  • Sender: Sebastian Herholz
  • hi Konrad,
    Thx for the fast patch.
    everything seems to work fine now.

    Cheers

    Sebastian
 

Attached Files:

Name Date Download
blend2.JPG 2011-01-18 12:09 Download
blend1.JPG 2011-01-18 12:09 Download

Changes:

Field Old Value Date By
status_idOpen2011-01-18 16:04kwk
close_dateNone2011-01-18 16:04kwk
assigned_tonone2011-01-18 16:04kwk
StatusNew2011-01-18 16:04kwk
File Added14604: blend1.JPG2011-01-18 12:09sherholz
File Added14605: blend2.JPG2011-01-18 12:09sherholz

Changes:

Blender 2.x BF release: Patches
   [#25701] Fixed quaternion rotation bug from #25700 (Relation: Patch for)