r1 - 09 Apr 2007 - 18:13:43 - MattEstelaYou are here: TWiki >  Maya Web > WebLeftBar > MayaAnimation


Split sections of this into MayaRigging. -- MattEstela - 18 Dec 2004

Normal and geometry constrains

Duncan via highend3d, someone asked how to do a cob of corn where kernels can be bitten off:

Another possibility might be to use the follicle node from maya hair. This node provides a transform for a point on surface. Create a hairSystem on the cob with the desired number of kernels. Now show start curves, select the start curves and delete, then delete the hairSystem node. The connected follicles should now be all that is remaining of the hair system. The kernels can be parented to follicle nodes.

Yet another option is to use paint effects for the kernels. Select the pineChess brush( under objects mesh ), use pfx->autoPaint->grid on your cylinder, the do pfx to poly. One can then edit attributes on the brush to get a kernel shape..

widthScale ramp, tubeWidth1+2, tubeLenght1+2, tubesPerStep.

If you assigned a kernel pfx brush to a hairsystem, you could even have dynamic kernels that collide, twist, and fall off when bitten.

Animate an objects pivot with a locator

Great tip/example from Bryan Ewert via highend3d:

Simply connect a Locator's '.translate' channel to your object's '.rotatePivot' channel:

  // Set the playback range.
  playbackOptions -minTime 0 -maxTime 60;

  // Create a cube.
  string $cube[] = `polyCube`;
  // Create a locator.
  string $locA[] = `spaceLocator`;
  // Connect the locator's '.translate' to the cube's '.rotatePivot'.
  connectAttr ( $locA[0] + ".translate" ) ( $cube[0] + ".rotatePivot" );
  // Set rotation keys on the cube.
  string $rz = ( $cube[0] + ".rotateZ" );
  setKeyframe -t 0 $rz;
  rotate 0 0 360.0deg $cube[0];
  setKeyframe -t 60 $rz;

  // Set translation keys on the locator.
  string $pivot = ( $locA[0] + ".translate" );
  setKeyframe -t 0 $pivot;
  setKeyframe -t 60 $pivot;
  setAttr $pivot 1.0 0.0 0.0;
  setKeyframe -t 20 $pivot;
  setAttr $pivot -1.0 0.0 0.0;
  setKeyframe -t 40 $pivot;

  // Reset time to 0.
  currentTime 0;
  // Play or scrub this to see the locator-controlled pivot.

Motion capture links, tools

Nice post by Robert Rusick on the highend3d list:

> Are there any, over the net, free motion capture data/materials to use in Maya?

Here's a link from the City University of Hong Kong, which has samples already in Maya format. I tested this link, and its still good.


I found this link: http://www.motionrealityinc.com/software/ for a page titled 'Biomechanics, Inc. - Free Software'

This has links for a utility:

  • bvh2asfamc.exe -- converts BVH data to .asf/.amc pairs

And also these two:

  • asf2mel.exe -- converts ASF data into a MEL script
  • amc2mov.exe -- converts AMC data into Maya importable data

The first utility takes the ASF file as input, and produces a mel script. When you source that script in Maya, it creates a skeleton.

The second utility takes the AMC file, and creates a mel script and a mov file. Once you have the skeleton, you source this second mel script; it prompts you for a mov file for the skeleton animation.

I have used the ASF/AMC file converters without problem.

Unfortunately, the link for 'Sample Data' on the page no longer appears to be any good.

Another alternative is to look at is 'MotView', a program by Andrew Gardner and Steve Dutcher, which is available free at: http://www.cs.wisc.edu/graphics/Courses/cs-838-2000/Students/gardner/motView

It had been recommended by Nathaniel Briggs. In a thread on this topic of converting BVH; he expressed doubts about the quality of the Biomechanics converter...

Subject: Re: bvh files | MotView? .. Date: Thu, 16 Aug 2001 From: "nathaniel briggs"

[..] the resulting Rig NOT an accurate replication of the original BVH file rig which causes proportion issues thus effecting the skinning and motion..

However, MotView? (which I which I got to work), outputs exactly what the BVH file has in it, without the creation of dummy connectors and tweaking of the rot. joints. The trick is you must run the exported MEL using File->Source Script in the Script Editor.. this produces editable animation curves.

I did test the link, and it is still alive. It claims it can read both .bhv and .asf/.amc files, and export MEL script files.

So if you can find some sample files in either of those formats, you can convert them for use in Maya.

I found this link: http://accad.osu.edu/research/mocap/mocap_data.htm which has some motion capture files in .bvh and .amc/.asf formats.

http://www.audiomotion.com/downloads.html has some sample .bvh files

http://www.mastudios.com/motion.html has a couple of files in Maya format

http://www.bvhfiles.com/ claims to have an extensive library of free .bvh files ( site registration required )

http://www.hypervision.co.uk/ has some sample files in .bvh and .amc/.asf formats.

Converting a maya live track point to a worldspace locator

Yes yes, no-one uses maya live anymore (damn kids and their boujou, in my day we tracked footage with a slide rule and graph paper). Its 2d tracker is fairly fast and reliable though, and can be handy if you don't need the full camera solve.

