Cage opened this issue on Apr 03, 2010 · 610 posts
millighost posted Tue, 22 March 2011 at 5:50 PM
Quote - Thanks, EB. :lol:
We've all encountered gimbal lock in Poser, surely...? That's the demon in eulers showing. :lol:
The first link in a chain isn't rotating relative to a parent, but to UNIVERSE. This means the angles being handled are likely to be more extreme, making that link more sensitive to the risk of a bad euler conversion which points it the wrong way.
The first link of the chain of bones turns relative to the body of the figure, perhaps this is where your error is, or do you mean by "first link" the body?
Quote - A euler rotation apparently has an infinite number of equivalent rotations which can offer the same orientation. Any euler conversion code works around this by making certain assumptions about how to get the right one. Whenever an angle of 90 degrees or greater comes into play, there's a risk of a bad euler conversion. The assumptions just can't be correct all the time, with so many possible solutions. (Or such is my understanding.... :unsure:)
This is true, thinking about the chain problem, however, the situation should not be that difficult. For the chain links, i would initially completely ignore the twist component, since for a real chain (made of stainless hardened steel) you cannot turn a single link by any substantial angle without effort. So you could just assume twist is 0. That leaves 2 angles to specify the direction of the link. E.g. on earth, we could use longitude and latitude to specify the current orientation of our home planet. You only have to decide which one should be the one with the larger range; on earth we usually use longitude between -180 and 180 and latitude between -90 and 90, so longitude has the larger range. Within these limits the angles are unambiguous.
So if you only want to pose the chain links, you might want to set the twist to 0, limit one angle to -90/+90 and you will not get any gimbal lock. Then, after the whole chain is posed, with all twists zero, then assign twists, for example by averaging them over the whole chain.
The difficulty (for me at least), was to figure out the different rotation orders; unless i wanted to build a new chain around the pose, i can only use the rotation orders of the links that are stored in the individual actors, resp. links, and these might not be the same for all links. In most cases they are the same for every link, but often it is not the case for the figure-body. Meaning, if the rotation order is XYZ with Z being twist, i have to apply the rotations in the order ZYX, and if i already calculated the angles for XYZ i could not use them (there is no easy way to convert euler angles from one system to another i am aware of).
Quote - There may be no way to resolve this, in Poser. In other software, you can set rotations using quaternions, which don't have the same problems. Unfortunately Poser Python allows one to query an actor's quaternion rotation, but you have to set the dial values with euler angles.
I am not sure if quaternions would be of great help here, since they often are not doing what i expect them to do. If you ever tried to apply a curve modifier in blender using a curve that is not aligned against the x-axis, you know what i mean. Very hard to understand what is going on IMO.