Tuesday 28 February 2012

Learning Notes - Python and Mel


I've played with Mel, (Maya embeded language), on and off over the years but, to be honest, I never dug deeply into it. I can't figure out why - would have made life so much easier. I'm thoroughly enjoying the process of learning Mel and python at the moment. It's so very addictive.... and helpful :)


Here is a few of the basics in mel...
Data types
Integers
          int $areWholeNumbers = `##`
Floats
          float $areFractions = `##`
Vectors
          vector $areX,Y,ZPositions = <<X,Y,Z>>
Array
          $##[starts at 0]
Conditional  Statements for mel
<: - less then, >: - greater then, == - equal to: != - not equal to, >= - greater or equal to: <= - less or equal to ?: -if else && -logical and || -logical or  +,- -plus,minus ^ -vector cross product / -divide * -multiply % -modulo ++, -- -increment,decrement by 1 ! -not
  Loops/Iterantion in Mel
While-Loops
    example;
          int $x =0;
          while ($x <10)
          {
                      $x =$x+1;
             print ($x + "\n");
          }
For-Loops   (loop start)   (loop end)   (increment)
    example;
          for ($t=0; $t<6; $t=$t+1)
          {
                       joint -name ("naths_" + "_jnt");
          }

For-In-Loops
    example
     select bob;
          string $bobsInHere[] =`ls -sl`;
          for ($allBobsAtributes in $bobsInHere)
          {
                    string $bobsAtributes[] = `listAttr -write $allBobsAtributes`;
                   for ($bobsWritable in $bobsAtributes)
                    {
                              print ($bobsWritable + " is a writable attribute of bobs" +"\n");
                    }
          }


Do-While Loop 
   int $t = 1;
        do 
{
    $t += 3;
print ($t + "\n");
}
 while ($t <= 10);


Special Characters of note
\ =escape,
\n = newline,
/t = tab,
 \r = carriage return
Procedures

An example is a global procedure. The procedure is called from memory with the bottom line and arguments are given for width, height, depth and name.
Example;
  global proc nathansCubeIT (float $width, float $height, float $depth, string $name)
     {
          polyCube -width $width -height $height -depth $depth -name $name;
     }
                                      nathansCubeIT 5 6 4 nathCube;

Thursday 23 February 2012

Stretchy Ribbon Spine


I've been experimenting with different ways to deform and animate my "Secret Life of Objects" characters.

They all twist, stretch and squash....

Previously I used a stretchy spline Ik. This is a really simple technique which involves joints being spread evenly along, and constrained to, a curve. The curves length, (when it’s stretched) is divided by its initial length and the result is input into the joints scale so that the length of the joint chain matches that of the curve. Unfortunately joints are straight and the curve is… well… curved so the last joint on the chain sometimes overshoots the curve length. Rotate values are passed evenly between the top and bottom controls with an up vector object.

A slightly old but great set of tuts by Aaron Holly uses a “ribbon spine” instead.

Instead of a curve Aaron uses a nurbs surface and parents the bind Joints under follicles created on that surface. The surface is then bound just like the stretchy spline with joints for animation and aim vectors are used to constrain the direction the joints point. Rotational values are output from top and bottom controllers as a percentage relative to the joints position which is then averaged and fed into the joints to evenly distribute them. The center joint, for example, receives 50/50 from top/bottom. 

The benefit is that you can turn/rotate your character as many times as you want and the scale of the joints won’t overshoot – nice. Here is a little test I did with ten joints and three mid-section controllers. They don’t quite rotate the way I want but it will eventually... I also want to create a script for my S.L.O.O rig once I figure out how to get the animation features I want/need - a good excuse to learn mel.



Wednesday 8 February 2012

Lip Sync Test

I recently had a read of Jason Osipa’s book "Stop Staring" and what a great book it is.  I can instantly see the potential in Osipa's way of thinking regarding Visimes Vs Phenetics. Time to go back to basics and learn to do this properly. This is a quick test so it's a little average but it's very quick. 

 

I never knew my voice could sound like that :)

One thing I should make note of for myself comes in the form of the McGurk effect which shows us that the visual shape of a sound  can over ride the sound itself - for example "B" can become "F". HERE is the link to a BBC documentary about it. This is one of the reasons that visuals shapes have to look right or the viewer might be confused. 

Saturday 4 February 2012

Sticky Lips in Maya


Just playing around with this Maya pluggin for sticky lips...
Video:


Might take some playing but kinda cool and useful for lots of stuff :)

Wednesday 1 February 2012

WIP - Facial Rigging - Primary Facial Expressions

I rigged this head with a little UI in Maya and incorporated the primary expressions of Contempt, Fear, Anger, Disgust, Happiness, Sadness and surprise. I don't think it would really work for animation but it's fun to play with...


 

P.S. You can take the Paul Ekman Micro Expression sample test HERE to see if you can instinctively pick up on other peoples emotions/feelings. Strangely the only one I ever miss is anger but I usually get it right because it's the only one I'm ever unsure about.