Archive for the ‘Maya’ Category

Multiple Motion Paths

Thursday, November 10th, 2011

Here’s a tool for Maya that is similar to a multi-path constraint in Softimage. Make a new scene, create a curve, create a few objects to attach to the curve, select the objects, and run the script below.


string $selection[] = `ls -selection`;
int $size = size($selection);

//change this to your curve name
string $path = "curve1";

for($i=0; $i<$size; $i++){

float $uLinearDistribution = 1.0/$size*($i+1);
float $uRandomDistribution = rand(0,1)/$size*($i+1);
//print ($uRandomDistribution+"\n");

string $motion = `pathAnimation -f 1 -fm 1 -etu 0 -c $path $selection[$i]`;
string $source = $motion + "_uValue.output";
string $destination = $motion + ".uValue";
disconnectAttr $source $destination;

setAttr ($motion + ".uValue") $uLinearDistribution;
//setAttr ($motion + ".uValue") $uRandomDistribution;

}

There's an option for random distribution, just disable the comment. There's no error checking, so use at your own discretion/peril. Each object will have it's own MotionPath node, so check the Attribute Editor for more info.

This will come in handy when we create grapes in the Intro to 3D Modeling course.

Iterated Space Transformation

Tuesday, November 8th, 2011

One of my classroom assignments is to model a spiraling staircase. I find this assignment to be very exciting, as it introduces my students to modeling with multi-dimensional arrays. Then my one of my students, Casey, found a reference on Google images that I hadn’t seen before. A sculpture by Peter Coffin at the Saatchi Gallery.

Untitled (Spiral Staircase)
2007
Aluminum and steel
670.6 x 670.6 x 213.4 cm
Peter Coffin

Now, this is interesting, and it peaked my curiosity to try and recreate it in Maya.

Start with a radial array.  A radial array is quite simple, but to then rotate each step, incrementing from one to another, in their local space required MEL scripting. Essentially, I have a box remodeled into the form of the step, then it is grouped twice. I leave the first group at the origin, then translate the second group on the Z axis to a distance equal to the diameter of the main ring in the sculpture. From here I create a radial array using Duplicate Special. In Duplicate Special, I use copy and instance leaf node (so all the steps can be modeled simultaneously). I make as many copies as there are steps, about 71 steps at 5 degrees on the Rotation Y axis. I use 71 because I already have one, for a total of 72. The twist requires the script. I begin the script by collecting all the objects in the selection, so all the steps (the polygon mesh). Then I find the current rotation attribute value, change the value by adding it’s own value with and offset value, then set the attribute with the new value. This enables the user to transform an entire group of objects without rebuilding the array using Duplicate Special.

//The value of the increment, floating point
float $nX = 5.0;
float $nY = 0.0;
float $nZ = 0.0;
//The attribute to change.
string $attr = "rotate";

string $attributeX = "." + $attr + "X";
string $attributeY = "." + $attr + "Y";
string $attributeZ = "." + $attr + "Z";

string $nodes[] = `ls -selection`;
int $size = size($nodes);

for($i = 0; $i < $size - 1; ++$i){

float $X;
float $Y;
float $Z;

float $offsetX;
float $offsetY;
float $offsetZ;

$X += $nX;
$Y += $nY;
$Z += $nZ;

float $attrX = getAttr ($nodes[$i] + $attributeX);
float $attrY = getAttr ($nodes[$i] + $attributeY);
float $attrZ = getAttr ($nodes[$i] + $attributeZ);

$offsetX = $attrX + $X;
$offsetY = $attrY + $Y;
$offsetZ = $attrZ + $Z;

setAttr ($nodes[$i] + "." + $attr) -type "double3" $offsetX $offsetY $offsetZ;
}

I also made a version using vectors, but I’ve found this version to be unstable. The Z value will randomly produce huge jumps in value. If you have an idea of how to make this version better, do tell.


string $myAttr = "translate";
//The value of the increment
vector $vIncrement = << 0.0, 0.0, 3.0 >>;

string $selection[] = `ls -selection`;
int $size = size($selection);

//to include the first object, use $i=0
for($i = 1; $i < $size; $i+=1){
vector $v;
vector $vOffset;
$v += $vIncrement;
vector $vAttr = getAttr ($selection[$i] + "." + $myAttr);
$vOffset = $vAttr + $v;
setAttr ($selection[$i] + "." + $myAttr) -type "double3" ($vOffset.x) ($vOffset.y) ($vOffset.z);
}

Infinite Stairwell

Attempt

At this point, the only thing that can make this better, is if it were adjustable in real-time and animatable.   I’ll leave it to Casey to solve the rest.

Maya: Wireframe Rendering

Sunday, October 2nd, 2011

Courtesy of a former student’s guidelines, Scott Grasso, here’s a video demonstrating how to set up a mesh for wireframe rendering for a sub-division surface mesh. It’s quite simple, and I like that. This is perfect for setting up your demonstration reel. With a little more planning, the wireframe can be rendered on a white constant shader, and then multiply that render with the beauty pass to showcase the wireframe over the final render.

from the training video on wireframe rendering

Wireframe Rendering

Intro to Modeling, Booleans

Sunday, September 25th, 2011

In this video I cover intersecting polygon meshes at arbitrary angles using booleans. I place strong emphasis on good planning of the geometry prior to the execution of the boolean. In particular, we’re looking for a clean four point polygon and edge loop flow. The boolean itself will not generate the necessary edge flow, so I’ll show you the interactive split tool, duplicating faces (to create the new mesh from an existing mesh), and merging of vertices, using Merge Vertex tool and Merge, to finish the boolean cleanly. I don’t think a person will need the model created, but I do think it’s good practice to try and combine odd forms together with irregular polygon flow; just to see if it can be done and practice your problem solving skills. In class, we use this technique to add a wooden dowel to a japanese wood doll’s hair, like a chop stick holding her hair in a bun.

Training video on modeling with booleans in Maya.

Booleans Done Right

Intro to Modeling, Combining Meshes

Sunday, September 18th, 2011

In this video I cover a variety of methods for combining two meshes together.  I start with a very simple one-to-one point count using a bridge.  I move on through a few more variations on the same topic, gradually building the difficulty of each combination.  I’ve published the most critical pieces of my lecture, and the parts that students tend to ask me to repeat most often.  This isn’t intended for the advanced modeler, but if you are, you may find this video has a couple of gems in it for you, too.

Training video on combining meshes in Maya.

Chimney