Animations/ Path Animations

Path Animations

In the Getting Started tutorial, you animated a sphere that moved roughly in a circle—this demonstrated how to create a choreography based on keying an object's position at various times. As you may have noticed, to refine the movement to be circular, you had to make adjustments to the animation curves in the choreography editor. Although this method is fine for certain types of movement, Realsoft 3D provides other options. One of these options is to animate an object along a path, hence the term, path animation.

This tutorial explores some of the ways you can create path animations, which includes attaching an object to a two dimensional object such as a line or a three dimensional object such as a surface.

 

Object on a closed path

Tutorial level: Medium

Example project: 'tutorprojects\animation\paths\moving sphere'

Remember the animation of a sphere traveling in a circle you created in the Getting Started with Animation tutorial? Now let's do that same animation using a path.

First, set up your environment. Then create an analytic sphere in the upper left corner of the view, followed by a NURBS circle centered approximately at the view's midpoint with a diameter of about 3/4 of the view's size.

Select the sphere and then the circular curve (the order is important), and then choose 'Tools/Lattice Mapping/Create Path Animation' from the main menu (or, if you are using the startup environment, open the 'Lattice Mapping' tab, and click the 'Path' button. This presents a control bar with the path tool's options.

Note: It is important that you select the objects in the specified order. If you select the objects in reversed order, you would get a curve moving along the surface of the sphere.


Options for the Path tool

For this first attempt, use the default settings, so just click 'Accept'. Now play the animation and note what is occurring. First, the sphere follows a circular path based on its initial position and its offset from the path curve. Second, the sphere rotates about the centerpoint of the circle as if there were an invisible rod connecting the center of the circle to the center of the sphere. To contrast this rotation, double click the sphere object to open the property window, go to the 'Map' tab and uncheck the 'Rotation' attribute, then replay the animation.

 

Object on an open path

Tutorial level: Medium

Tutorial project: 'tutorprojects\animation\path\morphing path'

Making an object follow a path defined by an open curve is essentially the same as using a closed curve. Once again, the initial positions of the two objects, in relation to each other, determines the actual movement (that is, if you are using the Translate option).

Set up a sphere and a curve as shown below, and use 'Lattice Mapping/Path' with the default options, and then play the animation.


A sphere and an open NURBS curve as the path.

Be sure the time slider is at the first frame, and now try moving the sphere around within the view. As you move it, watch carefully: it seems to be affected by the path it is attached to, which is correct, at least in terms of rotation. Set the sphere's position at a point near the middle of the view, and press the Play button. The sphere jumps back to its originally defined starting position.

Now edit the NURBS curve, maybe straightening out the dip near the middle, and then play the animation. Try just moving points first, then edit the curve by also removing points. Next, add some new points to the curve, and reshape it again. Note that when you make these changes, the sphere speeds up and slows down as it traverses the path. This is based on the spacing of the curve points: the greater the distance between points, the faster the object moves along that line segment. No matter what type of editing you perform on the line, the object remains correctly attached to the path.

However, try moving the location of the sphere's translation handle above the sphere and play the animation. The change occurs because the sphere's translation handle (pivot point) is the object actually attached to the path curve. Undo this change to the pivot point before continuing.

Now try editing the path curve while in animation recording mode. Select the curve and enter Edit mode. Set the time slider to frame 0 and activate animation recording. Move to frame 30 and point edit the curve. Move to frame 60 and adjust the curve some more. Continue editing the curve at frame 90, then deactivate animation recording. You now have a sphere that moves along a morphing path.

 

Unattaching an object from a path

As you may guess at this point there are quite a number of ways, based on the relative position between the object and the path, that you can set up a path animation. So what if you attach an object to a path, and you do not like the result? You can easily unattach an object from a path with the Unmap tool.

Select the object and then the path. Then, from the 'Lattice Mapping' tab, click the 'Unmap' button. The object and the path are no longer attached. You can now modify the positions of either object and connect the two again.

Note: you can also access the Unmap function from the main menu, 'Tools/Lattice Mapping/Unmap Objects'.

 

A swimming fish

This example demonstrates how to create swimming fishes, wriggling snakes and other effects where the motion path should not only transform the object to be animated but also deform it.
 
1. Create a fish by using NURBS or subdivision tools. The only requirement for the fish is that it contains a sufficient number of points so that the curve can deform it.

2. Create a NURBS curve representing the path.


A freeform fish and a NURBS curve
 

3. Select the 'fish' and the 'path' (in this order). Then click the Path tool. This time set the 'Target' option to 'Points' and click 'Accept'.

Select 'Target' = 'Points'

Play the animation and the fish wriggles along the path. Keep this project open for use in the next section.

 

Reconnecting an object to a different path

Tutorial level: Medium

Tutorial project: 'tutorprojects\animation\path\swimmingfish'

The Lattice Mapping/Reconnect tool allows you to exchange one path for another.

Using the swimming fish project from the previous section, add a skeleton object to use as the path for the swimming fish. Select the fish and then the skeleton, and then activate the Reconnect tool. Click Accept and the fish jumps to the skeleton. Move the time slider and the fish moves along the skeleton.

The fish moving along a skeleton

Example project: 'tutorprojects/animation/paths/fish on a skeleton'

 

Mapping specific points to a path

Tutorial level: Medium

Tutorial project: 'tutorprojects\animation\path\ik_path'

So far we have dealt with mapping entire objects to paths, but what if you only want a part of an object to move along a path, for instance, the end joint of an arm. For this you set the Path tool to use the 'Selected Points' value for the 'Target' option.

For example, you can use a NURBS curve to control the path of a joint of a skeleton:

1. Create a skeleton and a NURBS curve defining a path for a joint of the skeleton.

2. Multi select the skeleton and the path (in this order) and enter the Edit mode. Now, select the end point of the skeleton by clicking it.

3. Activate the Path tool and set 'Target' to 'Selected Points'. Click Accept.

The last joint of a skeleton attached to a NURBS curve using the path tool and the 'Selected Points' option

You have now attached the joint to the path. Play with the time slider and see how the joint follows the path. Note that the skeleton uses inverse kinematics to follow the path, which is what you might have already expected.

 

Lattice mapping and path animations

Tutorial level: Medium

Tutorial project: 'tutorprojects\animation\path\moving and rotating cube'

So far we have gone through a number of common path animation cases. In order to take full advantage of the extremely powerful path animation system of Realsoft 3D, you need to understand a couple of simple basic ideas behind it.

First, path animations are based on the lattice mapping system.

Second, you can define path animation simply by modifying a lattice mapped object in animation recording mode.

The only difference between path animations and standard key frame animations is that in path animations objects are animated in path object's parameter space rather than in absolute world space. All the tools you have for animating regular geometry are also available for animating lattice mapped objects. This general approach makes the path animation system a very powerful tool.

The path tool is actually just the standard Map tool, which also creates two key frames for animating the position of the object on the curve.  When a mapped object moves along the lattice curve or surface in 3D space, it actually moves along a straight line in 'lattice object space'.

This is actually all the theory you need to know to take full advantage of the path animation system.  Let's go through one example to clarify the theory.

1. First we need a lattice mapped object. So, create an analytic cube and a NURBS curve.


A cube and a NURBS curve representing the motion path for the cube

2. Then, select the cube and the curve (in this order) and use the Lattice Mapping/Map tool to attach the cube to the curve, as usual.


Use the Map tool to attach the cube to the path

Now we have a lattice mapped object. From now on, everything goes as in usual keyframing: set animation recording on and modify the cube to create key frames for it!

As an example, let's create a path animation. In other words, we want the cube to follow the curve. In the last frame, the cube reaches the tail of the curve.

Do this:

3. Activate animation recording, move the time slider to the last frame and then move the cube to the end of the NURBS curve.

Note: when moving objects that are not mapped to any lattice object, the absolute positions of the 'from' and 'to' points defining the amount of translation are irrelevant. For example, you can drag a cube from its upper edge or lower edge and move the mouse to the right 0.1 meters - the result is the same. However, when modifying lattice mapped objects, the absolute position of the mouse is relevant. The reason is that lattice space can be very curved. So, when moving lattice mapped objects, make sure the mouse is positioned close to the actual lattice (path) object to get expected results!


To move object, enter two points on the curve to define a translation along the path

Play the animation to see how the cube moves along the path.

In addition to translation, you can naturally control how the cube rotates in the path objects's space. For example, to make the cube rotate while it moves on the curve:

4. Move the time slider to a suitable frame (say frame 40) and activate the animation recording.

5. Drag a rotate handle of the cube.

Reset animation recording and play the animation. The cube moves and rotates in the parameter space of the curve.
 
 

Timing

In the previous tutorials we have used two key frames to set up path animations. In the first frame the object is at the start of the curve and in the last frame the object is located at the tail of the curve. The intermediate positions are interpolated for us by the animation system.

The speed at which the object travels between the two ends of the path depends on the properties of the path. Depending on the point density and parametrization of the path, the object may accelerate and decelerate while it moves along the path.

You can control the default speed and timing very easily by adding new key frames.

Let's imagine we would like to edit the path animation we created in the previous example so that the cube reaches the end point of the curve in frame 75. Then it should return back where it started.

To do this:

1. Activate animation recording. Move the time slider to frame 75 and move the cube to the end of the curve.

2. Move the time slider to the last frame (frame 150) and move the cube to the beginning of the curve.

If you now play the animation, the cube reaches the end of the curve already in frame 25 and returns back where it started.

You can also control timing by editing the appropriate lattice mapping animation curves directly.

3. Open the choreography window (pull down menu 'Animation/Choreographs..'). Select the 'cube:chor0' choreography and go to the 'Animation Curves' tab.

4. Select the 'Lattice Translate' attribute.


Object accelerates in the beginning and decelerates in the end

5. The curve view shows you now the animation curves which define how the position of the sphere changes. The red curve shows the parameter which defines the position along the path. Add two new points to the beginning and end as shown in the image above.

6. Play the animation. The modified curve now defines a nice and smooth acceleration and deceleration in the beginning and end of the path animation.
 
In addition to controlling timing, you can of course create some key frames to the green and blue curves to temporarily displace the cube from the path.
 

Deformation paths

Let's assume we want to create a 'flying carpet' animation. This can be done by using a NURBS mesh as a path.

Tutorial level: Medium

Tutorial project: 'tutorprojects\animation\paths\mesh path'

1. Create a carpet (say a NURBS mesh consisting of 5 x 5 control points).

2. Create a bigger NURBS mesh consisting of 20 x 5 control points. This mesh represents the path of the carpet. We want the carpet to move on the surface of this mesh.
 


A red 'carpet' mesh on a blue' path' mesh.

3. Select the 'carpet' and 'path' meshes, activate the Path tool, set the 'Target' option to 'Point' and click 'Accept'.

If you now move the time slider, you can see how the carpet moves along the blue mesh.

4. Modify the path mesh so that it contains bumps here and there.

Play the animation to see how the carpet moves along the curved path mesh.


The carpet follows a curved path mesh
 

Note: a NURBS mesh as a camera path allows very good banking control.


Camera following a NURBS stripe
 
Tutorial project: 'tutorprojects\animation\path\camera moving along a NURBS stripe'
 
 

Mapping objects to curved paths

Tutorial level: Medium

Tutorial project: 'tutorprojects\animation\path\map to curved path'

Let's assume we have a very curved surface which we need to use as a  motion path for an object. For example, we need to move a mesh on the surface of a NURBS head.

There are two problems. First, we need to deform the mesh to match the surface of the head at a certain area. If the head is very curved, this is not a trivial job. We could use collision detection or some other tools but if we have a very curved object containing tentacles and holes, matching the mesh on the path mesh can be very time consuming job.

The second problem is that lattice mapping to very curved lattice objects is not always reliable and points can get mapped to wrong lattice coordinates.

The Reconnect tool solves this problem. You can first map the object to a planar mesh to define appropriate lattice coordinates. You can even animate the object on that well behaving planar lattice object. Then, use the Reconnect tool to swap the path object to the final curved surface.

Let's see how this works.

1. Create a NURBS mesh consisting of 12x12 control points and an analytic rectangle on which we will animate the mesh. Then map the NURBS mesh to the rectangle exactly the same way as we mapped the NURBS carpet to the path mesh in the previous example.

If you now play the animation, the mesh moves along the analytic rectangle.

2. Activate animation recording mode. Modify the mesh at suitable frames using move, rotate, etc. tools to creates some key frames.

3. Load in the actual object you want to be used as a motion path (for example, 'models\nurbs\simple head').

4. Select the mesh and the NURBS head and activate the Reconnect tool. Click 'Accept' and the mesh jumps on the surface of the NURBS mesh!


A red mesh moving on the surface of a head

Now that the mesh follows the shape of the NURBS head precisely, you can add some further key frames, fine tune motions, etc. without any problems.  
 

Multiple motion paths

Tutorial level: Medium

Example project: 'tutorprojects\animation\path\multiple paths'

The lattice mapping system allows you to map an object to multiple lattice objects. For example, you can control the head of a mesh using one skeleton and its tail using another skeleton. Similarly, you can animate an object using several paths.

As an example, we will define an animation where the camera position follows a smooth path, but the 'aim point' follows another polygonal path:

1. Create a camera and a smooth NURBS curve representing a motion path for the camera position.

2. This time we don't map the entire camera on the path but its position handle! So, enter the Edit mode and select the position handle of the camera. Multi select the camera and the NURBS path (again in this order).


Map the camera position handle to a NURBS curve

3. Activate the Path tool and set 'Target' to 'Selected Points'. Then click 'Accept'.

We have now mapped one point of the camera object to a motion path.

4. Create a polygonal NURBS curve representing a motion path for the aim point and map the aim point handle to it exactly the same way as you mapped the camera position.

That's all. Play the animation and see how the aim point moves along one path while the position of the camera follows another path.