Sunday, February 27, 2011

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.