Friday, May 21, 2010

Scene Two Complete

I have finished a very straight rough version of scene two which is a skit of a fat dodo trying to flying. I have just quick and roughly done the animation sequences in Maya and imported into Unity.

The sequences for in the Maya file for my fat dodo are:
Frames 1 - 50 - Lying on Ground/Idle
51 - 200 - Trying to Stand Up
201 - 260 run cycle
260 - 340 jumps into air and then crashes.

At this stages the animations are very rough. It will take quite a lot of time next semester to sit down and get these animations 100% perfect.

In putting together my second scene I also put together a script that fades out scene one and loads scene two. Fortunately this was much easier that I had thought. The code used to do this is:

LevelLoadFade.FadeAndLoadLevel("Scene2", Color.black, 3);


It turns out fading between cameras is more difficult than fading between levels!

This weekend I hope to get scene three and four completed.

Wednesday, May 19, 2010

Scene One: How it all works & changes.

Just thought I'd put a quick post in on how scene one is setup in Unity and discuss the scripts I have used.

Below is an image of the scenes setup:


The four big rectangles are my four triggers, and the red line shows the waypoints the dodo follows. There is also three cameras, camera one is a third person camera targeting the dodo, camera two has a script attached which caused it to look at the dodo as it flies, and finally a fixed camera which shows the dodo crashing.

My first trigger switches the view from camera one to camera two. The script it uses to do this is the cross-fade script mentioned in my last post which I have modified to work when OnTriggerEnter is fired as below.


var camera1 : Camera;
var camera2 : Camera;
var fadeTime = 2.0;
private var inProgress = false;
private var swap = false;
function OnTriggerEnter (collision : Collider)
{
DoFade();
}

function DoFade () {
if (inProgress) return;
inProgress = true;

swap = !swap;
yield ScreenWipe.use.CrossFade (swap? camera1 : camera2, swap? camera2 : camera1, fadeTime);

inProgress = false;
}


The second trigger switches the view from camera two back to camera one with the same script as above.

The third trigger switches the camera from camera one to camera three and changes the dodo's animation to the crash animation. This is done by modifying my crossfade camera's trigger script as above to have an extra variable which is a gameobject.

var animateobject: GameObject;


Once I attach this script to the trigger I can then set animateobject to the instance of my dodo. I can then use the following line to switch the animation my dodo is playing with this line in OnTriggerEnter:
animateobject.animation.CrossFade("crash");


My final trigger took me a considerable amount of time to figure out. Unfortunately once I attached a rigid body to my dodo so it would cause a trigger event when passing through triggers it would no longer stop when it ran out of waypoints. As a result my dodo would keep going beyond the last waypoint until it hit the volcano and then it would bounce all over the place. After alot of googling and trial and error I came up with the solution of removing the rigid body once my dodo hit the final trigger with the following very simple line:
Destroy (other.rigidbody);


This stops my dodo moving but plays out the last of the crash animation. This trigger also cause's a cube to fall out of a tree. This cube represents a fruit which I will model down the track which will fall on the dodo when it crashes in the tree. To trigger the fruit to fall the cube has a rigidbody attached with gravity turned off. My final triggers script has the variable:
var fruit: GameObject;


When the trigger even is fired I simple enable gravity on this rigid body which causes it to fall with this line:
fruit.rigidbody.useGravity = true;


Overall I'm happy with how the scene is setup although it is obviously rough. The only changes I am going to make are to tweak the camera angles and to remove the 3rd person camera and replace it with scripted camera's which move as desired around the dodo so I don't need to manually move the camera's when recording the scene. My ultimate goal is to have the scene scripted to play from start to finish without my input. This will make it nice and easy next semester for me to update models an recapture the entire movie.

Sunday, May 16, 2010

Scene Two Progress

I have made a good start on scene two of my animatic. I have boxed out all the animations required in my fat dodo's maya file and imported it as an FBX into Unity. I have learnt from my previous mistakes and getting much more used to the process of successfully getting models and animations successfully imported into Unity the first time everytime which is beginning to save me a lot of time.

So far in scene two I have three fat dodo's carrying out various animation sequences at the same time in this scene. All of these dodo's are instances of the same model, this will make it nice and easy for me to make changes to these models next semester without having to change multiple files. To make these dodo's more individualized next semester I will assign each one an individual texture.

I think in the scene two is the most difficult of the five scenes of my animation. Hopefully I will have it completed by next weekend which will leave me with a week and a half to complete my remaining three scenes. At the moment I'm very busy with other subjects so it's touch and go but, now I have learnt all the skills required to complete my animatic I'm confident I can get it completed in time.

