Thursday, March 3, 2011

Assignment 3 # 4 : NonLinear

I was originally going to continue using the spheres but for some reason when I thought of the polygon cubes it made me think they'd be presenting sort of like a piano keyboard. If I could get it to reproduce black keys above it that'd be pretty cool too. I worked off the Color Wheel code from before.

select -all;
doDelete;
float $radius = 60.0;
float $rotation = 360.0/60.0;
//float $translate = 1.0/10.0;
string $name;
string $name2;
for ($x=0;$x<20.0;$x++)
{
for ($y=0;$y<20;$y++)
{
$angle = $x * $rotation;
// $saturation = $y * $translate;
$hue = $angle/360.0;
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
vector $wheel = hsv_to_rgb(<<$hue, 1, 1>>);
setAttr $name2 -type double3 ($wheel.x) ($wheel.y) ($wheel.z);
polyCube -w .03 -h .03 -d 0.5 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;
xform -translation (0.05*$x) 0 0;
// rotate -pivot 1 0 1 0 $angle 0;
hyperShade -assign $name;
}
}
;

AND, I made a happy rainbow keyboard! Just changed the setting for the hsv_to_rgb to (1,1,1).

Not sure if this counts but in order to get the rest of the non-linear colors. I just kept scooting the x down the line in the for loop. 






No comments:

Post a Comment