Advertisment

Create 3D Animations

author-image
PCQ Bureau
New Update

Ever wondered how those cool 3D wallpapers and animations were created? Here’s a chance to make a few yourself. In this article we concentrate on one 3D graphics rendering tool–Blender–that has arguably one of the fastest rendering engines. It is also extremely small in size–2.3 MB–unlike other commercial tools which occupy oodles of disk space. You can download Blender for free from www.blender.nl. Blender is not an open-source application, but the company that develops it, Not A Number, gives out the package for free. You can purchase a detailed printed manual from them. You’ll also find a lot of free manuals and excellent examples on the Web. The links are available at the above site.

Advertisment

You can install Blender from the August 2001 PCQuest CD. Mount the CD with

mount /mnt/cdrom 



cd /mnt/cdrom/cdrom/linux


cp blender2.12-linux-glibc2.1.2-i386-static.tar.gz /home/


cd /home/ 


tar xvfz blender2.12-linux-glibc2.1.2-i386-static.tar.gz 


cd blender2.12-linux-glibc2.1.2-i386-static 


Start X-Window and type ./blender




In the above commands replace with your home directory.

Advertisment

Now we’ll use Blender to make a 3D image and animate it. You can use your imagination and creativity to scale the use of Blender to new heights. More manuals, examples, and illustrations can be obtained from

www.blendermania.com and www.blender.nl We’ve also provided a few examples and a manual for beginners in the PCQuest July 2001 CD (CD 1).

Creating a 3D image

Go to the Blender directory and type ./blender to start up Blender. What you see on your screen is the canvas of your 3D world. At the bottom is a panel with lots of buttons. These may seem confusing, but as you get used to Blender, you will feel that the positioning of the buttons is perfect for working unhindered. On the canvas, at the center, you’ll see a circle with red and white dashes. This is your 3D cursor. Click anywhere on the canvas and the cursor will get positioned there. Any new object placed will appear at the cursor position. You will also see a triangular object at the lower middle end of the canvas. This is the camera. When the image or animation is rendered, it appears as seen from the camera. Blender has different views like top (plan), front (elevation), the side (profile), perspective, and camera. You can access these by hitting the Numpad keys 7,1, 3, 5, and 0 respectively. You may also obtain views from the opposite direction of the above views by using the Shift key along with the above Numpad keys. You can also change your views by using the Numpad arrow keys. Click and hold your middle mouse button, and rotate your canvas in any direction to view from other angles.

Advertisment

Now you need to place something on the canvas to create anything. Place your 3D cursor at the required position and press the spacebar to get a menu. Here, you see options like Add, File, Edit, Object, and Mesh. Go to the Add menu to add an object. You can add meshes, curves, surfaces, text, etc. Press Numpad-7 for coming to top view. Press the spacebar and go to Add>Surface>Tube. You’ll see a circle on your canvas–this is a tube as seen from the top. The circle will have a yellow-colored rectangle around it. This means the object is in Edit mode as opposed to the Normal mode. To switch between modes use the Key. Press ‘a’ to select the entire object in Edit mode or use the right mouse button. You can perform three basic operations on the object that you’ve placed:

  • Move the object: Select the object and press the ‘g’ key. Now move your mouse and the object will move along with the mouse cursor. Click the left mouse button to place the object. Press Esc before clicking the mouse to undo the

    action.
  • Resize the object: Select the object, press the ‘s’ key and move your mouse to resize the object. This may take a little practice.
  • Rotate the object: Select the object and press the ‘r’ key to rotate it.

We will create a cool hammer now.

