Thursday, May 12, 2011

Final Project Turn In - Finished Project

So, this blog post will link to my final .zip packaged that I've finished for my final project. In my project, I have made an animation that demonstrates all 12 animation principles first created by the Disney animators. For the project, I have linked 4 programs: Maya (to make the flour sack and animate it) the cygwin bash terminal ffmpeg (to make the movie) imagemagick (to add the frame count and titles) In Maya, I open the blank flour sack, animate it using a .mel script, and save the scene. Next, I run from the terminal I run the maya render executable file to render out my frames of the flour sack. With image magick, I add titles for the animation principles and the frame count. Then with ffmpeg, I make a new movie out of the changed frames. This is all run from the terminal with one script, calling to other scripts. This a sample of the animation the script produces:





And here is the link to my .zip file that I've saved in dropbox:

FinalLink

It contains:

A README.txt file explaining the contents
The original maya file to be worked on
A script that scripts the animation with mel
A pipeline script that puts it all together
A finished video of what the output should be

These scripts will work from the directory, but where I have direct file paths, they must be changed to match to where:
You put the orginal maya file
Where your maya.exe file is located
Where your scripts are located

Friday, May 6, 2011

Assignment 4.3 Final Turn In Blog

So here's the link to my final .zip folder in dropbox:

Tess's Final

The .zip file includes the history from my bash terminal, a maya file with my blank flour sack, a .mel script that animates the file, a README text file, and a bash script that runs it all.

I originally wanted to do a more elaborate animation, but getting all of the programs to run together in the bash terminal took up most of my time.

This project was most useful to me regarding adding a frame counter to my animations. In my version of maya, I can't seem to playblast. The scenes will render, but it will not playblast which gives me a convinient frame counter. It only gives me a black screen. This project will open maya, animate the flour sack, add a frame counter, and assemble the frames into a movie. With larger files, the codec screws up the resolution. For this project to be the most useful to me, I would need to figure out the best codec so my high quality renders don't get become fragmented.

Wednesday, May 4, 2011

Final Project Trial and Error 3

After being able to run the animation and render it from Maya, I tried to get it to run from bash, that way I can demonstrate the two programs communicating. I was able to do so by giving it this command:

./maya.exe -command 'source "C:/Program Files/Autodesk/Maya2011/bin/SquastTes
t.mel"';./Render.exe -r mr -s 1 -e 35 -b 1 C:/Users/Tess/Desktop/IFDM210/TestTe
stAgainTest.ma

Now it will open a fresh flour sack without animation, animate it to do a squash and stretch, save it out as a .ma file, then the user has to exit out of maya. Then the render process starts, and it batch renders out the files.

My next move is going to be to find the images, put them in a list, mogrify them with image magick, and combine them into a new movie with ffmpeg.

Final Trail and Error 2

Ok, so still having the saving problems. I've figured out how to get the batchRender command to work in the mel script, but it needs a file to source. I can't find a way to say THIS is the file I want to render. I can give it the current path:



batchRender -f "C:/Users/Tess/Desktop/IFDM210/TestTest.mb";



but it'll render the file without the changed animation. Which brings us back to the saving problem.

Next, I've tried to source the script so I can call it. However, the default place to source the script is


C:\Users\Tess\Documents\maya\2011-x64\prefs\scriptEditorTemp


And if I try to put the file in there, it gets deleted the next time I try to source the file.
Next I tried to use the mel command
source: (then it goes directly to the SwashAndStretchy file)
That was able to use the Swash command, but then it wasn't able to call it again after that once sourcing.

Wait, I got it! In order to get it to save properly, I had to use the command :

source "C:/Program Files/Autodesk/Maya2011/bin/SwashAndStretchy.mel"


Then it was able to open the blank flour sack, animate it, save it out, and render it out. From here I'm going to try to run it through the bash terminal.

Tuesday, May 3, 2011

Final Project trial and error 1

Ok, so I am trying to run a mel script through cygwin. So far I can open maya and the mel script that gives me the first principle: squash and stretch. It opens maya though, and I'm hoping to run the script through maya without actually opening it because it takes a while to open the application. My main problem is when I try to use the function "batchRender" When I put BatchRender at the end of my mel script, it gives me the error :

// Warning: The renderer ('base_OpenGL_Renderer') is not a registered renderer. Renderer will not be set. //
// Error: No object matches name: strokeGlobals.wrapH //



