Wednesday, 16 May 2012

Piano Animation

Today, I have just finished the piano scene, which consists of a POV shot and a side shot of Alex playing the piano.  This follows on from shot 8, in which I animated Alex approaching the piano and sitting down, and will involve her playing notes on the piano, which causes colours to fill the room.

This piece of animation has been one of my most involved that I have worked on for this project.  Since beginning the degree, I have worked with animating against sound and music before, but I have not actually had to animate a musical instrument being played accurately.  This required me to really make use of both my wide knowledge of animation and somewhat hazy knowledge of musical theory that I acquired from playing guitar for 8 years.  There was a huge amount of trial and error involved before I had this sequence animated in a way that was convincing and appealing.

To work out how hands should move on a piano, Valentino got the composer for the film to record this reference.

The thing that is immediately noticeable in this reference footage are the rotations of the hand.  The left and is very much a straight arc as the hand move between two notes.  The right hand has a slightly more complex movement; the wrist moves in a clockwise direction as each note is played with this hand.

In order to animate the piano, I decided to animate the piano keys first and then animate the hands, as once I had the keyframes for each note laid down, I would then know how the fingers and wrist had to move at each keyframe.  I initially made a test animation directly against this piece of footage; I did not get around to the animating the fingers but I did animate the keys accurately.

I worked out how to animate the keys fairly quickly.  I simply used linear curves and I set a keyframe for each note, when the key went down and then two frames either side of the keyframe in which the key was in its upward position.  It was also fairly easy to visualise when each note played and which one it followed, as the only channel the I was animating to was the Rotate X and the motion was simply linear.

As you see here, I have selected two piano notes and I can see how when one note is played, the other follows straight after.  This would make cleaning up this animation much easier and would allow me to animate against the tune accurately.

However, I needed to redo this animation as the piece of music played in the reference was not the same as the piece of music that was actually in the animatic and that I needed to animate against for the final cut; it was actually at a faster tempo and a higher key.  The left hand plays more or less the same set of notes in the final animatic, but the notes that the right hand should play in the animatic are actually different to what I initially animated and what the composer plays in the reference video.

In order to reanimate the left hand music accurately and in time with the actual notes in Maya, I got the help of Valentino's girlfriend, who is also called Alex and who plays the piano.  She worked out the notes for both the left hand and right hand and wrote out each of the notes on the actual sheet music, as pictured below.

Essentially, these four lines can be split into two parts; the top line is showing the notes that should be played by the right hand and the second line is showing the notes that should be played by the left hand at the same time as the right hand notes.  Equally, the third and fourth line represent the next set of bars in this piece of music.  The third line shows what notes the right hand should play and the fourth line show what notes should be played at the same time.

So for example, for the first two bars of D through to B flat, the keys F and C should be animated to play at the same time as each of the notes.  For the second lot of bars, the notes of C and G must be animated.  The second line of notes must play at exactly the same time and tempo as the first line of notes.

In order to do this, I animated the keys for F and C eight times, followed by the keys of C and G and then B flat and F so that they were roughly in time with the progression of D through to B flat and then D through to A.

In order to make sure that these notes were animated in sync, I decided to tweak the animation using the Dope Sheet.  Firstly, I gave all of the keys that needed to be animated meaningful names (in other words, the names of the notes that they represent), so I could see where each left hand note was falling in relation to the right hand note.

For example, when I clicked on the keys for D and F, the first two notes of the piece and studied the frames on the dope sheet, it was apparent that they were out of sync with one another.

Each downward movement of a key is represented by three frames, two in which the key is in the upward position and one in between them in which the key is pressed down.  All three frames for the notes of F and D, had to be aligned.  The same is true for the next two sets of notes in the bar, C and E and so on.

Here is how the notes should look on the dope sheet.  Completely in line with one another.

I went through each set of notes in each bar until the left hand keys and right hand keys were in sync with the soundtrack, as illustrated in this video below.

The next layer of animation for this shot was the movement of the hands.  The keys had been synced up with the notes in this shot, now I needed to animate the hands so that they were synced with the movement of the keys.

As you see in the video reference, the left hand is more of a straight arc movement, whereas the right hand has a slower arc movement in the wrist, alongside a more linear movement in the fingers.  The movement of the fingers was done in much the same way as the keys; as each of the fingers has its own individual channel for driving the bending, I could keyframe the bend of the fingers in time with the key movement.  Each key frame of a finger going down needed to fall with the key frame of a key going down.

Due to practical reasons, such as the distance at which the fingers could actually spread, I had to have a slight jump movement in between the D which is played with the thumb and the F, G and A which are played with the next three fingers.  I could sort this out simply by increasing the rotation on the X axis and then smoothening it out to create a natural arc.  

I had to create this animation manually (i.e. without cycling the curves), as I needed to keep the finger movement in time and with the music and key movement.  

As for the left hand, this was very much a single rotation back and forth of the wrist, which is accompanied either by an increase in the thumb tap or an increase in the Pinky channel.  This too had to be aligned with the keys that were being played.

I had set a key frame of the wrist which falls in between each key of the bar which did slow the wrist movement and make it stiff, so i simply deleted the rotation channels for these keyframes (but kept the channels for the fingers as these needed to maintain an up and down movement).  I also flattened everything out to create a smooth movement in between each keyframe.

After playing two bars of F and C, she switches to playing two bars of C and G, and then ultimately playing two bars of B flat and F.  In order for her to make this transition, I simply key framed the elbow control to rotate and move the wrist to the correct set of notes.  I also keyframed and extended the finger spread for a small amount of frames to make it look as though her fingers are stretching to move to each set of notes, as they do in the reference video.

To tidy up the hand movement, I went through each note in to the graph editor to check the rotate X channel of the relevant keys was aligned with the relevant finger channel.  For example, this image displays the note of F being played by the ring finger.

In the graph editor, I can see that the ring finger comes down slightly before the F key comes down.  Therefore, the timing is slightly off.  I resolved this by moving the keyframe in the Pinky channel (which is in white on the graph editor) forward so that it was perfectly aligned with the keyframe of the F key coming down (which is red on the graph editor).

In this image, the Pinky and the Rotate X channels are now perfectly aligned.  I can tell that the pinky will come down and tap on the F key when it goes down and that both the finger and key will be in time with the note of F in the soundtrack.

I went through each note on both hands a I did this check until all of the finger movements were aligned with the respective notes.  Here is the final outcome of this piece of animation.

The camera shot changes at around frame 163 from a POV to a mid to close up shot that slowly zooms in.  This shows Alex playing the piano; I simply added a smiling face with some head movement to show her concentrating on the piano playing and the colours that erupt around her.  I also added some slow shoulder and elbow movement to maintain that she is playing this piano.   

This entire piece of animation took me three days straight; there was a huge amount of trial and error involved, along with constantly having to redo animation from scratch but I eventually got it fixed.  This is one of the shots that I am most pleased with in this film as it had taken the longest to do, but I also learnt a new way of animating.

No comments:

Post a Comment