Friday, May 14, 2010

Scene One Complete

I have now finished boxing out the first scene of my animatic in Unity. I'll add a video of it in action when I get home tonight.

I have found creating this scene a great confidence booster as I have been quite intimidated by this subject throughout the semester but, in completing this scene I think I have learnt all the skills required for me to completely box out my animatic for me to build on next semester.

To get this scene to work I have used quite a lot of scripting to get my character to move through the scene, and control camera's. I have done this so that the scene plays itself out without me having to control the character while capturing the scene. This means everything I record the scene everything will be exactly the same which hopefully means I'll be able to do everything in one take.

The first script I used is a third person camera controller I scripted for the first tutorial of semester. I slightly adjusted it though so that the camera is controlled by the mouse instead of keys as in the tutorial I submitted. This allows me to control the camera around my character as it flys around the island and zoom in and out.

The second script I have used is a slightly modified waypoint script from:
http://www.unifycommunity.com/wiki/index.php?title=SeekSteer

I had to modify this script to turn my character more realistically. When implementing the waypoint script as is I found that my characters would do a complete 360 everytime it hit a waypoint. I still would like to modify it further to make my flying dodo bank left and right when turning as at the moment he stays completely level. I will come back to this next semester after the animatic is complete.

The third a final script I have used is a camera switcher which cross fades between the two camera. I used this to switch between camera's as this will again allow me to capture the animatic all in one take and eliminate the amount of work I will need to do to put multiple captured videos together. It also means that when I make changes to the animatic I can view it from start to finish including camera fades etc without having to open a video editor and stitch different captures together and add fades etc manually. The camera in my first scene fades to a second camera when the character passes through a box collider which is placed at a particular waypoint.

The crossfade script can be found here:
http://www.unifycommunity.com/wiki/index.php?title=CrossFade

Now I have completed this scene I am confident that I have now developed all the skills required to complete my animatic and now its just a matter of putting in the hours to get through all five of my planned scenes. At this stage I have stopped modeling and texturing and am focusing purely on boxing out my scenes in Unity.


Download here (better quality):
http://chrisgordon.com.au/dodo/scene1.avi

Sunday, May 9, 2010

Walking and Jumping Dodo

This week I animated a walk cycle and jump animation for my fat dodo and imported it into Unity. Importing the new animation cycles was completely straightforward. To start with every time I imported my Dodo as an FBX file unity would only import the Dodo's eyes, the bodies geometry was nowhere to be seen. I then tried importing the geometry as a Maya file directly which also had the same result.

After some messing around in Maya, and some heavy Googling I deleted all Maya history and re-imported my model into Unity successfully.

I have setup the animation sequences in Unity and attached a character controller to the model with a script to control the Dodo's movement and allow it to jump. This was incredibly easy to do which I found quite surprising. To learn how to do this I used Unity's documentation and a visit or two to the forums. I found Unity's documentation extremely detailed but, hard to find answers to specific questions as most documentation takes the form of complete tutorials.

You can walk around my Island set with my fat Dodo here, standard FPS controls apply (space to jump):

Friday, May 7, 2010

Normal Maps Part 2 and Creating Realistic Feathers

After speaking to Paul in the tutorial he suggested using Blender's normal mapping tools, or Crazy Bump as they are much better than Maya's. I will give Blender ago later in the week.

Over the last few days while attempting to normal map my models I have also been considering other way's to give my characters the appearance of feathers/fluff. After some research I found this video which shows the results of using the MZFeather plugin which looks perfect for the overall effect I would like to acheive:



I was unable to locate the actual plugins itself though after some pretty heavy googling. Fortunately Paul managed to find it at:

Unfortunately the author of this plugin is selling it for 160 Euros which is to expensive for my budget/if could afford it is a little steep for what it is. I have emailed the author to ask whether I can use this plugin for a lesser price as a one off for this assignment.


Monday, May 3, 2010

Normal Mapping Difficulties

Although I have tried following the transfer maps tutorial mentioned in the previous post I have been unable to have much success.

As a test I simply extruded a couple of polygons on my fat dodo's chest so the create smooth bumps on his chest. As per the tutorial I duplicated my geometry, made my changes to the high quality mesh and then used transfer maps to create a normal map of the high quality mesh and apply it to the low quality mesh. This did work and a normal map has been created but as you can see in the images below the results are not desirable.

It looks like Maya has triangulated the high quality mesh and then created the normal map to apply to the low poly model which has result in lots of triangular impression on the model. Aside from the this the bumps I created as a test haven't appear properly either. I will talk to Paul about this in the tutorial tomorrow and see if he can point me in the right direction.