I tried giving it the file path to the Render.exe file, but that gave me the same error.
This is what I tried at the end of the file.

BatchRender "C:\Program Files\Autodesk\Maya2011\bin\Render.exe";


Ok, so now I found you can render from the command line itself:
I used the code


./Render.exe -r -mr -s 10 -e 15 -b 1 TessFlourRevise.mb



So, the last part of my problem I'm facing is the proper way to save the file as a new name. I've tried to put this in my script:


file -rename "C:/Users/Tess/Desktop/IFDM210/newSceneName";
file -save -type "mayaBinary";


But when I run it at the same time as my code that animates the file, it doesn't save the right things. When I open the file, it gives me this error:

Maya binary file parse error: : (5) bad block

Looking in online forums, they said it's a bad save and you need to scrap the file.

I'm not sure how I'm saving it wrong. It renames the file and saves it, but it loses all of my data.

Now I'm trying to run both the mel script and the render script in the same file.


#!/usr/bin/bash

./maya.exe SwashAndStretchy.mel

./Render.exe -r mr -s 1 -e 35 -b 1 C:/Users/Tess/Desktop/IFDM210/TestFlourSackBlah.mb


When I run it, I have to exit out of the maya file it opens before the batch render can begin. My question that I'm trying to answer is can you run a mel script affecting the scene in maya without actually having to open the file in maya? And how can I properly save with a mel script without it corrupting the file.

Assignment 4.3

So, here is the completed assignment 4.3 or a finishing up of the test from the last class. In the command line, you enter the name of the script (for example, ./makeNewMovie.sh), then it takes the command line arguments of what movie you want to run the script on and another parameter of whether you want the frame counter. The user has to put in that parameter of whether they want the frame counter, so if they don't they should put something like no. If you don't give the command any arguments, it'll spit back "I need a movie to use" and exit the script. The user can put in any mogrify command they want, such as -charcoal 5.

#!/usr/bin/bash

