# Posts tagged ‘Math’

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.

I tend to think in small chunks – I break down an idea, work out each part and then put it back together hopefully. I’m trying to use this approach with dynamics – I’m looking into a simple system to handle a variety of situations. Currently I’m thinking of simple spherical detection. This method use just a diameter from a point – its a simple system, but it might be scalable for more complexity.

Dynamics I find very hard to get to grips with, I have to take it very very slowly. Just understanding derivatives is hard, as its the function of the equation. Its also very fragile as a system – finite tweaks make big changes, especially in complex systems. My aim is to build simple systems that can be ‘bolted’ together right across the board from dynamics, to transformation stuff. Its sort of the middle man of rigging. I’m not the string or the parts of the puppet, im the knots that tie the string to the parts.

Edit: My last post was more of a hinderance  than a help, so i took it out.

In my  last post I discussed a possible way of doing animation pivots – it sadly was just notes in my book and spare of the moment ideas. I think i missed out a vital chunk, and i think in theory I can make it a little cleaner – weak referencing not needed.

So this is still theoretical, but if we examine a standard object matrix3 transform it contains the transform space and its pivot space i.e the offset to keep it in the right position. So if we essentially generalize this idea (i.e making itself over the top of itself) i think we can work it out.

I’ve been looking into curves for quite awhile now, along with waves and dynamics eventually hoping to combine all three. Along with these ive been trying to understand the rules of rigging especially layer and hierachal rigging. A lot of riggers i know dont undestand the idea of ‘layers’ in a rig. In simple terms its like a layer in photoshop but in rigs it free up a lot of issues if you keep aspects of a rig to a layer – so for example your base skeleton could be your first layer, then basic setup then twist, then deformation. So its more like layered relationships – deformation is a good example. If we can modularize deformation in a simple system we can use it all over the place.

Major deformations like  skin simulation are outside of this, but twist, stretch, compression and bulge could be driven by one system. If we treat this system as a curve the issue arises is that its not uniform so control objects along it would bunch up so we need:

• A simplified curve, that possibly introduces horners rule (for speed)
• Uniformity across the curve (important if the tangent vectors are straight)
• The ability to overshoot the curve at both ends* (-0.5, 1.5)

*Why do we need this, well basically to allow for length between the points along the curve to be maintained, for example if we dont want the curve to compress the points along it need to overshoot the curve. This can be pretty simply acheived using a subdivision method. To keep a value at the same value i.e a length of 10 along the curve, all we do is divide this length by the curves length eg. 10/100. = 0.1 10/200 = 0.05. Problem comes in if the length of the curve is shorter than the defined length the ‘bucket’ inwhich t resides wouldnt exist. So you need to do some fiddling around. I’ll post some links accompanying this post.

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.

Probably the most important aspect of rigging, infact what we can sum rigging up is relativity – everything relies on. If its the mesh its relative to a skin, the to the bones and the bones to a rig. And even at the finite level the controls of the rig are relative to a other controls – they exist in a space of there own but are relative to something else even if this is the world.

Rigging is relativity and reference – its a bold statement but is the basis for everything needed. Everytime you parent or constrain an object to another you set its relativity and its reference. The key to rigging is a system where both dont fight but work hand in hand with one another. A good example is the spine – the animator wants control of the hip, chest and head. But also wants control of the torso (everything) – they also dont want counterotation and the ability to hold a pose.

Its a lot of systems but if we boil it down to relativity and reference its relatively (pardon the pun) straight forward. The hips are parented to the torso – so we have defined a refence: the torso and a relavity (torso-hip) to work in. The chest is parented to the torso, the same applies here. But the head is different the neck is really a part of the spine and really moves with the chest, but the problem comes in that we want it to move with the head when needed.

So we define 2 references – firstly we set the heads position relative to the chest, but its rotation to the torso. This means when we rotate the chest the head moves with it but crucial stays pointing at a target. But additional if we move the head the neck will follow – this is via an ik system or lookat/pole vector – simple stuff.

So when building a rig really understand whats relative to what, and understand the methods and math of space.

Ive just started being able to read math notation correctly. One of the stumbling blocks was sigma. I knew it was summation, but how it works with the other parts/equation was where i got stuck at. This is a Full-wave Rectified Sine; i’ll explain how I turn it into maxscript soon.

Defining a curve segment is for a Nurbs, Cardinal or Bspline is not too hard. The key being the use of two knots and two tangents – these being derived for the cubic-bernstien-polynormials. Its defining these in the first place thats the key to the curve type.

For defining a value across several knots takes a bit more work. First we define the knots and tangents eg. knots:#(10,20,30,40) and tangents: #(#(15,18), #(23,27), #(33,38)). Next I assume a percentage value  for each knot eg. #(0,33.333,66.666,100) – This is derived from the knots count.

So we have our knots, there tangents and its percentages. Next we take our input (v) value eg. 55% and find which segment where in based off the percentage – so therefore 55% is in segment 33.333 – 66.666.  We’ll call these start_p and end_p.

Now we take end_p from start_p to get 33.333. So r = (end_p – start_p). We then take start_p away from our inital (v) value so (v-start_p) giving us 21.667.  Now we multiply (v-start_p) by r.

r*(v-start_p) giving us 722.222 and we then divide this value by 100 (our range) to give us 65.0. So now this is input value for our polynormial but it needs to be in a range of 1 so we divide by 100 giving us 0.65.

We know the knots now, using the start_p and end_p giving us 20 and 30. Now we need the tangents; all I do is have an array of each set inside a nested array eg. #(#(15,18), #(23,27), #(33,38)) – so now we use the start_p again which is 2, so nested array 2. Then all we use is [1] and [2] of this nested array array.

*There is one bug with this system. When the input value goes past 100, or 1 depending on your scale it then falls into a new segment. So i add a new value on the end of each array to compensate.

This example is for a bspline curve, when using Nurbs, Cardinal or even straight interpolation you dont need the tangent array. But more complex math to define these tangents from the inital knots is needed. – Plus the start and end knots use slightly different math as theres no opposite tangent to define. With Nurbs you need an array of weights too.