Tuesday, March 1, 2011

Assignment 3 Part 4: Nonlinear Complementary Transitions

For a nonlinear transition that is complementary but doesnt go thru the grey, I went back to the colorwheel concept. Instead of going thru the center, have the colors go around like in a color wheel and determine hue angle wise but just make the balls spawn in a linear fashion. In general its a more simplified version of the color wheel code with unecessary things deleted such as saturation and having multiple layers.
float $rotate = 360.0/30.0;
string $name;
string $name2;
for ($x=0;$x<15.0;$x++)
{
    for ($y=0;$y<1;$y++)
//set 15 balls around so it only goes half a circle so its complementary(30 is full circle), change to 1 ball since you dont need layers like the original color wheel. Rotation will still be needed for hue changes.
    {
        $name = `shadingNode -asShader blinn`;
        $name2 = $name + ".color";       
 $angle = $x*$rotate;
        $hue = $angle/360.0;
//Assign Blinn shaders, note despite linear transition angle is going to be needed for the hue changes
        vector $color = hsv_to_rgb(<<$hue, 1, 1>>);
//Convert HSV to RGB      
        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 (0.25*$x) 0 1;
//Translate balls in a linear fashion and ignore the angle
        hyperShade -assign $name;
//Assign shaders       
    }
}
;

Same code concept for second one the only difference is I shifted x so it goes forward from the colorwheel so it changes to different complementary colors

float $rotate = 360.0/30.0;
string $name;
string $name2;
for ($x=5;$x<25.0;$x++)
{
    for ($y=0;$y<1;$y++)
    {
        $name = `shadingNode -asShader blinn`;
        $name2 = $name + ".color";       
 $angle = $x*$rotate;
        $hue = $angle/360.0;
        vector $color = hsv_to_rgb(<<$hue, 1, 1>>);       
        setAttr $name2 -type double3 ($color.x) ($color.y) ($color.z);
        sphere -ch on -o on -po 0 -ax 0 1 0 -r 0.0538244 -nsp 4 ;      
       xform -translation (0.25*$x) 0 1;
        hyperShade -assign $name;    
    }
}
;

No comments:

Post a Comment