Skip to content

Posts tagged ‘Gimbal Lock’

Rules on modeling for games, and deformation.

October 7, 2008


As I’m currently in the process of skinning many meshes for the current game I’m working on here are some rules I’ve learnt on the way:

  • Don’t attempt to skin spherical deformation without having bones for deformation or quaternion based skinning methods. Key places where this must happen is the shoulders, thighs, elbows, knees, wrists and ankles.
  • You don’t need lots of twist bones, three including the actual bone is enough e.g shoulder *deformer bone, main twist (100% to upper arm with a direction pointing to the deformer bone), 50% twist bone, 0% twist (100% to the upper arm)

*By deformer bone i mean a tweak bone/point, etc  has average deformations between the  shoulder and upper arm. Similar to elbow or wrist deformer bones.

  • Don’t model the wrist/hand attached to the sleeve, tuck it inside and treat it as an element. The same applies to the ankle/foot and trouser leg.
  • If you don’t see the underside of a mesh, don’t model it, cap it off. A good example of this is a skirt.
  • The deformation of the wrist is not the same as the elbow or shoulder; the shoulder can be considered a one dimensional quaternion – in this i mean its twist is dictated by its direction.  The wrist could be considered two dimension as the first quaternions direction dictates the rotation space (one plane) for the second quaternion to ride on.  The wrist bone dictating the direction for the hand to ride on, as oppose to the upper arm bones direction dictating the entire deformation of the shoulder.
I’ll discuss more on the differences of the wrist compared to the shoulder in later posts.

Shoulder rotation – the constant rotation and reference.

October 21, 2007


A simple problem, with your arm out t-pose palm flat (facing down) do this:

  1. Rotate you arm down to the side, then forward (You’ll notice the bicep faces up)
  2. Now go back to your arm out. Rotate it forward (the bicep will face to the right or left now)

We have an oddity here, and I think it’s one of the founding principles of biomechanical rotation, it ‘resolves’ itself. When two rotations meet the union causes another plane of freedom to be introduced – i.e the top of the bicep will twist 45 degrees with your arm going forward and -45 going backwards. Looking at this from a math perspective its spherical rotation. (a quaternion)This spherical rotation similar to a quaternion is what stops the arm from twisting itself off its joint. The muscles are are treating its ball and socket joint as a spherical rotation or in other words a quaternion. Now this may not seem interesting but this is before there’s been any rotation of the elbow.I.e the twist of the upper arms is brought on by the constant rotation of the shoulder  and its resolution or twist,  is brought on by the rotation of the elbow. This is why it can be hard to get a frame of reference for the twist. I’ll see if i can update this with some pics.

Using VCK with a transposed arch length method to get rotation about the elbow.

August 2, 2007


I posted this at cgtalk

Has anyone though of using VCK with a transposed arc length method to get rotations about the elbow? Basically VCK ‘vector coupled ik’ is an ik chain driven by the vector magnitude to positioning the goal whilst having standard rotation for general fk, it basically allows you to break the ik and add nice arcs to the animation – the problem i see with it is you cant drive about the elbow. But what if we use a transposed arch length method, which would ontop drive the general rotation and the magnitude we could get rotation about the elbow- this could even have its own fk controller driving additively over the top i think -you need just a few variables such as bone length, as you drive it as an additive to the main control i.e a layer over the top.

I now must go to bed.

Modular continuity

July 31, 2007


Im looking into areas that can essentially be shared  – modular continuity between arms/legs etc on biped and quadrapedal rigs (even bird rigs). Its opened up some interesting ideas namely to first break the lower arm in half and some oddities in the foot.

Breaking the lower arm in half basically allows for a front arm to act like a front leg of a quadrapedal – why is this important well for one thing it allows a quadraped to act like a biped and vice versa. It doesnt mean you would nessesarily use it in a biped rig, but its a simple additional that allows for the control.

For the foot rig – ive seemed to find a stumbling block namely where the control of the foot goes? In human locomotion the pivot exists at the heel, but when its on the ground its at the ball. The problem is even more compounded in that we both swivel and hinge about the heel – hinging is a simple heel<>ball setup, but swivel is more of a problem. Do we change the transform space of the main control if its at the ball or add an additional layered control?

The problem is exactly the same and virtually opposite if the main control is the ankle, you get heel and swivel control but ball of foot swivel is lost.  Its not truely lost, you could drive its z rotation of the roll controls z rotation but, as where dealing with ik system our trigonometry plane space would freak out and the foot as a whole would twist – the old gimbal problem looming as two rotations overlap each other.

What is a rotation?

September 27, 2006


A lot of people are confused by this, and in one sence its the software duping the user into thinking that there rotation, be it local or world is what it actually is. Rotations arent angles there either a collection of vectors from an origin or a vector and a twist as in angle axis or a quaternion – quaternions are slightly different in that they have two sets – imaginary in 4 dimensions and referenced in 3 dimensions. The twist i.e w of I, J, and K is part of the algorithm and cant be torn away.

The matrix is the easiest way to understand, imagine a graph in three dimensions 3 arrows one down the x, one down the y and one down the z.  Now you derive three vectors, three points on the graph for each axis.

Now the length of the line from the origin [0,0,0]  to each vector is the unit length, and by adding them all up should equal 1 – this is important and is also known as normalisation. Why is normalisation important well first off scale and rotation are linked in a matrix, scale I regard is a happy result of rotation. The normalised unit length being 1 means a scale of 100% 0.5 = 50% and so on – you can still get non-uniform scaling.

Now another import part is each vector, they have to be 90 degree from each other. Else what happens – well you get sheering, because scale is a result.

So in essence your defining an axis for the rotation, with three vectors from the origin like so:

([1,0,0], [0,1,0], [0,0,1] [0,0,0]) – the first three are you vectors to build your rotation, the last is position. Position is simple its just an offset from the origin.

Now another factor is the parent – transformations are relative to the parent. So if theres no parent then [0,0,0] position would be world center. Where as if it had a parent, [0,0,0] would be the parents pivot.

 Euler is a bad way of representing rotations, because its really a system to make each vector x y z. Gimbal lock occurs because an axis after being evaluated, doesnt re-evaluate itself when the next is rotation. So when you rotate x 90, then y 90. Y is adding x – and so on and so forth. It means that once you get to z, your rotating x too because x has been rolled onto two axis.

One way to solve this is to project the axis into quaternions and re-evaluate the axis everytime you rotate it.