Advertisment
  1. Step

    6

    Select the tube you placed and press ‘x’ to delete it. From the menu which appears, choose ‘All’.

  2. Press Numpad-7 for coming to top view. Press the spacebar and go to Add>Surface>Tube.

  3. Press ‘s’ and resize it to make it smaller than the original size.

  4. Press Numpad-3 and come to the side view.

  5. Press the ‘a’ key.

  6. You can see four vertices of the tube in side view(the pink dots). Press the ‘b’ key. Now hold the left mouse-button down and drag the cursor to select the two top vertices of the tube.

  7. Step

    10

    Now press ‘g’ and drag the mouse button to elongate the cylinder. Press the Ctrl key and drag for dragging in a straight line.

  8. Press the ‘a’ key twice to select the entire tube.

  9. Press the ‘g’ key and drag the entire object below (to the center).

  10. Press the spacebar and add another tube. Make it larger by using the ‘s’ key and place it as shown using the ‘g’ key.

  11. Press ‘a’ and press Numpad-1 to come to front view.

  12. Press ‘b’ and select the vertices on one edge of the head of the hammer.

  13. Press ‘g’ and elongate the head.

  14. Similarly, elongate the other end.

  15. Now our hammer is ready. Press Numpad-0 for viewing the hammer through the camera.

  16. You need to get the hammer appear fully inside the camera, that is, inside the inner rectangle in the camera view. Press Numpad-7 to get to top view. Right click on the camera to select it and move it away from or towards the hammer so that the hammer appears inside the camera. (You can zoom out of the canvas by pressing the Numpad ‘-’ key multiple times.)

  17. Step

    14

    Place the camera at some other angle and rotate the camera so that you can obtain an angle view of the hammer.

  18. Press Numpad-0 to see the hammer through the camera. It should appear like this.

  19. Press ‘z’ for a preview of the hammer before rendering.

  20. The hammer is hollow, so we need to make it solid. To do that, press till you enter Edit mode (you should be able to see the vertices as pink dots). Select the vertices on the right side using the ‘b’ key. Press Shift+D to duplicate the selected vertices and press Enter. Press ‘Numpad-3’ for profile view and press ‘s’ to resize the duplicate vertices. Resize to a very minute size (see the yellow dot in the center) as shown.

  21. Press Numpad-1 to go to front view. Using the ‘b’ key select all the vertices on the right side of the hammer head. To create a face press the ‘f’ key.

  22. Step

    15

    Press Numpad-0 and ‘z’ for a preview of the hammer.

  23. Press F12 to render the image. A black blank window should appear. You won’t be able to see the hammer because you haven’t added any lights to the scene.

  24. Press Numpad-7, press Spacebar and Add Lamp. Make sure that the lamp and camera are on the same side of the object.

  25. Press F4 to invoke the Lamp menu in the lower section of the Blender window.

  26. Choose Spotlight from the Lamp type menu. You should see a dotted circle around the lamp.

  27. Press Numpad-3 to see the lamp. Select, Move, Rotate and scale the Lamp such that the light beam falls on the hammer in all the three views. The light beam should cover the object in all three views.

  28. Step

    18

    Now press F12 to render the image.

  29. The rendered image may not be clear. Increase the energy of the light by dragging on the energy bar in the Lamp menu.

  30. Now press F12 to see something like the accompanying figure.

  31. Press F2 to save the Blender file. Blender saves the image in .blend format. These files are amazingly small in size, and even huge animations occupy a few 100 kB.

  32. For saving the rendered image, press F10. From the image options, click on the JPEG button in the lower panel. Press F3, type in the image name and press Enter twice to save the

    image.

  33. Step

    20

    You can change the size of the rendered image by clicking and dragging on the Size X and Size Y buttons in the same panel. Try these out (change it to 640x480).

  34. Now let us add some color to the hammer.

  35. Press Numpad-1 and zoom in closer to the image.

  36. Choose the handle of the image by pressing ‘b; and selecting the handle only.

  37. Press F5 to activate the Material options.

  38. Click on the button with a white dash on it to define a new material. Select “Add New”.

  39. Step

    30

    From the new menu on the bottom panel, vary the values of Red, Green and Blue to change the color of the material. Try to give it a brown color. You will see one more RGB combination tool nearby. Change it to make it black. The default color for this is pink. If you don’t change this to black, you will get a wooden hammer with pink stripes.

  40. Press F6 to activate texture options. Add a new texture by clicking on the same button with a white dash that you clicked to define a new material.

  41. Choose wooden texture, by clicking on the Wood button.

  42. Now render the image by pressing F12 and you should get something like what’s in the accompanying figure. You can add a few more lights to make the hammer more visible.

