Animated Robot Arm

Project 4: Animator

Assigned: Tuesday, 16 November 1999
Due: Tuesday, 30 November 1999
Artifact: Tuesday, 7 December 1999


Project Objectives

This project is designed to introduce you to splines and how they are used for animation. There are two parts to this assignment. The first is to complete a keyframe animation system which is based on the project 2 modeler code. This system lets you assign a time-varying curve to the variables of your model that were controlled with sliders. The system currently only supports piecewise linear curves; your job is to extend it with several types of splines.

The second part, due shortly after the implementation is due, is to use your system to produce an animation based on the character you developed in project 2.

Using models with animator

The skeleton code contains all the files that are needed for you to get started, minus all the spline implementation. The sample solution contains the extended modeler DLL with all the required curve types implemented, so you can see how they behave.

To use your model from project 2, you do not need to change your modeler files. But, to guarantee compatibility with animator files, you will need to recompile your models to link them against the new modeler, but no source changes should be required (unless your models are doing something exotic).

Note that in addition to modeler.tcl there is a new file curve.tcl. It is loaded by the modeler, and must be in the same directory as the modeler DLL.

There is a new control mode called curve mode. This works just like control mode, but does not create sliders. Use this type if you want to animate a variable but don't want to clutter up the control panel with a slider for it. The arguments are the same as for scale, omitting the res argument.

Animator interface

When you first load a model, the UI will like just like it did in project 2. To create an animation, select Edit > Curve mode. This will replace your controls panel with something that looks like this (without the white curve):

The x axis represents time; 20 seconds by default but this can be changed via the animation time parameter box below curve editor. Every slider or curve control now appears in the animation variables pop-up menu. You can display the pop-up menu by right-clicking the curve editor. You can turn the display of individual curves on and off using this menu. You can display as many curve as you want on the curve editor. To select a curve, you should click the curve with your middle mouse button. When a curve is selected, its control points are drawn with circles and can be edited. Create a new control point by clicking on the background. Control points can be dragged around by clicking them. They also can be deleted by pressing CTRL button + left-clicking them.

By default, a curve will always has two control points. It means that a curve when it is displayed for the first time, it will always be a piecewise-linear curve, regardless of what curve type is selected in Curve-type menu.

Holding a SHIFT button while clicking the middle mouse button in the curve editor will drag the time line, a red vertical line, around. This can be used to see how your model behaves in a particular time period. In adddition, you can zoom in/out your curve to get a finer curve. You can do this by pressing SHIFT button and select a region that you want to zoom in. Undo Zoom button is provided to undo the zoom. The curve settings menu changes how the control points are interpreted. Use this menu to change the type of spline used for a particular curve. The skeleton code has only the type linear; your job is to implement Bézier curves, B-splines, C2-interpolating splines, and Catmull-Rom splines. Other curve types may be added for extra credit.

Each curve type must support a wrapping flag, indicating whether the curve should continuously wrap around from the end of the animation back to the beginning. For wraping around Bézier curve, please click here.

Animations can be saved and reloaded. If you change the model, when you load an animation the system will match curves to saved values in the file based on the name of the control. Any name in the file that no longer exists in the model will be discarded, and any named control in the model with no corresponding curve in the file will be initialized to have zero control points.

Adding curve types

For each curve type, you must write a new class, which is derived from CurveEvaluator. Inside the class, you should implement evaluateCurve function. This function takes the following parameters: control_points--a collection of control points that you specify in the curve editor, evaluated_curve_points--a collection of points that you output from the function after being calculated using curve's formulas, animation_time--the maximum time that a curve has, and wrap_control_points--for wrapping the curve. To add the new curve type that you just create into the Curve Type, you should see the code in CurveEditor.

For Bezier curves (and the splines based on them), it is sufficient to sample the curve at fixed intervals of time. The recursive subdivision algorithm presented in class may be implemented for an extra bell.

C2-interpolating splines have an extra two degrees of freedom that are unspecified by the control points. You should implement what will be referred to in class as "natural" C2-interpolating splines, that is, let the derivatives at the two endpoints be equal to zero. There are other valid ways to handle this, see the bells and whistles section.

You do not have to sort the points that you get from using the curves' formulas. The code has done this for you. Note that for interpolating curves (Catmull-Rom or C2-Interpolating splines), the fact that the control points are given to you sorted by x does not ensure that the curve itself will also monotonically increase in x. You should recognize and handle this case appropriately.

Animation Artifact

You will eventually use the curve editor to produce an animated artifact for this project. Each person must turn in their own artifact. We may give extra credit to those that are exceptionally clever or aesthetically pleasing. Try to use the ideas discussed in the John Lasseter article distributed in class. These include anticipation, follow-through, squash and stretch, and secondary motion.

Bells and Whistles

Many of these extra credit options require changing the user interface, which is written in Tcl/Tk. For information on Tcl/Tk, including links to tutorials and reference documentation, visit the Tcl resource page at Scriptics.

[bell] Use a recursive subdivision algorithm to produce Bézier curves, rather than just sampling them at some arbitrary interval. For an extra whistle, let the user control the flatness parameter. The number of points generated for each curve is displayed at the bottom right, so you can see how well your adaptive algorithm is working.


[whistle] Enhance the requred spline options. Some of these will require alterations to the user interface. Some suggestions:


[bell] Implement a "general" subdivision curve, so the user can specify an arbitrary averaging mask.


[bell+whistle] If you find something you don't like about the interface, or something you think you could do better, change it! Any really good changes will be incorporated into Animator 2.0.