# How can X, Y, Z and W go above one in a quaternion animation on Blender?

I am trying to import a collada file generated by Maya on Blender and that file was exported using what I think is the correct representation of a quaternion (x, y, z and w elements are between 0 and 1) and that file is not imported correctly by blender.

I am not an expert in mathematics but as far as I know, the elements x, y, z and w on quaternions are normalized, so they should never go above 1, they always vary between 0 and 1. So, Maya is correct.

When I create a quaternion animation on Blender, I see that Blender allows these elements to go above 1 and apparently the sky is the limit.

How can that be? Is there a way to make Blender work with quaternions between 0 and 1 and import that file correctly?

• The exact wording of the question (last sentence) is a little awkward and probably contains some incorrect embedded assumptions. As has been pointed out in other answers: blender works with quaternions in the -1..1 range just fine. Can you post a .blend file that has the problem, and explain which effects are problematic with the animation? You might not have a REAL problem, instead just being disappointed with some hidden nuts&bolts. Apr 1, 2016 at 15:21

But....Blender does work with quaternions between 0 and 1.

There's an interesting video put out by Nathan Vegdahl (that's part of his Humane Rigging series) that discusses quaternions: https://www.youtube.com/watch?v=FRD0PgsY3pU&index=14&list=PLE211C8C41F1AFBAB If you go to about 10:31 in the video, it talks about quaternions only being valid between 0 and 1. By 11:09, he mentions what Blender does with values greater than 1.

Not sure what would prevent the file from being imported correctly.

If you just need an orientation, then having the values between 0 and 1 is fine. But can you define a rotation three times around the objects axis? Isn't it the same thing as with euler rotations where you wouldn't need to enter a value above 360º since at that point you've ended up at the base orientation, but if you want to define a rotation that goes on round and round time after time, then it makes sense to use bigger values. Are you exporting/importing a quaternion rotation animation, or just orientations? What value does Maya show when you switch to euler? Maybe Maya displays quaternion values between 0 and 1 but internally keeps other records?

This link is semi-related, in that it uses similar logic as to the resetting of values in rotation.

You can parse your file to the following logic, to solve your particular problem.

I will use pseudo code to represent it, and if time allows, or somebody else can implement it, then feel free to modify the answer to suit, in my case I'm not all that familiar with Quanterions (hoping the value of 1 = 1 Revolution), or the Collada file format, so I don't know how these values live in terms of storage, however the logic should suffice.

#for every place this occurs replace the target with this logic
if axis.rotation >= 0.0000000000 && axis.rotation <= 1.0000000000:
#then do nothing
else:
return float("0." + str(axis.rotation).split('.')[1])


Like So

• Surely something like x - int(x) is better than string splitting, string addition, then float conversion? Apr 1, 2016 at 3:03
• I agree if we are talking inside of Blender, but if you are parsing text inside of a file, I'm not certain if I took the wrong approach? I know that I set a float to begin with in my last example, but the actual place for where this needs to occur is from something like a file.readline() function. Which in my mind would likely return a string, so to be safe about it, I still maintain that you should probably use the conversion approach as posted, even though it looks a little counter-intuitive. Thanks for looking out though. Apr 1, 2016 at 5:57