Saturday, August 28, 2010

How to Animate a Lightsaber in Blender 2.5

Hello, everyone!  This is the final part for the lightsaber tutorial series, and is obviously optional if you want to produce a still render.  Let's get started!

We'll begin by adding a bone (Shift A - Armature - Single Bone).  Line up the bottom of the bone with the bottom of the lightsaber handle (make sure to look at front, top, and side view before continuing).  Select the button on the right that looks like a stick figure, and click 'Stick' in the Display panel.  You'll probably have to re-align the bone a bit, then drag the top of the bone to the top of the lightsaber blade.


Now select the bone, the camera, and the lamp, then Press Ctrl I to invert the selection.  This will select the blades and the handle.  Now Shift-Right Click the bone to select it, and type Ctrl P on your keyboard, then select 'Automatic Weights'.  This parents the mesh to the bone, so that wherever the bone goes, the mesh will follow.  You may be wondering why we can't just move the handle and two blades around together and animate it.  If you do, this will be the result:

As you can see, we clearly need the bone to hold it all together properly.  Now if you rotate, move, or scale your bone, you should see that the lightsaber follows it.  Now we'll start on the animating.  Make sure your bone is selected (Right Click), and press I and select Rotation.  This is just for demonstration purposes.  If you want to move your lightsaber around, select Location.  If you want to rotate it (as I'm doing) select Rotation.  And if you want to scale it up or down, select Scale.  And of course, do all three if you want to move, rotate, and scale it.  In a separate .blend file, take some time to experiment with the other options if you wish, but read the rest of the animating process first.

Now check these two things; if you did it correctly, the white letters in the lower left corner will now be orange.  Also, make sure that the number on the bottom (as shown below) is on 1.  This is the frame number, and the starting point is, of course, frame 1.

Now hit the Up arrow key.  This will move forward 10 frames.  You should now be on frame 11.  Rotate your lightsaber as far as you want to.  The farther you rotate it, the faster it will move, and vice versa.  Now press I again and select Rotation (if you're rotating it).  Every time you press I and select an option, you are inserting keyframes.  These keyframes are the main points of animation.  Once you have set your keyframes, blender calculates the frames in between to fill it in.

Now if you go back to frame one by pressing the Down Arrow key, and Press Alt A, your lightsaber should move!  Now repeat the process of inserting keyframes in whatever way you want.  To go up or down just one frame, use the left and right arrow keys instead.  You can also click the arrows next to the frame number at the bottom.

My animation has only 50 frames, so I've set the End to 50.  My timeline now look like this:


Now to render the animation.  Click on the button that looks like a camera (it will take you to the rendering panel).  Typically, I would save a basic animation in QuickTime format, as it is relatively straightforward and works most of the time.  But in 2.53 beta, there appears to be a bug where every time one tries to render an animation in QuickTime, blender crashes.  So I will use AVI Raw for this demonstration.  AVI Raw files can be played in Windows Media player, and several other media programs.  This can be done in the Output panel.

Click on the folder button (as shown above) to choose where you want your animation to be saved.  I am also going to change the fps (frames per second) to 29.97, as I think it gives a smoother animation than 24 (this can be done under the dimensions panel).  Finally, click the Animate button at the top of the Render panel.  Once it's finished rendering, go to the place where you saved your file, and play through your animation.  Great job!  You've now animated a lightsaber in blender!  If you have any questions, comments, or problems, post them in the comments below.  Thanks for reading!

No comments:

Post a Comment