Skip to content

Posts tagged ‘Algorithms’

Facial Research..

December 9, 2006


I took another look at some research on n-space combination sculpture today and the light-bulb ( i think) finally went off in my head as to how it works. Essentially you have four parts:

  • A n-space comprised of weights
  • A set of targets (i.e shapes)
  • An orgin/neutral shape
  • A vector (the sum of the weights)

The old ideas of standard blendshapes basically go out the window, but the power you gain is pretty amazing – and in theory can be used for any facial type setup including bones and muscle rigs.

In simple terms, you associate a target(shape) to a weight,this for all instances is standard blendshape stuff – but with n-space combinations you can associate a target to more than one weight.

 For example lets say we have two targets: A and B, and there respective weights: w1[1,0] and w2[0,1] remember weights exist in an n-space so if there was 3 it would be as follow w1[1,0,0] , w2[0,1,0]  and w3 [0,0,1]. These do nothing atm, until we associate a target(s) to them so e.g target a is associated to w1 at [0.5,0] ( a target doesnt have to be at 1 of the weight)

 Still follow? Well simply put we define a space from weights so point1 would be just one weight, a point2 would be 2 weights and a point3 would be three weights.. and so on. If we have a space of the nth number its an n-space so if we have 30 weights, i.e sliders in our rig we have…. yes….. an n-space of 30 dimensions!

Now the clever part comes in that the system basically cant break. The cool part comes in that you can associate a target shape to 1 or more weights(sliders)! so say we set weight w1 at a value of 1 so [1,0] and w2 the same [0,1] we now have a combined value of: [1,1] and this shape combination may not work. So we associate a new shape to this weight vector.

All that changing the value of the weights does is that it moves a vector through the space of what its comprise of eg. 3 weights [.3,0,0] [0,.2,0] [0,0,.7]  we have a vector in this space: [0.3,0.2,0.7].

What i dont fully understand is achieving the final, delta. But im working on it – the funny thing is Jason Osipas setup is very reminesent of this n-space idea, working in planes etc. And could easily i think be adapted to work with it.

more to come..


March 30, 2006


Ive just started getting the hang of derivatives – the fundementals of calculus. Im starting to get the hang of limit to. Today I  understood the tangent (x,f(x)) and once I get to grips with this lot, hopefully I can start doing some more clever stuff.

Full-Wave Rectified Sine.

March 25, 2006


Converting math notation into maxscript can be quite difficult, take our full-wave rectified sine equation. It contains sigma (summation) of n=1 to infinity do cos(n*omega*t)/(n^2-1). So in max this cant happen as its a for loop going from 1 to infinity adding the results! So we have to use less iterations.

Sigma is basically a for loop adding up the results, where as PI (II) is multiplication of the results. With this knowledge we first have to get our variables:

t = time

0 = omega

a = amplitude

r = 0

(r) is used for the summation of cos(n*o*t)/(n^2-1) which we get with:

for n = 1 to 30 do


 r = r + (cos(n*o*t)/(n^2-1))


So now we have (r) which is basically the accuracy of our equation, we could go to 1000 iterations but max would probably crash. Now all we do is multiply the front of the equation by (r):


Math notation.

March 21, 2006


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 interpolation across several knots.

March 17, 2006


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.


February 18, 2006


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.