#These are the command line arguments that the user puts in when calling the script
#This is the name of the movie you give
MOVIE=$1
#This is the mogrify or convert command you want
STRING=$2
#This is where the user tells if they want the frame counter. They have to put frame in the command if they want to use it. They have to write something
TEXT=$3
#If the command line has no arguments...
if [ $# == 0 ];
then
echo I need a movie to use
exit
fi
#It tells the user it needs a movie and exits
echo Processing the video called: $MOVIE

#This will streamline the image files it dumps out
FRAMEPRE=${MOVIE}-frame-
echo I will call the frames this:- $FRAMEPRE -with frame numbers following

#This dumps out the frames
ffmpeg -i ${MOVIE} -r 24 -s 640x360 -f image2 ${FRAMEPRE}%04d-expelled.png

#This compiles the dumped frames into a variable
FRAMES=`ls *expelled.png`
#Set I that we will increment in the loop
I=1

#For every object in the variable FRAMES
for FRAME in $FRAMES
#start the loop
do
#This does what the person wants to do, any string is fine. Imagemagick is preferable
${STRING} $FRAME
#This is for the third argument. The user has to put in SOMETHING or it won't work. They could put no for example.
if [ $TEXT == frame ];
then
#This puts the frame counter on
mogrify -pointsize 16 -font courier -annotate +50+50 "Frame ${I}" $FRAME
fi
#This renames all the expelled names to flop names
NFN=`printf "${FRAMEPRE}%04d-flop.png" $I`
#Increment the loop
I=$(($I+1))
#This moves FRAME to NFN or new file name
mv $FRAME $NFN
#This converts the .png to jpg. I found this gave the movie the best quality than just doing .jpg Just .png gives weird blue fragments
convert $NFN $NFN.jpg
echo converting frame $I
#cp $FRAME $NFN
done

#This compiles the movie at a rate of 24fps
ffmpeg -f image2 -r 24 -s 640x360 -i ${FRAMEPRE}%04d-flop.png.jpg RedoneMovie.mov
#These 2 remove all of the images, so you are left with just the original movie and the changed movie
rm *.png
rm *.png.jpg

This is the original movie that I put in (an image of it).


And this is the movie that the script made.

Monday, April 25, 2011

Final Project: Animation Scripting

So, for my final project I'm thinking about demonstrating the 12 principles of animation through running a script in maya that animates this flour sack rig I have, then it renders these frames out to a folder in my computer. ffmpeg then takes those files, writes something on them, (most likley using the mogrify command) and compiles the frames into a movie that I can showcase.

The whole reason I wanted to join IFDM was to become an animator, and the main elements of animation were first devoloped by the original animators at Disney. The principles are:

*Swash and Stretch
*anticipation
*staging
*straight ahead and pose to pose (different processes of animation)
*follow through and overlapping
*arcs
*secondary action
*timing
*exaggeration
*solid drawing
*appeal

I also considered doing a user interface in maya that could help me with some of these animations, but I haven't used one before, so I'm not sure what the goals would be for that.




This was an awesome video I found that describes what I want to demonstrate with the flour sack. This would be a benchmark I would want to compare my results to.

Movie Review: Source Code



source

So, one movie I put of seeing was Source Code. I wanted to see it since it came out a few weeks ago, but I hadn't gotten around to it until yesterday.

Talking about the movie other that the general plot will give away some spoilers. It's the story of a military guy who is forced to go into a dead man's body for the last 8 minutes of his life through the program called the Source Code. If you want to think about it this way: it's basically Groundhog Day where the same 8 minutes on a train about to blow up is relived until he can find the bomber.

I liked the film overall, but it wasn't amazing. It was interesting trying to figure out who the bomber is, but it was a little obvious who it was (my friend who was seeing it with me guessed it during the first time going in the Source Code).

What I really liked about the movie where some of the special effects in it. They were done by a company by Modus X in Montreal, and I liked their effects like the explosions and the train itself. Other than a few scenes, the explosions looked believable. They were a little bit over the top at some parts though.

The movie was enjoyable, but I would not need to watch it a second time to pick up more details like I had to for something like Inception.

Monday, April 11, 2011

Assignment 4.2 - Bash Scripting Tutorials

This next part of the assignment was to find the best scripting tutorial to exectute scripts in the bash shell.



This was the first tutorial I used for creating bash scripts. It's a good tutorial for understanding how to exectute a script in bash. In class I didn't understand the chmod to allow a script to be exectutable, but this explained it nicely.



This tutorial showed how to use while loops in bash along with how to write commands on one line using the semicolon. I followed it and was able to write a script that made a while loop that printed out what it showed in the video.

Here's my history saved to a .txt file:

1 cd /cygdrive/c/Documents\ and\ Settings/Tess

2 ls -la

3 cd Desktop/

4 pwd

5 which bash

6 ls -la

7 bash testcode.sh

8 chmod +x testcode.sh

9 ./testcode.sh

10 ./testcode.sh

11 ./testcode.sh

12 ./testcode.sh

13 history >> history_apr6

14 history >> history_apr6.txt


And this is the code:

#!/usr/bin/bash
let x=1;while [ $x -lt 11 ];do echo "x is : $x";let x=$x+1;sleep 1;done

Wednesday, April 6, 2011

Assignment 4.2 Bash Scripting Part 1

Part 1: Using Bash Shell

So, I was finally able to install cyquin after the upteenth time trying. I had to restart my computer, and when I did that it was able to cleanly install the program. I thought a video would be nicer in helping me understand navigating in bash. This is helpful for navigating basically around your computer using bash. Here is my history that I saved into a txt file on my desktop when I was finally able to navigate to it. It was a much different way then on a mac, like the example in class.


1 cd
2 cd..
3 cd ..
4 cd
5 pwd
6 cd .
7 pwd
8 cd ..
9 pwd
10 cd ..
11 cd /home/
12 cd /Desktop
13 ls
14 ls -la
15 cd /
16 ls
17 ls -la
18 ls -al home
19 cd /
20 pwd
21 cd ..
22 cd /home
23 ls -la
24 cd /
25 ls -la
26 cd ~
27 pwd
28 ls -la
29 pwd
30 cd ..
31 cd /usr
32 ls -la
33 cd ~
34 pwd
35 cd /
36 pwd
37 mkdir tmp
38 mkdir test_tmp
39 pwd
40 cd /test_tmp
41 ls -la
42 history
43 history > apr6_test.txt
44 cd /
45 pwd
46 ls -la
47 /cygdrive/C
48 cd /cydribe/C:
49 cd /cygdrive/C
50 ls -la
51 cd /
52 cd /home/Tess
53 pwd
54 cd /home/Tess/Desktop
55 cd /home/Tess
56 ls -la
57 cd /cygdrive/c
58 ls -la
59 cd /cygdrive/c/Documents\ and\ Settings
60 ls -la
61 cd /cydrive/c/Documents]
62 pwd
63 cd /cydrive/c/Documents\ and\ Settings/desktop
64 ls -la
65 Tess
66 cd Tess
67 ls -la
68 cd Desktop/
69 history > history_apr6.txt

