Blender 3D: Noob to Pro/Basic Animation/Bounce
Applicable Blender version: 2.49. |
How to make a ball bounce convincingly!
[edit | edit source]This tutorial assumes basic Blender awareness and some knowledge of using Blender Lattices as well as keyframes basics regarding the Blender Panels. Knowledge of IPO curves will prove useful later as we progress to more advanced techniques.
How hard can it be to move a ball?
[edit | edit source]It would be easy to just put a sphere on the screen and animate it to move up and down but in all honesty, it would not look like a bouncing ball. It would not be convincing in any way.
To be believable, the ball must use some of the most fundamental principles of good animation. In particular, the ball must squash and stretch and change speed as it falls, hits the floor, bounces and rises ready to fall again. With a little effort we can make that boring sphere look alive!
Why use a lattice?
[edit | edit source]It is possible to make a simple bouncing ball animation without using a Lattice object but with the Lattice we can do more than just bounce the ball. For example, once we have a ball that bounces how we'd like it, we can later add rotation to the ball so it spins through the air and bounces then, as the bounces decrease, the ball can roll to a halt. Doing this without lattice would be a far more complex exercise as a rotating squashed and stretched sphere would look like it was wobbling in space (like having the flat part of a flat tire spin around the tire instead of staying on the bottom, even while the wheel is turning).
Let's begin then
[edit | edit source]To begin, add a UVSphere (SPACE add>mesh>UVShere) in Top View (NUM7). It is important to add the objects in top view to keep their Z-Axis aligned upwards. Set Smooth and Sub-surf on the sphere if desired. Tab back into Object Mode then immediately add a Lattice(SPACE add>Lattice). Resize (SKEY) it so it closely surrounds the sphere. Make the edges of the lattice align with the circumference of the sphere as this will make animation easier.
(By default the Lattice Object Name is "Lattice". It is good to give all your objects unique and sensible names, especially if you are planning a complex scene. So you might call the Sphere "Red_Ball" and the Lattice "Red_Ball_Latt" or something similar for easy reference and recognition later.) (Noob Tip: I have formed the habit of naming everything in ALL CAPS. As the scene gets more complicated I can easily keep track of what I have named and what needs naming.)
Top view of UV-Sphere inside selected Lattice
Make the lattice deform the sphere
[edit | edit source]Prior to Blender 2.4, objects were parented to Lattices with a Lattice Deform option. In version 2.4+ you can select the object (the sphere) and apply a Lattice Modifier to it (Ob: Lattice). However, if you use this new method then the ball will not move where the Lattice moves and will not squash when the Lattice squashes and we want it to do both of these things.
Luckily you can still use the good old Parent option then use the Modifier palette to make the Lattice Deform "Real" . So select the sphere and THEN SHIFT SELECT the Lattice then CTRL-P to make parent and choose the "Lattice Deform" option. If you now select just the sphere, press F9 and look in the Modifiers palette, you'll see a listing for "Lattice parent deform" with a button for "Make Real". You can either ignore this button or press it. It really won't matter for now. If we wanted to do some weird things to our ball, like kicking it or deforming it in other complicated ways, then we would have to use the "real" Lattice modifier option.
So, this may not be the purist approach to using a Lattice but it is a convenient way to achieve the results we're after. Basically, it works and is reasonably intuitive.
Lattice Modifier screen using parenting option.
If you press "Make Real" you enable the full Lattice Modifier
Applicable Blender version: 2.69. |
(None of this seems to be necessary in later versions. The full Lattice screen comes up as soon as you Parent it.)
You can easily check if the Lattice is working the way we want it to by selecting the Lattice and resizing, moving or rotating it. The ball should do everything the Lattice does. I don't wish this to be a full lesson in Lattices so if you don't understand any of the above, or you're certain your Lattice is not working as it should, then please learn a bit about lattices before proceeding.
Time to animate!
[edit | edit source]For our basic animation, we'll use just 23 frames starting with the ball high then falling, squashing, bouncing and ending up back where it started. When this is played back in the 3D window, it will loop and we'll see the ball bounce forever in one place.
This part is easier done in "SCR:1 - Animation" Viewport configuration. It is also useful to have multiple orthographic views open in the viewport by right clicking on the resize viewport arrow and choosing "split area" then making a top view, side, etc...
Go to Front View (Num1) Press F10 and set your start (Sta) frame to Frame 1 and your end frame to Frame 23. Then make sure you're on Frame 1 (Shift+Left Arrow) to start animating. Note that we are animating the Lattice, not the ball. Everything we do to the lattice will directly affect the ball too.
Note: all the modifications to the lattice must be done in 'Object' mode. If not, they will affect all the frames.
Select the Lattice (NOT the ball) then do the following on the corresponding frames:
- FRAME 1: Press IKEY and set a key for LocRotScale - the ball's start position (high).
- FRAME 11: Move the Lattice to ground level and key LocRotScale again (keep the fall distance small for now).
- FRAME 13: Leave Lattice in same position as frame 11 and key LocRotScale again.
- FRAME 23: Move Lattice back to start position (use Num (N) Panel if you need to)and key LocRotScale again.
(Noob note- This may seem obvious, but move the lattice BEFORE you insert the keyframe.)
These four frames give a basic up and down animation with a pause at the bottom. We can add squash on Frame 12 to finish off.
- FRAME 12: Place the cursor at the base of the Lattice then set the Rotation/Scaling Pivot to "3D Cursor" Scale the Lattice down along the Z-Axis SKEY-ZKEY and see the ball squash. IKey LocRotScale again.
When you have set all five keys, you can cycle through the frames and you should see the following result on the Key frames we just set.
Screenshots of the 3D window, front view, on each of our five key frames.
If you press Alt-A now in the 3D window, you should see the ball bounce. Even though the squash happens on just one frame, it still reads properly in our minds and is a vast improvement over an animation with no squash at all. (Press RMB or ESC to stop the animation playback).
If you have a camera and lighting suitably set up you could render the animation out and use Blender's "PLAY" button to loop the rendered animation. See the bottom of the page for an OpenGL render made from the steps above. Add material to the ball and a ground plane for a more interesting result.
Looking at the IPO Curves
[edit | edit source]If you want the ball to bounce three times then you could repeat the above instructions three times over - if you have the patience - but Blender has a better, easier way.
Select the Lattice then open up an IPO (InterPOlation) window and zoom into the group of keys. If you select LocZ and SizeZ from the channel list on the right, you should see something like this (I've added labels to the screenshot):
Note the IPO Type here is "Object". Purists may be disturbed or perplexed by this but if you remember, we're not really using our Lattice in the purist, Lattice Modifier form. Don't worry about it though. It works.
IPO curve for Lattice, showing LocZ and SizeZ channels.
This shows the relative position on the Z-Axis and size in the Z-Axis of the Lattice. You can see that the Size remains constant until frame 11, then reduces, then goes back and remains constant until frame 23. Similarly, the LocZ curve shows how the ball starts high, falls then stops before rising again. The rounded bottom of the LocZ curve occurs because the IPO curve maps the centre point of the Lattice and when we squash it, the centre point lowers slightly.
Of special interest is that by default, Blender uses Bézier curves for IPOs and this gives us rounded tops on the curve. This means the ball starts moving slowly downward then moves faster until the reaches the bottom. Also, as it nears the top, it slows down again. This is good because this is exactly what happens in reality when a ball rises and falls (It could be better - but it's a good start).
While in the IPO window, select both curves then press KKEY and you'll see each key frame indicated by a vertical line. (Note: You can also press View->Show Keys if you can't remember this shortcut - this has helped me in the past.)
IPO window set to show key frames
Press AKEY to select all key frames then duplicate (Shift-D) them. The curves will seem to deform but when you drag the frames to the right, they will sort themselves out. Position them so the "first" frame is at Frame 24 and the new end frame is now Frame 46. Reset the End Frame in the Scene (F10) window then watch the animation again. It's not bad. You can repeat this process for more bounces. (To have it bounce forever throughout a long animation, ignore the above procedure and just set the "Extend Mode" to "Cyclic" in the Curve menu. You'll have to adjust the curve a little on the first and last frame but you only do it once and Blender repeats the change for all other cycles.)
Applicable Blender version: 2.69. |
Noob Note: Instead of IPO window, go to Graph Editor. I was not able to find any way to get yellow lines at each Keyframe, as above, but using A put Bezier handles at each keyframe. I need to experiment to find out how to use them. SHIFT D worked as above.
It's not bad for a start but there's a lot more to do to this ball before applying for that animation job.
Note: In newer versions of Blender, you can go to Graph Editor, Select all graphs with AKEY, and select Channel-Extrapolation Mode-Make Cyclic. This will extrapolate the existing graphs to cover the total frames.
Saving The Animation
[edit | edit source]How do you tell Blender where to save the animated frames? The answer is in the “Output” mini-window that you see in the Render settings (F10). Near the top of this are two editable text fields, the first of which is initially set on my Linux system to “/tmp/” and the second to “//backbuf”. The first one is the output pathname or directory prefix used to save the generated frames as JPEG files when you press the “ANIM” button. If it has no “#” characters in it, then it is used as a directory prefix; thus, the default will be to save the animation frames as /tmp/0001.jpg, /tmp/0002.jpg etc. Alternative, if you put in a filename spec with “#” characters in it, the hashes will be replaced with the frame number. Thus, if I set the field to “/home/ldo/Documents/BlenderTuts/ball####.jpeg”, then the frames will be saved to that /home/ldo/Documents/BlenderTuts directory and be named ball0001.jpeg, ball0002.jpeg etc.
So what next?
[edit | edit source]In real life and in a typical cartoon, balls don't just bounce forever in one spot. They move along and slowly lose their bounce before rolling to a halt. And they have more character than our bouncing ball.
Things to consider next:
- Perfecting the squash - maintaining volume
- Adding stretch
- Look at acceleration and deceleration
- Rotate the ball as it bounces
- Reduce the bounce height over time
- Move the ball around as it bounces
See this ANIMATION LINK (580kb, AVI-DivX) for an idea of how you can achieve interesting results with just a little more effort. but its k? k
Links
[edit | edit source]Principles of bouncing ball animation: http://www.idleworm.com/how/anm/01b/bball.shtml
Blender 2.49B bouncing ball animation: http://www.youtube.com/watch?v=BEY_6dFdUJY
Blender 2.49B vector blur animation, to add realism to your animations: http://www.youtube.com/watch?v=qY4WcNgEXv8