# Hierarchial Modeling & Boids

## Original Concept

My original concept was much different than my actual result. Originally I had wanted to create a scene that would accurately animate a walking motion. I was going to work with a friend of mine in the Art 384 class and we were planning on working together to build a scene. We had a number of ideas ranging from building a Conan O'Brien, to building a Totoro model, to building a catapult and launching stuff. Unfortunately, none of these plans worked out. His teacher wanted something original not something that could be done. On top of that his computer crashed at the last moment. In the end he was able to provide me with a model, but it was fairly simple and rushed. I decided against using it and needed a new concept.

## Change of Concept

So instead of using a model, I decided to use geometry to build a model and hierarchially animate it. In addition I wanted to implement some other concepts. One thing I really like using in class was the concept of a boid. I thought it was a very powerful tool and it was something that I wanted to utilize.

## Technologies Utilized

The two main technologies that I used for this Final Project was the use of boids and hierarchial modeling. I also utilized phong shading and added attenuation. I have about 16 lights going around the scene all various colors and positions. I have about 11 different materials that I used to build my robot and some that are being used by the boiding bunnies.

### Boids

The algorithim for a boid is super simple and composes of three seperate movements.

2. Movement toward a central mass of boids.
3. Movement away from each other.

In my project you can toggle between two different leaders. One leader is a robot and the other is a larger moving bunny. To toggle between the bunnies you can press the '1' key. The second movement of a boid comes from moving each object toward the central location. This is simply the average (x, y, z) of all objects contained in the boid. Last we have movement away from other objects apart of the boids. To me this whole concept was very interesting. The way you can manufacturing realistic movements was really cool! For my project I used two types of boids. First the bunnies are a part of a boid that goes on the x and z axis. Since bunnies can not fly this make sense. But in order to give the bunnies some movement I added a timer function that simulates jumping. Each bunny has its own randomized predetermined speed and height of jump. The other boids I used is not as noticeable. I made 8 lights a boid that also follows the leader around. These boids use all three axis. It is nice becuase it can illuminate most of the bunnies just with the same algorithim that moves them. Instead of lighting an entire map you can attach a boid of lights to your object and simply have it follow it. Its harder to notice but you can generally see it when the lights finally catch up to the leader. Though when that happens you don't really see the individual lights but rather all the lights merged on. This means that by time it catches up the final calculaterd color has high values of r, g, and b.

Boids are very interesting and it was fun to play around and adjust the magnitude of each movement. Avoiding a jittirey motion was optimal but sometimes you would have to sacrifice speed for quality. For the most part the boids look really cool and I want to implement them on objects that should take flight like birds. There were a lot of great resources on boids that were helpful in coming up with an algorithim.

### Hierarchial Modeing

The other major feature I implemented in my project was Hierarchial Modeling. Using the geometry that was providede I was able to build a fake bender like robot. This robot was then able to animate when the '1' key was pressed. He would animate and would be able to call the bunnies toward him. His animation composed of four parts.

1. Movement of eyes.
2. Movement of face looking to its left and right.
3. Movement of legs and body moving up and down.
4. Movement of arms in wacky ways.

The movement of the eyes was simple. It used trig functions and a timer function to move the eye.The cube is modeled in relation to a sphere so when you look at it up close it looks like the eye is being warped. It is quite interesting. The movement of the face is just a sin function multiplied by some coeffecient. The movement of the body and legs are actually done as too seperate thing. The legs are not in the same model as the body. I thought it would make more sense to start the hierarchy from the bottom up but it turns out that makes it quite difficult for animation and implementatin. My rational was that it would be easier to set the motion of something on the ground plane first then move up from there. Anyways I decided to model them seperately and so I have two seperate timer functions for the body and the legs. The movement of the arms is just another trig function with different variables.

## Controls

### Other

• 1 - change the leader and affect animation
• 2 - randomly push the bunnies to new locations
• r - reset to original position
• (esc)- quit

### Movement

• w - move forward
• a - turn camera left
• s - move backward
• d - turn camera right
• q - strafe left
• e - strafe right
• spacebar - jump up
• mouse - can change camera view

## Pictures

These pictures show off some of the lighting and animation

## References:

1. Dalling, Tom. "Modern OpenGL 07 – More Lighting." Tom Dalling Blog, 18 April 2013 Web. 18 March 2014.
2. WikiBooks. "GLSL Programming." WikiBooks. N.p., n.d. Web. 18 March 2014.
3. Reynolds, Craig "Boids Backgrond and Update." n.p., n.d. Web. 18 March 2014.
4. Parker Conrad."Boids Pseudocode." n.p, n. Web. 19 March 2014.
5. "Boids." Wikipedia. Wikimedia Foundation, 27 February 2013. Web. 20 March 2013.