Wednesday 19 November 2008

Assignment and Next session

Hi everyone,

As I mentioned- There will NOT be a session next week [26 November]

So at the next session [3 December] everyone should hand in a cd with the following:


An animation which utilizes colour fields as the means of controlling a large number of objects-
- This animation must consist of at least 500 objects: each containing at least 2 parts
-Ie. the object must have sub object parented to it

- The animation should run for 200 frames

-------On the disk you should put the:
Maya File
Animation File (.avi or .mov)
Any images that you drew to control the animations

session 6 files

HERE

Wednesday 12 November 2008

text editors

Here is a link to the text editor I use in class- its free and works on Mac and PC

http://www.jedit.org/index.php?page=download

and here is a link on how to set up the syntax files for maya

http://www.highend3d.com/maya/tutorials/using_tools_scripts/Configuring-jEdit-with-Maya-319.html


For PC only you can try editPLus

http://www.editplus.com/


and then add the syntax / autocomplete files here

http://www.editplus.com/dn.cgi?mel70.zip

fixedSession5

//colourCode - CodeSet 5
//npuckett - 2008 www.colourcodedarch.blogspot.com

proc string newRamp()
{
//create a new material and attach a ramp to its colour output
string $shader = `shadingNode -asShader lambert`;
string $ramp = `shadingNode -asTexture ramp`;
string $place = `shadingNode -asUtility place2dTexture`;
connectAttr ($place+".outUV") ($ramp+".uv");
connectAttr ($place+".outUvFilterSize") ($ramp+".uvFilterSize");
connectAttr -force ($ramp+".outColor") ($shader+".color");

removeMultiInstance -break true ($ramp+".colorEntryList[1]");
setAttr ($ramp+".colorEntryList[2].color") -type double3 0 0 0 ;
setAttr ($ramp+".colorEntryList[2].position") 1;
setAttr ($ramp+".colorEntryList[0].position") 0;
setAttr ($ramp+".colorEntryList[0].color") -type double3 1 1 1 ;
return $ramp;
}







//show colour values on the surface
int $totX = 10;
int $totZ = 10;
//change the name of the controller to correspond to the ones that you have
float $scale = 0.1;
string $controller = "ramp1";
string $surface = "plane1";

for ($x=0;$x<=$totX;$x++)
{
for ($z=0;$z<=$totZ;$z++)
{
float $you = ((1.0/$totX)*$x);
float $vee = ((1.0/$totZ)*$z);
//use colorAtPoint to return the value of the colour
float $heights[] = `colorAtPoint -u $you -v $vee $controller`;
float $position[] = `pointOnSurface -p -u $you -v $vee $surface`;
string $hInfo[] = `textCurves -ch 0 -f "Arial-Regular" -t $heights[0]`;
scale -r $scale $scale $scale $hInfo[0];
move -a $position[0] $position[1] $position[2] $hInfo[0];
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
///create a grid
proc boxGrid(int $totalX, int $totalZ, float $factor)
{
//create the grid of boxes
for($x=0;$x<=$totalX;$x++)
{
for($z=0;$z<=$totalZ;$z++)
{
string $name = ("box_"+$x+"_"+$z);
polyCube -n $name;
move -r ($x*$factor) 0 ($z*$factor);
}
}
}
boxGrid(20,20,2.5);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
///moving a system of boxes using the colour value
int $totX = 20;
int $totZ = 20;
//change the name of the controllers to correspond to the ones that you have
string $controller = "ramp1";
//the name of the object system being affected
string $baseName = "box";
float $factor = 5;
for ($x=0;$x<$totX;$x++)
{
for ($z=0;$z<$totZ;$z++)
{
//the U and V values are the texture's internal coordinate system
//it runs from 0 -> 1 in both directions
//this is how we define a specific point on the texture to sample from
float $you = ((1.0/$totX)*$x);
float $vee = ((1.0/$totZ)*$z);
//use colorAtPoint to return the value of the colour
float $heights[] = `colorAtPoint -u $you -v $vee $controller`;
//since we used a set naming system the boxes name matches up to the
//coordinates that we sample on the texture
string $name = ($baseName+"_"+$x+"_"+$z);
//use the value from the texture to move the boxes
move -r 0 ($heights[0]*$factor) 0 $name;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//animate the movement
int $totX = 20;
int $totZ = 20;
//change the name of the controllers to correspond to the ones that you have
string $controller = "ramp2";
//the name of the object system being affected
string $baseName = "box";
float $factor = 50;
for ($x=0;$x<$totX;$x++)
{
for ($z=0;$z<$totZ;$z++)
{
//the U and V values are the texture's internal coordinate system
//it runs from 0 -> 1 in both directions
//this is how we define a specific point on the texture to sample from
float $you = ((1.0/$totX)*$x);
float $vee = ((1.0/$totZ)*$z);
//use colorAtPoint to return the value of the colour
float $heights[] = `colorAtPoint -u $you -v $vee $controller`;
//since we used a set naming system the boxes name matches up to the
//coordinates that we sample on the texture
string $name = ($baseName+"_"+$x+"_"+$z);
//use the value from the texture to set the keyframe value
setKeyframe -at translateY -v 0 -t 1 $name;
setKeyframe -at translateY -v ($heights[0]*$factor) -t (($x+1)+($x*$z)) $name;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//using 2 inputs
//animate the movement
int $totX = 20;
int $totZ = 20;
//change the name of the controllers to correspond to the ones that you have
string $controller = "file2";
string $controller2 = "ramp1";
//the name of the object system being affected
string $baseName = "box";
float $factor = 20;
float $timeFactor = 200;
for ($x=0;$x<$totX;$x++)
{
for ($z=0;$z<$totZ;$z++)
{
//the U and V values are the texture's internal coordinate system
//it runs from 0 -> 1 in both directions
//this is how we define a specific point on the texture to sample from
float $you = ((1.0/$totX)*$x);
float $vee = ((1.0/$totZ)*$z);
//use colorAtPoint to return the value of the colour
float $heights[] = `colorAtPoint -u $you -v $vee $controller`;
float $time[] = `colorAtPoint -u $you -v $vee $controller2`;
//since we used a set naming system the boxes name matches up to the
//coordinates that we sample on the texture
string $name = ($baseName+"_"+$x+"_"+$z);
//use the value from the texture to set the keyframe value
setKeyframe -at scaleY -v 0 -t 1 $name;
setKeyframe -at scaleY -v ($heights[0]*$factor) -t ($time[0]*$timeFactor) $name;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//controlling the output range
//using 2 inputs
//animate the movement
int $totX = 10;
int $totZ = 12;
//change the name of the controllers to correspond to the ones that you have
string $controller = "ramp1";
string $controller = "ramp2";
//the name of the object system being affected
string $baseName = "box";
float $factor = 5;
float $timeFactor = 20;

float $outputMin = -30;
float $outputMax =30;
float $timeMin = 30;
float $timeMax = 300;

for ($x=0;$x<$totX;$x++)
{
for ($z=0;$z<$totZ;$z++)
{
//the U and V values are the texture's internal coordinate system
//it runs from 0 -> 1 in both directions
//this is how we define a specific point on the texture to sample from
float $you = ((1.0/$totX)*$x);
float $vee = ((1.0/$totZ)*$z);
//use colorAtPoint to return the value of the colour
float $cVal[] = `colorAtPoint -u $you -v $vee $controller`;
float $time[] = `colorAtPoint -u $you -v $vee $controller2`;
//since we used a set naming system the boxes name matches up to the
//coordinates that we sample on the texture
float $adjCval = $outputMin + ((($cVal[0]-0)/(1-0)) * ($outputMax-$outputMin));
float $adjTval = $outputMin + ((($time[0]-0)/(1-0)) * ($outputMax-$outputMin));
string $name = ($baseName+"_"+$x+"_"+$z);
//use the value from the texture to set the keyframe value
setKeyframe -at translateY -v 0 -t 1 $name;
setKeyframe -at translateY -v $adjCVal -t $adjTval $name;
}
}

session 5

FILES

Tuesday 11 November 2008

session 4 Files

I think most of you copied them from the PC, but just in case here is the material from last session.


FILES