Animation in Blender

We use frames to do animation in Blender. Each frame has the image of the object in a new position, and these can be played in sequence at a certain speed to get the animation effect. Animation of an object involves shifting the object’s position, rotating it, or changing its size or a combination of the three possibilities. We will have to insert the respective keys for each of these actions in the frames.In Blender, you just have to specify the initial and final positions of the object, and it will

automatically generate the intermediate steps. Before the animation, you will have to decide upon the number of frames, and the frame rate (a default frame rate of 25 fps is good enough). Now let’s animate the hammer.

Advertisment
  1. Press Esc to come back to the Blender window with the hammer in it. Press till you come to Normal mode, that is, when the whole hammer is pink in color and you can’t see the vertices.

  2. Press Shift+Left arrow key to come to the first frame. The frame number is displayed in the lower section of the Blender window.

  3. Select the hammer by right-clicking on it.

  4. Press ‘i’ to insert an animation key. From the menu that appears select ‘Rot’ to insert a rotation key. (You can choose ‘Loc’ to change location in animation or choose ‘Size’ to change size. For the time being we will just choose

    rotation.)

  5. We will use 100 frames in our animation. Thus, the final position of the hammer will be in the 100th frame. We will insert an intermediate position in the 50th frame. To go to the 50th frame, press the right arrow key 50 times. The frame number is shown in the same box in the lower section of the Blender window. A simpler way to reach the 50th frame is to click on the box while holding the Shift key down, and manually entering ‘50’ in it.

  6. Step

    6

    In this frame, position the hammer as shown in the figure by rotating it (use the ‘r’ key).

  7. Press ‘i’ to insert another rotation key in this frame and select ‘Rot’ from the menu that appears.

  8. Now we can go to the final frame, where the hammer’s final position is shown. For this press right arrow key 50 (more) times, or enter 100 in the frame number display box.

  9. Rotate the hammer back to its initial position. Insert a rotation key, by pressing ‘i’ and selecting ‘Rot’ from the menu.

  10. Your animation is now ready. Go back to the first frame using Shift+Left aRROW keys. Press Alt+a to see the animated (but not rendered) sequence. Press Esc to stop the animation at any point.

  11. To render the animated sequence, you have to choose the total number of frames in the Display Buttons window. Press F10 and set the `End’ field to 100 ( default value is 250 frames).

  12. The animation can be stored in various formats, including AVI raw, AVI jpg, individual JPEG and Targa images. We will render the image as AVI raw.

    Select AVI raw from the menu on the bottom  right corner.

  13. To render the image click on the Anim button. All the frames of the sequence will be rendered, and the AVI movie will by default be stored in the directory ‘/render’. You can change this by typing in the new folder in the space where ‘/render’ appears on the interface. You can also choose a background image by clicking the ‘Backbuf’ button and entering the JPEG image path. For the time being, we won’t enter a background image.

  14. To playback the generated AVI movie, click on the Play button below the Anim button.

  15. To Save your Blender animation (not the AVI file), press Esc to come back to the main Blender window. Press F2 and give a name in the window that appears to save the animation as a BLEND file. That’s it, you now have an AVI movie and can watch it using any AVI player like xanim or

    aktion.

Since the AVI movie is large in size, you could create an MPEG of your animation. The BLEND file created on saving with F2 is very small in size, around 37 kB for our animation, compared to the size of the AVI movie which is about 23 MB. So, if you want to share your animation, you can pass on the BLEND file to anyone having Blender, who could load the file using the F1 key and animate it.

We have explored a very small fraction of the features in Blender, which has many more visual and animation effects that you can explore by reading the various tutorials and samples available at the websites given above. Blender also has a 3D game rendering engine that helps you create wonderful games. Some games are available for download at the Blender sites. All in all, Blender is a wholesome 3D rendering tool for Linux users and you can create wonders with it. You’ll find the above example, called ‘pcqhammer.blend’ in the PCQuest CD, so do try it out. Also try out the sample blend files we’ve provided on the CD. Happy Blending.

Mahendra M  and Kartik N

are final-year students of RV College of Engineering, Bangalore

Advertisment