(DeanErvik? here, sorry to barge in but MayaLive? has saved my arse several times when Boujou and all other predictive trackers couldn't deal with such things as blurred markers on green screens and cameras on backs of pickups shooting backwards at night, etc,. my 2c worth), pray continue...

Its slightly tricky to get those tracked points into the rest of maya. Here's how:

  1. track your point
  2. create a locator, parent to camera
  3. create 2 extra float attributes, scaleTrackX and scaleTrackY
  4. create an expression for the locator: translateX = trackpoint.locateX * scaleTrackX
  5. do the same for translateY
  6. move locator in z until you can see it through the camera comfortably
  7. adjust scaleTrack until the locator matches your track point. You may need to add an offsetX and offsetY to your expression if it doesn't want to align
  8. edit->keys->bake simulation

Then to use that in your scene at an arbitrary depth, we'll setup a quick n dirty raycast constraint:

  1. create a degree 1 curve of 2 cv's aligned with the x-axis
  2. point constrain it to camera
  3. aim constrain it at the baked locator
  4. scale the curve along its length to the max depth you need
  5. create another locator, motion path constrain it to your curve
  6. delete its motionpath key, edit this to get it to the depth you need

Its easier than that all looks, believe me. Easier than trying to matchmove by eye if you can get away with it.

euler flipping/filtering baked animation

Say you have to bake a camera animation to export to after effects. If you look at the baked rotation curves, there'll be frequent flips in the curves where it goes from +100 to -100. You can fix this from the graph editor by running 'curves->euler filter'.

Note that you have to select all 3 rotation channels, that way maya can properly juggle the keys so they don't flip. btw, you won't see any problems if you scrub the animation before running the filter, but it'll cause major problems if you enable motion blur in after effects, or end up time-ramping the camera.

The x-men effect, v2

Or 'driving objects through textures'. I normally use solidtexsampler, but Duncan Brinsmead explaned an alternate way:

Check out the colorAtPoint command, which allows you to sample 2D textures. In an expression ou could set up the arguments to return an array of outAlpha values at your grid resolution. You can then loop through your objects and set their translateY (presumably indexing the array using the translate X+Z of your objects ). If written correctly such an expression can be fairly efficient and handle a large number of objects.

Look at the mel file:

textureDisplacePlane.mel (shipped with Maya)

This allows you have a texture displace the vertices of a poly plane. It uses colorAtPoint and a similar technique to what I outlined above.It also shows how to build an expression that will update fairly efficiently.

a bit later Duncan was cajoled into writing an example expression:

$curGrid = `colorAtPoint -o A -su 10 -sv 10 cloth1`;
int $numColumns = 10;
int $numRows = 10;

for ($curRow=1;$curRow <= $numRows;$curRow++){
    for ($curColumn=1;$curColumn <= $numColumns;$curColumn++){
        int $curNumber = $curColumn+ (($curRow-1)*$numColumns);
        setAttr ("nurbsSphere" + $curNumber + ".translateY")
-- Duncan Brinsmead, 18 May 2004

Motion capture with a mouse

This was floating around the back of my mind for ages, needed a friend to spur me to go find the answer. Found it courtesy of trusty highend3d, with this post. Here's the slightly more wordy version. This'll let you motion capture the translation of an object with your mouse:

  • Select the object you wish to manipulate, and get into translate mode
  • Run the following command in your mel command line:
recordAttr -at "translateX" -at "translateY" -at "translateZ";
  • Run this line:
play -record;
  • Playback will start, click and hold on the center of your translate tool, and start dragging it around. Once playback stops (either through hitting escape or reaching the end of the playback range), you'll see a bunch of delicious keys left behind. Neat eh? Doing this to music or dialog is great fun...

Snapping objects to a Camera Pivot

  • Handy if you need to add a transform group to an already animated camera...

  1. Select Camera - Go to Display - Component Display - Selection Handles
  2. Choose Null (that will be snapped to object) - Press Insert - Click on 'Snap to Pivots' Toggle - Move Null till it snaps - Done

Playblast and overscan

  • playblasts + overscan = problems. Best way to ensure you're blasting the entire image is set camera 'film fit' to overscan, overscan value to 1, and then hide all of the UI; if maya can't fit the image res into the screen, say if you're rendering at 1024x576, it'll crop it at the sides, throwing action/title safe off.

Animating complex camera moves with groups

  • Rather than using motion paths or complex keys on a single camera, it can often be easier to place the camera in several nested groups, and have each group animate one channel each. Tweaks can be made very easily this way, and it's handy when working interactively with an art director. They want the camera to quickly flip 180 on its z axis? No problem, new group just above the camera, key rotZ on that group, and the rest of your animation is retained. Here's a quick example scene to show the technique.

  • The risk with this technique is going group-happy, and not naming your groups descriptively; you can quickly end up with a nested camera 30 groups deep, half of which aren't doing anything, and are all named groupN. Fun to decipher a few months down the track!
Topic attachments
I Attachment Action Size Date Who Comment
elsema showyCameraMove.ma manage 58.6 K 09 Apr 2007 - 18:13 MattEstela  
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r1 | More topic actions
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback