Thursday, March 3, 2011

IFDM 210 COLOR WHEEL ASSIGNMENT


In being entirely honest, I must say that parts of this project were very hard for me.


I am a very visual person, and com puter programming has not come easially to me. The color cube, the first part of the project, actually made a decent amount of sense to me. However, once we entered into the realms of the circles, and the different color sequences it took me much longer to visualize first how to assign colors by angles, but then how to assign them by angles, in a different way.

I tried my best on this project and I will be continuing to work on it, and trying to make it better. If anything needs a better description I will add that as soon as possible. Thank you.


NOTE: For some reason, on my color wheel, and some of the other projects, when you try to run them, an error comes up, saying it cannot find lambert. The way I found to fix this, is to make a sphere in the drop down menu, right click, choose "Assign New Material", and then choose lambert. After doing this, run the script again and it will work perfectly... I am still trying to debug this weird aspect.

NOVEL USE OF COLOR
I actually made this odd shape somewhat by accident, but I chose it to be my novel use of color because I ended up studying it, and it helped me understand alot, and it helped me to my non-linear transitions.














select -all;
doDelete;

int $x;

int $y;

int $z;

string $name;

string $tmp;

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

{

for($x=0; $x<5;>

{

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

{

$name = `shadingNode -asShader lambert`;

$tmp = $name + ".color";

//$objname = `polyPlane -w 0.5 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1`;

$objname = `polySphere -r 2 -sx 15 -sy 10 -ax 0 1 0 -cuv 1 -ch 1`;

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

xform -translation ($x/2.0) ($y/1.0) ($z/2.0);

hyperShade -assign $name;

}

}

};


NON-LINEAR COLOR TRANSFORMATIONS

The Red to Green, and the Purple to Green are my two submissions, however, on occasion, but not all the time, the code that makes them, if run after another, won't make this result. I found running the simple blue one seemed to "clear out" the system, and then the otherr two ran with the proper colors.












PURPLE TO GREEN


select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
//for($z=0; $z<1;>
//{
///for($x=0; $x<1;>
{
for($y=0; $y<6;>
{
$name = `shadingNode -asShader lambert`;
$tmp = $name + ".color";
//$objname = `polyPlane -w 0.5 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1`;
$objname = `polySphere -r 2 -sx 15 -sy 10 -ax 0 1 0 -cuv 1 -ch 1`;
setAttr $tmp -type double3 ($x/1.8) ($y/3.0) ($z/1.5);
xform -translation ($x/2.0) ($y/1.0) ($z/2.0);
hyperShade -assign $name;
}
};
//};


RED TO GREEN
select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
for($z=0; $z<1;>
{
//for($x=0; $x<1;>
//{
for($y=0; $y<8;>
{
$name = `shadingNode -asShader lambert`;
$tmp = $name + ".color";
//$objname = `polyPlane -w 0.5 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1`;
$objname = `polySphere -r 2 -sx 15 -sy 10 -ax 0 1 0 -cuv 1 -ch 1`;
setAttr $tmp -type double3 ($x/0.9) ($y/2.9) ($z/2.1);
xform -translation ($x/2.0) ($y/1.0) ($z/2.0);
hyperShade -assign $name;
}
//}
};

SIMPLE BLUE

select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
//for($z=0; $z<1;>
//{
for($x=0; $x<1;>
{
for($y=0; $y<6;>
{
$name = `shadingNode -asShader lambert`;
$tmp = $name + ".color";
//$objname = `polyPlane -w 0.5 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1`;
$objname = `polySphere -r 2 -sx 15 -sy 10 -ax 0 1 0 -cuv 1 -ch 1`;
setAttr $tmp -type double3 ($x/3.0) ($y/3.0) ($z/1.0);
xform -translation ($x/2.0) ($y/1.0) ($z/2.0);
hyperShade -assign $name;
}
};
//};
















For Blue to Yellow through Grey:
select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
//Deleted the Y for loop
for($x=0; $x<8;>
{
for($z=0; $z<8;>
{
$name = `shadingNode -asShader lambert`;
$tmp = $name + ".color";
//Get rid of the ($y/6.0) and make it
//($x/11) change the other x and the z to 9.0
setAttr $tmp -type double3 ($x/9.0) ($x/11.0) ($z/9.0);
$objname = `polySphere -ch on -o on -r .03`;
xform -translation ($y/8.0) ($z/8.0) ($x/8.0);
hyperShade -assign $name;
}
};

For Purple to Green through Grey:
select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
//Deleted the Y for loop
for($x=0; $x<8;>
{
for($z=0; $z<8;>
{
$name = `shadingNode -asShader lambert`;
$tmp = $name + ".color";
//Get rid of the ($y/6.0) and make it
//($x/11) change the other x and the z to 9.0
setAttr $tmp -type double3 ($x/11.0) ($z/6.9) ($x/11.0);
$objname = `polySphere -ch on -o on -r .03`;
xform -translation ($y/8.0) ($z/8.0) ($x/8.0);
hyperShade -assign $name;
}
};

For Red to Green through Grey:
select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
//Deleted the Y for loop
for($x=0; $x<8;>
{
for($z=0; $z<8;>
{
$name = `shadingNode -asShader lambert`;
$tmp = $name + ".color";
//Get rid of the ($y/6.0) and make it
//($x/11) change the other x and the z to 9.0
setAttr $tmp -type double3 ($x/11.0) ($x/6.5) ($z/11.0);
$objname = `polySphere -ch on -o on -r .03`;
xform -translation ($y/8.0) ($z/8.0) ($x/8.0);
hyperShade -assign $name;
}
};



COLOR CUBE

















This is my color cube.

I changed the texture to phong rather
than lambert for aesthetic reasons,
but otherwise, it should be very similar to the main color wheel exercise. My MEL script is pasted below:

select -all;
doDelete;
int $x;
int $y;
int $z;
string $name;
string $tmp;
for($y=0; $y<8; x="0;" z="0;" name =" `shadingNode" tmp =" $name">

setAttr $tmp -type double3 ($x/7.0) ($y/7.0) ($z/7.0);
$objname = `polySphere -ch on -o on -r .03`;
xform -translation ($x/8.0) ($y/8.0) ($z/8.0);
hyperShade -assign $name;
}
}
};



COLOR WHEEL

For the next part of the project we were supposed to make a color wheel. once I figured out the rotate
and pivot functions I was very lucky, I simply followed the color cube code to
do coloring.


select -all;
doDelete;
//string $name;
//string $tmp;
// rota = rotation angle
string $objName[];
string $objPivot;

for ($rad=1;$rad<11;$rad++) rad =" radius">
{
int $topRotate = $rad*8;
for ($rota=0;$rota<$topRotate;$rota++)
{
$objName = `polyCube -w 1.5 -h 0.5 -d 0.5 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
//scale -r 1 0.011 1;
$objPivot = $objName[0] + ".scalePivot";
$objRotate = $objName[0] + ".rotatePivot";

move ($rad+($rad*$rad*.04)) 0 0;
move 0 0 0 $objPivot $objRotate ;
rotate -ws 0 ($rota*(360.0/$topRotate)) 0 ;

vector $sat = hsv_to_rgb(<<(($rota*(360.0/$topRotate))/360.0), ($rad/8.0), 1>>); //sat hue = rotation angle/360) altered values = altered colors?
print $sat;
//$c.x = 1
//$c.y = 2
//$c.z = 3 // for regular vector

$name = `shadingNode -asShader lambert`; // color cube code ...
$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;
assignCreatedShader "lambert" "" $name $objName[0];
//hyperShade -assign $name;
sets -e -forceElement $tmp3;
setAttr $tmp -type double3 ($sat.x) ($sat.y) ($sat.z);//alter to create artistic color space maybe???
}
};




ARTISTIC COLOR WHEEL

The Artistic color wheel code was very hard for me, for some reason I had a lot of trouble visualizing it, and it took me multiple tries. This is my first attempt, which I chose to turn in, because even though it is much simpler than the artistic color wheel code we talked about in class, of all of the codes I tried, this one is visually closest to the artistic color wheel.


select -all;
doDelete;

//string $name;
//string $tmp;
//rota = rotation angle
string $objName[];
string $objPivot;

for ($rad=1;$rad<11;$rad++) rad =" radius">
{
int $topRotate = $rad*8;
for ($rota=0;$rota<$topRotate;$rota++)
{
$objName = `polyCube -w 1.5 -h 0.5 -d 0.5 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1`;
//scale -r 1 0.011 1;
$objPivot = $objName[0] + ".scalePivot";
$objRotate = $objName[0] + ".rotatePivot";

move ($rad+($rad*$rad*.04)) 0 0;
move 0 0 0 $objPivot $objRotate ;
rotate -ws 0 ($rota*(360.0/$topRotate)) 0 ;

vector $sat = hsv_to_rgb(<<(($rota*(348.0/$topRotate))/310.0), ($rad/1.0), 1>>); //sat hue = rotation angle/360) altered values = altered colors?
print $sat;
//$c.x = 1
//$c.y = 2
//$c.z = 3 // for regular vector

$name = `shadingNode -asShader lambert`; // color cube code ...
$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;
assignCreatedShader "lambert" "" $name $objName[0];
//hyperShade -assign $name;
sets -e -forceElement $tmp3;
setAttr $tmp -type double3 ($sat.x/0.4) ($sat.y/0.8) ($sat.z/1.5);//alter to create artistic color space maybe???
}
};

No comments:

Post a Comment