Skip to content

Posts tagged ‘Curves’

Using tangent direction to dictate quaternions.

June 23, 2008

Charles

Just a quick theoretical idea – I’ve been thinking that a rotation is basically the reflection or product of a direction indirectly or directly controlled by its spin.  This seems simple to understand in theory but in practice its more complex. Im coming to terms that rotation is really an illusion of a direction or a side product.

Thinking about this more in my notes, we can hypothesize that if a rotation is really just a direction, then we can seperate it into two parts: the direction and the spin and more importantly have direction controlled by anything, namely the tangent of a spline or curve. This seems amazingly simple now, the curviture of a spline dictating the direction of a quaternion about a hemisphere. But detaching yourself to thinking this way is really hard.

In this way we can treat the wrist and spine articulation the same – the spin (or twist in the conventional sence) is just used to dictate the direction of the system, with a spine you’d use the tangent of the curve itself,  with the wrist the hand  is the direction.

Modular deformation & twist

August 25, 2007

Charles

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.

Rigging retrospective (part one)

August 20, 2007

Charles

So Ive been away on vacation over the past two weeks in beautiful Montreal (an amazing city). I had time to think about rigging, ways to break it up and what it is at its heart: intergrating systems.

Rigging can be regarded as modular in one sence and choatic in another. It can also be though of a group of systems that interact with each other in simple and hybrid types of ways. There are three main ‘Driven Systems’ at its heart:

Kinematic – the animator drives the rig with keyframes, purely controlling the puppet and f-curves

Procedural – the animator drives values which adds automatic driven motion, the wave if you will doesnt however have to be procedural and handmade in a fourier synthetic way.

Dynamic – the animator drives controls in which there ‘children’ act in a physically based way. The controls themselves could also act dynamic.

Theses are the bases, but many hybrid versions of these can be combined, waves driving dynamics for instance. A rig should only support this if its really really neccesary – we need to understand what a rig needs. At its heart is what the animator wants, especially interms of control. But we can also make our own assumptions and give some basic rules in constructing a rig:

1. A rig is a series of systems.

This can be a hard idea to understand, but if we treat a part of a rig as a system than a series of joints (more of an outwardly looking in analysis), we can work out what we need. A good example is a tentacle – because were are treating this entirely as a system – e.g. a splineIK base with a layer of FK controls. The tentacle is treated as a whole unit and this is how we should look at it when rigging. Lets break it down:

A tentacle that needs to be fk, dynamic, driven and procedural – we’ll first off we can pair these together fk/procedural and dynamic/driven as a system. By doing this we can see that the fk/procedural can ‘ride’ the dynamic driven system. And this dynamic driven system itself can be treated as one: A dynamic chain solution that rides a bezier spline based on tension, and a fk procedural system that rides this in tern.

A tentacle is essentially an easy example as we regard it as unit, but can this be the same for a wing, leg or even spine? A spine or torso can be summed up as three independant units that are glued together either or additionally by a positon or a main control. It can be regarded as a system. A wing is essentially an arm, that feathers ride along and intern have dynamics (air resistance etc)

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

August 2, 2007

Charles

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.

http://adventuresinstorytelling.com/VCK/VCK_poster.pdf

I now must go to bed.

Length of a curve, without walking along it?

July 21, 2007

Charles

Is it possible to get the length of a curve without walking along it,  standard methods essentially split it into chunks and measure there total – the more chunks the better the accuracy. I’ll look into arc length and least square methods.

NURBS

March 18, 2007

Charles

Ive been looking into the math behind one of the most powerful math formulas around : NURBS, or non-uniform rational-basis or bezier splines. They have an almost majestic power to TDs and riggers, along with the allusive animated pivot. Once controlled though they offer almost limitless control of a curve using a combination of the rationality of b-splines i.e the weight. And the non-uniformality of all splines i.e the spacing.

I can understand the math, but for the life of me couldnt understand the non-uniformality – its hard to actually visualize like quaternions in a way. But with my code, I started to notice something odd – i think ive been writing the ‘basis’ function with out me even knowing. In working out the percentages in which ‘t’ [0,1] lived in, i had essentially made the knot vectors nessesary for a b-spline. So basically what this means is in theory (its all in my notes atm) that i can write a b-spline basis function that neatly ties into a polynormial function. And therefore in theory Nurbs. Working out the weights its the tricky part.

 The amazing thing with understanding the power polynormial function is that your curve can reside in any degree, i.e it can be cubic, quadratic on the fly. Based on the number of knot vectors – this is important as it the larger the degree the more complex the working out is. So if i have a curve of only 3 points, my degree can be 2, and so on. At the minute, im not going to expose the non-uniformality (its just exposing an array of knot vectors), so im just making an URB spline lol.

N = 1?

March 13, 2007

Charles

Ok so im looking into more curve math – yes I’m nuts, no im not going to show you. Most of it is over my head but im slowly understanding it, like NURB’s which I finally worked out the algorithm!! Which is kinda cool. But now for the life of me cant get my head around the recursive ‘N’ function of B-Splines i.e the Basis fn – Ni,p  So:

You have p =#(1,2,3,4,5) which are you control points and t which are basically a segment in this array infact either non-uniform or uniform eg. t=#(0,.25,.5,.75,1) Now what I dont get is Ni,p because basically if t[0,1] is within you segments eg. if t = .12 then its within segment 0,1 right and so it equals 1 and if not then 0 but its always 1 unless p[0] or p[(p.count)] when it equals 0. Its basically a step fn but its always one – i dunno I there must be more to it!

Ni,0(u) = if u[i] <= u <u[i]+1 then 1 else 0 – so if u (t) is within its segment it equals 1 else 0.

edit: i think i get it.

Defining interpolation across several knots.

March 17, 2006

Charles

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.

cubic-bernstein-polynormials.

February 18, 2006

Charles

As cox-deboor are quite simple ive started looking into cubic-bernstein-polynormials. They essentially contain 4 tangents, that can be used in defining sections of a uniform b-spline. The problem arises when defining a value along the entire b-spline – As its constructed from multiple cubic curves, and which a value along these is defined as (t) being 0 – 1.

Cox – deBoor Spline.

February 5, 2006

Charles

So a friend of mine wanted to work out a math curve – specifically B-spline curve. In any event he worked it out before me, but it gave me the challenge too. So the basic formula is:

p = p + p1

So if we imagine 4 points in space: a,b,c,d we draw a line between these by defining vectors between each segment ab-bc and bc-cd giving us a1-b1. Finally we get a final vector between a1-b1 giving us a2. The fn acts as a pattern of 2 sets eg.

1 2 3 4 = 3 5 7 = 8 12 = 20