Thursday, March 31, 2011

Red Green Color Blindness Script

I guess it shouldn't be called color "blindness." With those with red-green color blindness, they have a harder time distinguishing between red and green hues. In this script, you need to already have a picture open (most likely a jpg with just a background layer.
var image = app.activeDocument;

var background = app.activeDocument.artLayers.getByName("Background");

background.duplicate();

background.visible = false;

var copy = image.artLayers.getByName("Background copy");

var newLayer = image.artLayers.add();

var newLayer = image.artLayers.add();

var Layer1 = image.artLayers.getByName("Layer 1");

var Layer2 = image.artLayers.getByName("Layer 2");

image.activeLayer = copy;

var redChannel = image.channels.getByName("Red");

var greenChannel = image.channels.getByName("Green");


var arrayRed = new Array (redChannel);

var arrayGreen = new Array (greenChannel);

var arrayChannel = new Array (redChannel, greenChannel);

image.activeChannels = arrayRed;


image.selection.selectAll();

image.selection.copy();

image.activeLayer = Layer1;

image.paste();

image.activeLayer = copy;

image.activeChannels = arrayGreen;

image.selection.selectAll();

image.selection.copy();

image.activeLayer = Layer2;

image.paste();

copy.visible = false;

image.activeLayer.blendMode = BlendMode.SCREEN;

image.mergeVisibleLayers();

image.selection.selectAll();

image.selection.copy();

copy.visible = true;

image.activeLayer = copy;

Layer2.visible = false;

image.activeChannels = arrayRed;

image.paste();

image.activeChannels = arrayGreen;

image.paste();

image.activeLayer = background;

image.flatten();

image.selection.deselect();
And when you run it on a red-green colorblindness test like this one: source It becomes this image after you run it: So, this code simulates the red-green color blindness. The code takes the red and green channels in an rgb image, copies and pastes them into new channels. The screen layer blend mode adds the two layers and averages them out. Then it pastes the resulting image back onto the red and green channels. The resulting image has the red and green channels being the same. In red green color blindness, individuals have a hard time distinguishing between red and green, and this simulates that effect. You can most clearly see this in a traditional test for the color deficiency.

Wednesday, March 23, 2011

Photoshop Script Tutorial and For Loops

http://www.kirupa.com/motiongraphics/ps_scripting.htm

I really liked this tutorial on Kirupa's site. It's good for beginners because it actually goes over all of the basics in scripting again like loops and arrays and variables for Java. It even goes over later in the tutorial how to use the script editor; it's the basic scripting tutorial all in one!

For writing a for loop in JavaScript, here's a simple one. It the same syntax as the code in maya.


for (a=1; a<=3; a++){ alert ("hello world") }


It will create an alert box three times when you launch it in Photoshop.

Automatic HDR image in Photoshop


This was my first try at a High-dynamic range picture using Photoshop. It was fun watching all the images getting lined up, but the image didn't turn out as good as I wanted. I had a few pictures that had details for the light outside, but it got washed out by the other pictures.
I would have uploaded the picture itself, but because it created a 32-bit color picture, it would only save it as a .tiff or a .psd. I took a screenshot of it because blogger can not upload those kinds of pictures.

Monday, March 21, 2011

Elfoid Phone



Source

So, one of the most creepy and fascinating things I've seen recently is this thing called the Elfoid P1, which is basically a phone in the shape of a creepy human doll.

It was developed at Japan's Advanced Telecommunications Research Institute. It is a miniature version of the already working Telenoid, which is a life size human robot that uses motion-capture technology to capture a person's facial expressions and body movements to convey a human presence.

The Elfoid doesn't work like the Telenoid right now, but when it does it will be like having a mini cell phone person talking to you. I think with video chatting the Skype, is there really a need for this kind of phone? I can have a better human experience with someone I can actually see, rather than a little version of them in my hand.

Sunday, March 20, 2011

Movie Review: Battle: LA


Source

I did not have a lot of interest in seeing this movie, but I thought I would see it just because nothing else was out. I saw a movie called "Skyline" last year, and I thought that it could not be worse than that movie.

