Thursday, March 3, 2011

Assignment 3: Scripting and Color Space (not completed)

1. Here's the RGB color cube and code:

for ($z = 0; $z < 8; ++$z)
{
for ($y = 0; $y < 8; ++$y)
{
for ($x = 0; $x < 8; ++$x)
{
$ball = `shadingNode -asShader lambert`;
$color = $ball + ".color";
setAttr $color -type double3 ($x/8.0) ($y/8.0) ($z/8.0);
$objname = `polySphere -ch on -o on -r .05`;

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

hyperShade -assign $ball;
}
}
}


2. Here's the RGB color wheel:

float $rad = .1;
$h = 10.0;
$s = 1.0/8.0;

for ($j = 0; $j < i =" 0;" ball =" `shadingNode" color =" $ball" hue =" ($h" sat =" $s" vect =" <<$hue,">>;
vector $col = hsv_to_rgb ($vect);
setAttr $color -type double3 ($col.x) ($col.y) ($col.z);
$objname = `polySphere -ch on -o on -r $rad`;

xform -translation ($j/8.0) 0 0;
move 0 0 0 $ball.scalePivot $ball.rotatePivot;
xform -ro 0 ($i*10) 0;

hyperShade -assign $ball;
}
$rad = $rad + .01;
}


This is all I have done at this point. It's not that I'm necessarily having trouble with the assignment, I've just had a terribly unlucky week with having lots of homework as well as getting real sick. I suppose I'm going to have to use a late day on this project. I figured I would just post what I have so far though.

No comments:

Post a Comment