This is the rendered out picture of the color cube. It is 8*8*8 with white and black at each end. The color cube makes sense because the colors in rgb space directly correspond with their locations in maya. Here's the mel script I used. $ballNumb is used to generalize the code:
select -all;
doDelete;
int $ballNumb = 8;
for ($z = 0; $z<$ballNumb; ++$z)
{
for ($y = 0; $y<$ballNumb; ++$y)
{
for ($x = 0; $x <$ballNumb; ++$x)
{
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
setAttr $name2 -type double3 ($x/7.0) ($y/7.0)($z/7.0);
polySphere -ch on -o on -r .03;
xform -translation ($x/7.0) ($y/7.0) ($z/7.0);
hyperShade -assign $name;
}
}
}
select -cl;
;
Part 2: Two Color Wheel Variations
RGB Color Wheel:
Here's the my code for the RGB color wheel. This wheel is nice because the hues directly correspond with the angles.
select -all;
doDelete;
float $ballsAround = 30.0;
float $steps = 12.0;
float $width = 360.0/$ballsAround;
for ($i= 0;$i<$ballsAround;$i++)//angle
{
for($j=0;$j<$steps;$j++) //radius or saturation
{
$angle = $i * $width; //width for each step //how much to rotate by, absolute rotate
$sat = $j*(1.0/$steps); //how much to translate by, this is the saturation hsv_to_rgb
$hue = $angle/360.0;
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
vector $v = hsv_to_rgb(<<$hue, $sat, 1>>);
setAttr $name2 -type double3 ($v.x) ($v.y) ($v.z);
polySphere -ch on -o on -r .04;
xform -translation $sat 0 0;
rotate -pivot .01 .01 .01 0 $angle 0;
hyperShade -assign $name;
}
}
;
Alternative Color Wheel: Artistic RYB Wheel
For this color wheel, the differences are instead of red and cyan compliments, red and green are compliments. Blue is across from orange instead of yellow, and magenta is across from yellow and not green. For the wheel, I separated out hue and angle from the last color wheel, so that you can set the hue independently from the angle. I manually coded the hues instead of the code doing it for me.
select -all;
doDelete;
float $numHues = 6.0; //This is for the 3 primary and complimentary colors that you know the exact hues for
float $numSats = 8.0;//These are how many different steps of saturation you want
float $numSteps = 6.0;//This is how many different arms are between the main 6 colors that you specify the hues
float $angles[7] = {0.0, 60.0, 120.0, 180.0, 240.0, 300.0, 360.0}; //this is an array that you store all the angels in. The reason 360 is last is because 0 and 360 are the same angle or the red color
float $hues[7] = {0.0, .1, .2, .35, .65, .9, 1};//this is for the hues. They're pretty much on the money for the complementary and secondary colors
for ($k = 0; $k<$numHues; $k++)//this outer for loop goes through each "slice of pie" with the different colors
{
float $da = $angles[$k+1]-$angles[$k];//this is the distance between each angle. You go from the angle you will go to to the one you started at
float $dH = $hues[$k + 1]-$hues[$k];//this is the same thing, except with hue
float $sa = $da/$numSteps; //steps for each angle
float $sH = $dH/$numSteps; //hue steps
float $a1 = $angles[$k]; //this is the angle you start at
float $h1 = $hues[$k]; //this is the hue you start at at each particular hue
for ($i = 0; $i <$numSteps; ++$i) //this is the for loop for the arms in between. It's like the example from the rgb color wheel
{
for ($j = 0; $j<$numSats; $j++)//this is the for loop for saturation like the rgb color wheel
{
$ca = $a1 + $i *$sa; //this is your current angle. The number of arms times the width of the angle plus where you start from
$cH = $h1 + $i *$sH; //same thing for hue
$hue = $cH; //so hue is the current hue
$angle = $ca; //angle is the current angle, just so you don't have to change later coding
$sat = $j * (1.0/$numSats); //saturation is the saturation loop, and then the 1.0 is how far you wanna go / how many steps you want
//sat is the same
//all the color stuff is the same
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
vector $v = hsv_to_rgb(<<$hue, $sat, 1>>);
setAttr $name2 -type double3 ($v.x) ($v.y) ($v.z);
polySphere -ch on -o on -r .04;
xform -translation $sat 0 0;
rotate -pivot .01 .01 .01 0 $angle 0;
hyperShade -assign $name;
}
}
}
;
Part 3: Three linear transitions between complimentary colors
For the linear transitions, I took the color wheel code, and set it to only make the complimentary colors. Then, I selected the line I wanted, inverse selected everything else, deleted them, and straightened out the spheres.
Blue to Yellow:
//Blue to Yellow
select -all;
doDelete;
float $ballsAround = 12.0;
float $steps = 1.0/12.0;
float $width = 360.0/$ballsAround;
string $name;
//float $radius = 1.0;
for ($i= 0;$i<12.0;$i++)//angle
{
for($j=0;$j<12.0;$j++) //radius or saturation
{
$angle = $i * $width; //width for each step //how much to rotate by, absolute rotate
$sat = $j*$steps; //how much to translate by, this is the saturation hsv_to_rgb
$hue = $angle/360.0;
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
vector $v = hsv_to_rgb(<<$hue, $sat, 1>>);
setAttr $name2 -type double3 ($v.x) ($v.y) ($v.z);
polySphere -ch on -o on -r .06;
xform -translation $sat 0 0;
rotate -pivot .01 .01 .01 0 $angle 0;
hyperShade -assign $name;
}
}
select -r pSphere1 pSphere26 pSphere27 pSphere28 pSphere29 pSphere30 pSphere31 pSphere32 pSphere33 pSphere34 pSphere35 pSphere36 pSphere98 pSphere99 pSphere100 pSphere101 pSphere102 pSphere103 pSphere104 pSphere105 pSphere106 pSphere107 pSphere108 ;
invertSelection;
doDelete;
select -r pSphere1 pSphere26 pSphere27 pSphere28 pSphere29 pSphere30 pSphere31 pSphere32 pSphere33 pSphere34 pSphere35 pSphere36 ;
rotate -pivot 0 0 0 30;
select -r pSphere98 pSphere99 pSphere100 pSphere101 pSphere102 pSphere103 pSphere104 pSphere105 pSphere106 pSphere107 pSphere108 ;
rotate -pivot 0 0 0 0 180 0;
select -cl;
;
Red to Cyan:
//Cyan To Red Code Going through White
select -all;
doDelete;
float $ballsAround = 12.0;
float $steps = 1.0/12.0;
float $width = 360.0/$ballsAround;
string $name;
//float $radius = 1.0;
for ($i= 0;$i<12.0;$i++)//angle
{
for($j=0;$j<12.0;$j++) //radius or saturation
{
$angle = $i * $width; //width for each step //how much to rotate by, absolute rotate
$sat = $j*$steps; //how much to translate by, this is the saturation hsv_to_rgb
$hue = $angle/360.0;
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
vector $v = hsv_to_rgb(<<$hue, $sat, 1>>);
setAttr $name2 -type double3 ($v.x) ($v.y) ($v.z);
polySphere -ch on -o on -r .06;
xform -translation $sat 0 0;
rotate -pivot .01 .01 .01 0 $angle 0;
hyperShade -assign $name;
}
}
select -r pSphere1 pSphere2 pSphere3 pSphere4 pSphere5 pSphere6 pSphere7 pSphere8 pSphere9 pSphere10 pSphere11 pSphere12 pSphere74 pSphere75 pSphere76 pSphere77 pSphere78 pSphere79 pSphere80 pSphere81 pSphere82 pSphere83 pSphere84 ;
invertSelection;
doDelete;
select -cl;
;
Magenta to Green:
//Green to Magenta through white
select -all;
doDelete;
float $ballsAround = 6.0;
float $steps = 1.0/12.0;
float $width = 360.0/$ballsAround;
string $name;
//float $radius = 1.0;
for ($i= 0;$i<6.0;$i++)//angle
{
for($j=0;$j<12.0;$j++) //radius or saturation
{
$angle = $i * $width; //width for each step //how much to rotate by, absolute rotate
$sat = $j*$steps; //how much to translate by, this is the saturation hsv_to_rgb
$hue = $angle/360.0;
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
vector $v = hsv_to_rgb(<<$hue, $sat, 1>>);
setAttr $name2 -type double3 ($v.x) ($v.y) ($v.z);
polySphere -ch on -o on -r .06;
xform -translation $sat 0 0;
rotate -pivot .01 .01 .01 0 $angle 0;
hyperShade -assign $name;
}
}
select -r pSphere1 pSphere26 pSphere27 pSphere28 pSphere29 pSphere30 pSphere31 pSphere32 pSphere33 pSphere34 pSphere35 pSphere36 pSphere62 pSphere63 pSphere64 pSphere65 pSphere66 pSphere67 pSphere68 pSphere69 pSphere70 pSphere71 pSphere72 ;
invertSelection;
doDelete;
select -r pSphere1 pSphere26 pSphere27 pSphere28 pSphere29 pSphere30 pSphere31 pSphere32 pSphere33 pSphere34 pSphere35 pSphere36 ;
rotate -pivot 0 0 0 0 180 0 ;
select -r pSphere62 pSphere63 pSphere64 pSphere65 pSphere66 pSphere67 pSphere68 pSphere69 pSphere70 pSphere71 pSphere72 ;
rotate -pivot 0 0 0 30;
select -cl;
;
Part 4: Two "non-linear" transitions between complementary colors
Red to Cyan:
//teal to red with no white
select -all;
doDelete;
int $ballNumb = 8;
for ($z = 0; $z<$ballNumb; ++$z)
{
for ($y = 0; $y<$ballNumb; ++$y)
{
for ($x = 0; $x <$ballNumb; ++$x)
{
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
setAttr $name2 -type double3 ($x/7.0) ($y/7.0)($z/7.0);
polySphere -ch on -o on -r .06;
xform -translation ($x/7.0) ($y/7.0) ($z/7.0);
hyperShade -assign $name;
}
}
}
select -r pSphere8 pSphere16 pSphere24 pSphere32 pSphere40 pSphere48 pSphere56 pSphere57 pSphere58 pSphere59 pSphere60 pSphere61 pSphere62 pSphere63 pSphere64 pSphere121 pSphere185 pSphere249 pSphere313 pSphere377 pSphere441 pSphere505 ;
invertSelection;
doDelete;
select -r pSphere57 pSphere121 pSphere185 pSphere249 pSphere313 pSphere377 pSphere441 pSphere505 ;
rotate -pivot 0 1 0 0 -90 0;
select -r pSphere8 pSphere16 pSphere24 pSphere32 pSphere40 pSphere48 pSphere56 pSphere64 ;
rotate -pivot 1 1 0 0 0 90;
select -cl;
;
Green to Magenta:
//green to magenta with no white
select -all;
doDelete;
int $ballNumb = 8;
for ($z = 0; $z<$ballNumb; ++$z)
{
for ($y = 0; $y<$ballNumb; ++$y)
{
for ($x = 0; $x <$ballNumb; ++$x)
{
$name = `shadingNode -asShader blinn`;
$name2 = $name + ".color";
setAttr $name2 -type double3 ($x/7.0) ($y/7.0)($z/7.0);
polySphere -ch on -o on -r .06;
xform -translation ($x/7.0) ($y/7.0) ($z/7.0);
hyperShade -assign $name;
}
}
}
select -r pSphere57 pSphere121 pSphere185 pSphere249 pSphere313 pSphere377 pSphere441 pSphere449 pSphere450 pSphere451 pSphere452 pSphere453 pSphere454 pSphere455 pSphere456 pSphere457 pSphere465 pSphere473 pSphere481 pSphere489 pSphere497 pSphere505 ;
invertSelection;
doDelete;
select -r pSphere57 pSphere121 pSphere185 pSphere249 pSphere313 pSphere377 pSphere441 pSphere449 pSphere457 pSphere465 pSphere473 pSphere481 pSphere489 pSphere497 pSphere505 ;
rotate -pivot 0 0 0 0 0 90;
select -r pSphere57 pSphere121 pSphere185 pSphere249 pSphere313 pSphere377 pSphere441 pSphere505 ;
rotate -pivot -1 0 1 0 90 0 ;
select -cl;
;
Part 5: Novel use of color
http://www.flickr.com/photos/txross/3921853686
Here's the link to the original picture
Here, I set the balance to think yellow was white. Nothing really changed except everything looked bluer.
Then I set the balance to blue. All it did was make the flower and everything else more orange.
Here I changed it to magenta. It made everything green, so I thought that if you could stare at it long enough you could see the imaginary color, but I didn't see anything.
The picture itself has amazing color harmony going from yellow to blue, though looking at it with the camera, the transition mostly goes through black and not a color where I could try to show the impossible bluish-yellow. The flower is gorgeous and demonstrates color harmony in nature. Though I coudn't show the color, it was interesting to demonstrate how the camera sees color through the different white balances.
No comments:
Post a Comment