‘ MEL (Maya) ’ category archive

Mar
01

Computational Workshop @ Kookmin University + Kyonggi University

I will be running a Maya workshop for Jinbok Wie’s studios at Kookmin and Kyonggi University this coming week.

WORKSHOP: COMPUTATIONAL DYNAMICS – ‘BONE’
Tutors: 김지호 (http://www.ynotwhy.com, http://crtl-i.com) + 위진복 (http://wieandpartners.com)
The workshop will be dedicated to constituting the artificial process of transformation of material information. This process will target comprehension of how extensities are formed into intensities. The STUDIO will deal with form as field which is full of dynamic strengths, rather than reductive physics. The STUDIO will work with the materiality of matter implying the changes of modes and the shifts of energy, rather than materials in modern manner. The introduction of dynamic modelling tools from Maya will give the STUDIO the learning of the capabilities of the program, coupled with the understanding of the relevant parameters of the subject studied: nCloth, IK, particle-dynamics, soft bodies, expressions, and etc. If relevant, some other parametric synchronization tools like grasshopper and scripts will be possibly introduced.

‘Bone’ will be dealt with in two scales of material system and two levels information exchange that enriches the subject, ENGINEERING VERTICALITY. TWO SCALES: 1. The microscopic level of the internality and the individuality 2. The macroscopic level of bone as collectivity TWO LEVELS: 1. The relation to other system of the body 2. The relation to external forces.

Feb
16

Catenary – Maya nCloth

Karey (http://kareydarnellhelms.com) showed me a great catenary / structural analysis tool being developed in grasshopper (http://spacesymmetrystructure.wordpress.com/2010/01/21/kangaroo/). Similar ideas can be explored using the nCloth tool in Maya. This is what it looks like.

Dec
14

Maya Simulations – Hair Ball

Dec
13

Maya Simulations – Wind Field

Nov
29

Vector Sketch – Maya Particles

Jun
17

Two Surface Space Frame (MEL)

This could be done with many different softwares/methods. Some time last year, I was looking at MEL to write this script that uses two different surfaces to simulate a space frame according to U/V divisions. This can now be easily performed with just a few steps using Grasshopper (Explicit History Plug-in) in Rhino.

//
// Script written by Howard Jiho Kim | kimjiho@gmail.com | crtl-i.com | 2007
//
// ex.
// spFrSurface(srfName1, srfName2, U, V)
// spFrSurface(“nurbsPlane1”, “nurbsPlane2”, 10, 10)
//

// HORIZONTAL MEMBERS!!

global proc spFrSurface(string $nurb, string $nurb2, int $u, int $v)
{
gridSurface($nurb, $u,$v);
gridSurface($nurb2, $u,$v);

float $u_inc = 1.0/$u;
float $v_inc = 1.0/$v;
float $cv[], $cv2[], $cv3[];

float $i2, $k2;

// get U information

$u = $u + 1;
$v = $v + 1;

for($i=0;$i<$u;$i++)
{
for($k=0;$k<$v;$k++)
{

$i2 = $u_inc * $i;
print (“u:” + $i2 + ” | “);
$k2 = $v_inc * $k;
print (“v:” + $k2 + ” | “);
$cv = `pointOnSurface -u $i2 -v $k2 -position $nurb`;
print( $cv[0] +” “+ $cv[1] +” “+ $cv[2]  + ” | “);

$cv2 = `pointOnSurface -u $i2 -v $k2 -position $nurb2`;
print( $cv2[0] +” “+ $cv2[1] +” “+ $cv2[2] +”\n”);

curve -d 1 -p $cv[0] $cv[1] $cv[2] -p $cv2[0] $cv2[1] $cv2[2] -k 0 -k 1;

// print CV

//$x[$k] = $cv[0];
//$y[$k] = $cv[1];
//$z[$k] = $cv[2];

}

//$curveName[$i] = `curve -p $x[0] $y[0] $z[0] -p $x[1] $y[1] $z[1] -p $x[2] $y[2] $z[2] -p $x[3] $y[3] $z[3] -p $x[4] $y[4] $z[4] -p $x[5] $y[5] $z[5] -p $x[6] $y[6] $z[6] -p $x[7] $y[7] $z[7]`;
}
}

// LONGITUDINAL MEMBERS
global proc gridSurface(string $nurb, int $u, int $v)
{
float $u_inc = 1.0/$u;
float $v_inc = 1.0/$v;
float $cv[], $cv2[], $cv3[];

float $i2, $k2;

// get U information

$u = $u + 1;

for($i=0;$i<$u;$i++)
{
for($k=0;$k<$v;$k++)
{

$i2 = $u_inc * $i;
print (“u:” + $i2 + ” | “);
$k2 = $v_inc * $k;
print (“v:” + $k2 + ” | “);
$cv = `pointOnSurface -u $i2 -v $k2 -position $nurb`;
print( $cv[0] +” “+ $cv[1] +” “+ $cv[2]  + ” | “);

$k3 = $v_inc * ($k+1);

$cv2 = `pointOnSurface -u $i2 -v $k3 -position $nurb`;
print( $cv2[0] +” “+ $cv2[1] +” “+ $cv2[2] +”\n”);

curve -d 1 -p $cv[0] $cv[1] $cv[2] -p $cv2[0] $cv2[1] $cv2[2] -k 0 -k 1;

// print CV

//$x[$k] = $cv[0];
//$y[$k] = $cv[1];
//$z[$k] = $cv[2];

}

//$curveName[$i] = `curve -p $x[0] $y[0] $z[0] -p $x[1] $y[1] $z[1] -p $x[2] $y[2] $z[2] -p $x[3] $y[3] $z[3] -p $x[4] $y[4] $z[4] -p $x[5] $y[5] $z[5] -p $x[6] $y[6] $z[6] -p $x[7] $y[7] $z[7]`;
}

// get U information

$v = $v + 1;
$u = $u – 1;

for($i=0;$i<$v;$i++)
{
for($k=0;$k<$u;$k++)
{

$i2 = $u_inc * $k;
print (“u:” + $i2 + ” | “);
$k2 = $v_inc * $i;
print (“v:” + $k2 + ” | “);
$cv = `pointOnSurface -u $i2 -v $k2 -position $nurb`;
print( $cv[0] +” “+ $cv[1] +” “+ $cv[2]  + ” | “);

$i3 = $u_inc * ($k+1);

$cv2 = `pointOnSurface -u $i3 -v $k2 -position $nurb`;
print( $cv2[0] +” “+ $cv2[1] +” “+ $cv2[2] +”\n”);

curve -d 1 -p $cv[0] $cv[1] $cv[2] -p $cv2[0] $cv2[1] $cv2[2] -k 0 -k 1;

// print CV

//$x[$k] = $cv[0];
//$y[$k] = $cv[1];
//$z[$k] = $cv[2];

}

//$curveName[$i] = `curve -p $x[0] $y[0] $z[0] -p $x[1] $y[1] $z[1] -p $x[2] $y[2] $z[2] -p $x[3] $y[3] $z[3] -p $x[4] $y[4] $z[4] -p $x[5] $y[5] $z[5] -p $x[6] $y[6] $z[6] -p $x[7] $y[7] $z[7]`;
}
}

Nov
02

curve length

When I first started to learn how to script in mel, I had the hardest time trying to figure out the length of a spline curve. This is super easy, when a line is composed of purely straight lines. But, when a curve starts to bend, it gets extremely complicated. I wanted to understand exactly how a curve was shaped based on its degree and control points. I ran into good amount of websites and journals that explain spline curves with math formulas. I never figured out how to find out a curve length using script through pure math. However, I ended up learning a lot about spline curves, and this was probably the most helpful article that I ran into: Arc Length Parameterization of Spline Curves.

After a while of trying to figure this thing out, I found out about the arc length tool -__- And, also found a script that extracts the measurement from the arc length node. I modified the script a tiny bit and made it into a function, which looks like this:

ArcLength

proc float getCurveLength( string $curve )
{
string $arcLenNode = `createNode arcLengthDimension`;
connectAttr -f ( $curve + “.worldSpace[0]” ) ( $arcLenNode + “.nurbsGeometry” );

setAttr ( $arcLenNode + “.uParamValue” ) `getAttr ( $curve + “.maxValue” )`;

float $curveLength = `getAttr ( $arcLenNode + “.arcLength” )`;

string $parent[] = `listRelatives -p $arcLenNode`;
delete $parent;

return $curveLength;
}