The plot itself is nothing you really haven't seen before. You follow a group of marines assigned to evacuate a police station after all hell breaks loose. No one really knows what is going on, but the news reports that the invaders are really aliens. Apparently, they are here for our water, and they are exterminating all humans to get it.

I was pretty bored throughout the movie. It was hyper-violent, so after the first few explosions it was old news. The other aspect that bothered me was the "shaky-cam" like Cloverfield. I had a hard time following the action, and I had so little invested in the characters that I did not care who died.

Overall, Battle: Los Angeles is really only for big fans of action movies. I was really disappointed because you hardly even saw the aliens. They were always stuck on rooftops far away from the camera.

Movie Review: Rango


Source

So, I was finally able to catch up on some movies over the break, and my favorite that I saw was Rango.

I had wanted to see this movie ever since my theatre first got the poster last spring. I was really intrigued by Rango's design because it was so unique. Throughout the entire movie, I was impressed by all of the character designs and how good the animation was. I talked to some people who didn't like the story, but they were still impressed by how the movie looked.

What threw some people off was they thought they could bring their kids to this movie. Honestly, it is not for kids. The movie is basically a western, but animated. People automatically assume that when a movie is not live action, they can bring their five year old kids to it. Most of the references and jokes in this movie will go over their heads.

As far as the basic story goes, the main character is a wannabe actor/house pet who accidentally escapes his tank. He gets lost in the desert, and he goes on a journey to find "the spirit of the west." He finds a town called Dirt that is in the middle of a water crisis.

The best part of the movie is watching all of the amazing characters. I really liked this movie, and it's my favorite movie this year. If you really like westerns or just animation, it is definitely worth your time.

Thursday, March 3, 2011

Assignment 3 - Color Space Exploration

