Wednesday, March 2, 2011

Assignment 3 Part 5: Creative Use of Color


Was playing around with the color wheel code to see if I could do anything interesting with it. I liked how the color cube project had a more 3D aspect to it than the previous wheel assignment so I decided to add a z axis as well. The layers of circles gradually become more saturdated as they go up, also the center space gets bigger too.

float $rotate = 360/30.0;
float $translate = 1.0/5.0;
string $name;
string $name2;
for ($x=0;$x<30.0;$x++)
{
    for ($y=0;$y<5;$y++)
    {
     for($z=0;$z<8;$z++)
//Add a z axis
       {
          $name = `shadingNode -asShader blinn`;
          $name2 = $name + ".color";       
    $angle = $x * $rotate;
          $saturate = $y * $translate;
          $hue = $angle/360.0;       
//Assign Blinn shaders
          vector $color = hsv_to_rgb(<<$hue, $saturate, 1>>);
//Convert HSV to RGB, set max of 1 (if RGB are all 1 it creates white)      
          setAttr $name2 -type double3 ($color.x) ($color.y) ($color.z);
//Set shaders
          sphere -ch on -o on -po 0 -ax 0 1 0 -r 0.0538244 -nsp 4 ;
//Make Nurb Spheres    
          xform -translation $saturate ($y+1.0) ($z/7.0);
//changed transformation from previous circle code for translation changes
          rotate -pivot .1 .1 .1 0 $angle 0;
//translating the balls to form circular shape
          hyperShade -assign $name;
//Assign shaders   
 }   
    }
}
;

No comments:

Post a Comment