Sunday, February 13, 2011

Assignment #2 Color Cube

The assignment was to create a projected color cube made of spheres, created by using MEL script. Here's the code for mine, as long as it is used on Maya 2011, it should work just fine.







for ($x = 0; $x <>

for ($y = 0; $y <8;>

for ($z = 0; $z <8;>

$name = `shadingNode -asShader lambert`;

$objName = `polySphere -ch on -o on -r .03`;

xform -translation ($x/8.0) ($y/ 8.0) ($z/ 8.0);

$tmp = $name+ ".color";

$tmp2 = $name+ ".outColor";

$tmp3 = $name + "SG";

$tmp4 = $name + "SG.surfaceShader";

sets -renderable true -noSurfaceShader true -empty -name $tmp3;

connectAttr -f $tmp2 $tmp4;

hyperShade -assign "lambert" "" $name $objName[0];

sets -e -forceElement $tmp3;

setAttr $tmp -type double3 ($x/7.0) ($y/7.0) ($z/7.0);

}

}

}

No comments:

Post a Comment