Part 1: Color Cube


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&lt;$ballNumb; ++$z)
{
for ($y = 0; $y&lt;$ballNumb; ++$y)
{
for ($x = 0; $x &lt;$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&lt;$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(&lt;&lt;$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&lt;$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 &lt;$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&lt;$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(&lt;&lt;$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&lt;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(&lt;&lt;$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&lt;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(&lt;&lt;$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&lt;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(&lt;&lt;$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

For the two "non-linear" transitions, I did it a different way than the linear ones. Instead of using my color wheel code, I used the color cube code from earlier. I made the color wheel, and selected colors around the edges, so that there was no way the colors could go through grey. Then I inverse selected the others, deleted them, and straightened out the spheres.

Red to Cyan:






//teal to red with no white
select -all;
doDelete;
int $ballNumb = 8;

for ($z = 0; $z&lt;$ballNumb; ++$z)
{
for ($y = 0; $y&lt;$ballNumb; ++$y)
{
for ($x = 0; $x &lt;$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&lt;$ballNumb; ++$z)
{
for ($y = 0; $y&lt;$ballNumb; ++$y)
{
for ($x = 0; $x &lt;$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
So, for this part I wanted to think about camera's saw color, and how that could be affected through the white balance. First, I found a picture that I thought expressed a good use of color harmony in nature.


http://www.flickr.com/photos/txross/3921853686

Here's the link to the original picture
This picture and flower makes a really cool transition between the natural complementary colors of yellow in the middle and blue on the outside. Wanted to experiment with the white balance on my camera and see if I could in a way effect the transition between the two, and maybe help show a forbidden color.

So, this was the first picture with the automatic white balance.

Then I changed the white balance to think that red was white, and it turned this cyan color. There wasn't any difference that I saw in the picture.
Next I set the balance to cyan, and everything looked sort of pink. I didn't expect there to be a difference, but I wanted to try it anyway.


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 last one I could try of the primary colors and their compliments was green, so everything turned into magenta.

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.


Sunday, February 27, 2011

Cheap Infrared Cameras and Night Vision

While looking up information about black light, I found a video on how you can modify a camcorder to pick up and record infra-red light. The video title is a misnomer, because it's not x-ray vision that the video is talking about. The camera picks up infra-red light that is outside the visible light spectrum on the other side of x-ray light. X-rays have a much higher frequency and shorter wavelength than infra-red.
This made me wonder about things like night vision cameras. Night vision operates in infrared aswell. Night vision cameras pick up thermal-IR, which is emmited by objects depending on their heat.
This is a really great article about night vision:

Most cameras use a process called Image-Encancement night vision to make images, but the artilce also talked about thermal imaging. This thermal imaging produces interesting images which record different shades of grey depending on the heat given off.


These are image-enhancing night vision images:






Black Light

One of the interesting questions I've had about the physics of light is about black light. It always interests me going to Hinkle Family Fun Center and Nickel city where you go down the hallway, and white clothing glows in the dark. My dad told me about black light posters he used to have back in the 1970's too. So I looked up online how a black light works and here's what I found:

So, a black light is one that produces light that is outside the narrow range of visible light. A black light produces Ultra-voilet light that the human eye can't see. The reason white shirts glow in the dark is because modern detergents contain phosphors that emit visible light when it reacts to radiation from UV light from black lights. Black lights usually come in two forms: a tube black light and an incandescent light bulb. They both work the same way: the black glass absorbs all light waves besides the UV-A and some blue or voilet visible light because of the special phosphor coating on them.

http://science.howstuffworks.com/innovation/everyday-innovations/black-light.htm

First RGB color wheel




After class on Thursday I was able to successfully make the first color wheel. I got the wheel working first, and then was able to use the hsv_to_rgb vector code to work. At first I was having trouble making the wheel because the balls were not rotating in the correct way. They were rotating around their center and not around the origin to make a wheel. I found that the rotate command lets you change the pivot of where the polyspheres rotate from. I couldn't get it to work if I changed the pivot to 0 0 0 or the origin in Maya, so i changed it to .01 which worked.
I'm working on the alternative color wheel now. I've decided on trying the artistic color wheel, which looks like this:




So, instead of yellow being across from blue, green being across from magenta and red being across from cyan, red and green are across, blue and orange are across, and yellow and purple are across from each other.

Monday, February 21, 2011

Tangled Hair

Tangled Hair Video

I'm really interested in animation, and over the break I saw Disney's 50th animation "Tangled." It is an amazing movie, not only because of the story and characters, but the animation is amazing for it. One interesting thing I've looked into is the hair for Rapunzel. Hair is incredibly hard to do with Computer animation, and the video up there is an amazing look into how they simulated the hair. It is amazing what they were able to do to combine the hair artistically with the programming that had to go behind the hair.



If you watch the video, it is such an incredible undertaking. Hair is so complicated, and it has so many parts that interact with each other takes some serious computing power. The way they solved that problem by in part only simulating parts of the hair that you could see in the shot, really inspired me. It is definelty the most realistic hair in a CG character.

Code from 2-17-11

We now know that if you do file -o "yourFileName.mel" you can generate the color cube. To open generate the color cube an easier way, I created a procedure in mel and named it "generateCube"





After you enter this, you can generate a color cube simply by calling the procedure. I also added an argument to the procedure called $ballNumb. That way, the person calling the procedure can pick the dimensions of the cube at the same time as calling the procedure. Now I can generate a color cube with one line of code.

Wednesday, February 16, 2011

Code from 2-15-11




This is the code that enables us to create the first version of the color cube. We have three for loops that create the cube of the spheres. First we create the shading node and store that in $name. Then we store $name and give it the attributes of color. Then we set the attribute of $name2 depending on where the position is. Then we create the sphere, move it, and then assign the color to the object. Here is what the cube looks like now:

Monday, February 7, 2011

Code from 2-3-11

//This is where I create the initial variables
int $x;
int $y;
int $z;
string $name;
string $name2;

//This is the for loop to create the polyspheres color cube without color.
for ($z = 0; $z<8; ++$z)
{
for ($y = 0; $y<8; ++$y)
{
for ($x = 0; $x <8; ++$x)
{
polySphere -ch on -o on -r .03;
xform -translation ($x/7.0) ($y/7.0) ($z/7.0);
}
}
};

//This is trying to give them color, but it doesn't work yet
for ($z = 0; $z<8; ++$z)
{
for ($y = 0; $y<8; ++$y)
{
for ($x = 0; $x <8; ++$x)
{
polySphere -ch on -o on -r .03;
$name = `shadingNode -asShader lambert`;
$name2 = $name + ".color";
//connectAttr -f lambert2.outColor lambert2SG.surfaceShader;
//sets -e -forceElement lambert2SG;
xform -translation ($x/7.0) ($y/7.0) ($z/7.0);
setAttr $name2 -type double3 1 0 0 ;
}
}
};

Friday, January 28, 2011

Assignment 2




Documentation:

This is the baseline assignment for the class, so I generated the bouncing ball using Maya and Quicktime Pro. I will put up exactly what I did in the recipe part, but for this section I'll generally say how I made the ball. In maya, I put the camera on the front view and made a box for the background. I then made a sphere, and textured it with a tennis ball texture. Then I put it generally in the corner of the screen and started to animate it. I'll put up exactly how I animated it in the recipe part. The first pass didn't look that good, so I went in and made the roll take longer and fixed all of the bounces using the graph editor in Maya. After it was finished, I added a blinn texture to the background and colored it white. I went into the render settings and used a batch render to generate the 96 images that I could import into Quicktime to make the animation. In Quicktime I imported the files and the program put them together for me. Then I exported it as a .mov file and put it up here on the blog.

Recipe:



First I opened Maya. Using the tab button, the main menu came back, and I arrowed up until I got to Maya. I pressed enter to start the program.




In Maya, go to Create > Polygon Primitives > Cube. The cube I created was height of 50, depth of 1, and width of 100. Then I made the tennis ball. The same way as the cube, I went to Create > Polygon Primitives > Sphere. I made a ball with radius of 25, with height and width divisions of 20 each. Made a simple tennis ball texture in Photoshop. Just making a small picture with a green background and a white 8 on it. To add the texture, right click and hold down on the selected object, then go down to the bottom where you see Assign New Material. There you can pick the color or texture you want. I decided to make them blinn textures. Where it says Color, click on the little arrow and choose texture for the tennis ball. Then you can add the tennis ball texture to the ball.



Now, I hit the space bar and right clicked to bring up the perspectives menu. From there I changed the screen layout to front. From there I moved the ball up to the top right part of my view.


Then I started to animate it. Select the ball at frame 1 and hit "s" to make that's the ball's position at frame 1. Then move the slider to frame 6. Select the ball and move it down and to the left until it touches the bottom of the background.





Hit "s" again to set the ball at frame 6. At this point, you can press the key button at the bottom near the script editor. That will set the auto key on so that you don't have to press "s" everytime you want to set a frame. I also hit the button next to it that looks like a guy running. Those are the settings, and I always do my animations 24 frames a second, and make sure the playback is at 24 frames a second. Here at the bottom I can also add the swash. On frame 5, hit "s" to set the position. On frame 6 when the ball touches, use the scale tool to swash it in the up-down direction. Then move to frame 7, you can do the opposite and stretch it with the scale. Then on frame 8 the ball goes back to normal. This is the bottom of the bounce, so now the ball will come back up again.


Move the time slider to frame 13, and move the ball to about half the height of the original bounce. This is the top of the arc. For the bottom I do the same process of moving it down and having it squash and stretch. In the end I have 5 bounces, each one diminishing in height by half. Each ball to the top of its arc is about 6 frames, though I will change it later in the graph editor.



Then I get to the end where the ball hits the wall. From there I have the ball roll for a little while and settle. On frame 58 the ball is on the ground again, and I have it roll until frame 78. The ball then rolls back and settles until frame 96.


I also rotate the ball 110 degrees rolling forward and -60 degrees backwards to make the ball actually look like it's rolling. Once I get my initial keys in, I polish the animation using the graph editor. To get the to the graph editor, go Window > Animation Editors > Graph Editor. Once that's pulled up, I go into the Translate Y on the left hand side. The Y direction is my default up in my Maya. To make the ball feel like it hits the ground harder, select the key (or the black dot) where the ball hits the ground. Then click on the "linear tangents" button, and it will straighten the Translate Y out for you, so the ball only hits the ground on one frame. I do this for all of the bounces. Here in the graph editor I make sure I don't have any keys out of frame, and then I'm going to render the frames.







To render out the frames, I go to the little clap boards at the top of the screen and go to the settings. I make sure they are saved as .jpeg images, and the name of the frames are name#.ext so I will have for example TessBall1.jpeg for use in Quicktime. I do the frame range as 1-96, and then it's ready to render. I make sure I'm in the rendering dropdown menu at the top of the page, then go to Render > Batch Render. This will render out the 96 files in a folder that you choose.


When it's done rendering, I launch Quicktime Pro. I press tab to open the main menu, and use the arrow keys to find Quicktime. I press enter to launch it. In quicktime, I alt + tab and the arrow keys to get to the file menu. I go File > Open Image Sequence. Then I navigate the folders to find where the images are stored. They should be something like TessBouncingBall1 through 96. Quicktime assembles the frames for you in order. Then I go to File > Export then hit enter. I saved the movie as a Quicktime Movie, and when I exported it All I had to do was upload it to the blogger site.