![]()
Project 4: Animator
Assigned: Friday, 19 November 1999
Due: Friday, 3 December 1999
Artifact: Monday, 6 December 1999Help Sessions:
Monday 22 November, 4pm
Tuesday 23 November, 1pm
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 (as well as a few more), so you can see how they behave. The help session document is hereTo 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).
There is a new control type called a curve control. This works just like the scale controls, 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 curves 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 with your left mouse button. Control points can be moved around by dragging them with the mouse. They also can be deleted by pressing the control key whilst 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 the shift key down while dragging the mouse with 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 and out on your curve to get a finer curve. You can do this by pressing the shift key and selecting a region on which you want to zoom in. The 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, 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 wrapping 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.
Adding curve types
For each curve type, you must write a new class 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 evaluated curve points that you return from the function calculated using the curve type's formulas, animation_time (the maximum time that a curve is defined), and wrap_control_points--a boolean flag specifying whether the curve should be wrapped. To add a new curve type, you add a line in the CurveEditor constructor in the same fashion as the addition of the curve evaluator already present (the piecewise linear curve evaluator). 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.You do not have to sort the control points or the evaluated curve points. This has been done for you. Note that for interpolating curves (Catmull-Rom), 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.
Particle System Simulation
You should implement a particle system simulation within the animator. The initial location, velocity and force of the particles should depend on the certain geometric properties of the character (which, in turn, depend on the animation variable curves). For example, we can define the detailed animation of the character and then add an effect of sparks flying off the heal as the character's foot hits the ground. Similarly, as the train moves, the chimney could release particulate smoke. The location and the timing of the sparks depend on the position of the heel. We can calculate the position of the heel (or the top of a chimney) during the animation by multiplying the heel's local position in the object space by the matrix accumulated during the traversal of the model hierarchy. Each particle is specified by its mass, start and end time, position, velocity and the accumulated forces. The forces acting on the particle should include at least the initial creation force (acting on the particle at the start time) and gravity. You should not worry about providing the user interface for the particle system.
With the click of a button, the entire animation is simulated once, at which point the simulation is "baked" and can be played back in a regular fashion. In order to enable playback, you should record the trajectory of each particle during the simulation. You can subsequently change the motion curves of the character, and then re-simulate the particle system. Look at these SIGGRAPH course notes on particle systems for details.
Animation Artifact
You will eventually use the curve editor and the particle system simulator 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. Exciting awards will be given to the best 3 artifacts. At the end of your class exam, you will get the video tape containing all of the class artifacts.
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.
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.
Extend the particle system to handle springs. For example, a pony tail can be simulated with a simple spring system where one spring endpoint is attached to the character's head, while the others are floating in space. In the case of springs, the force acting on the particle is calculated at every step, and it depends on the distance between the two endpoints.
Allow for particles to bounce off the ground floor surface by detecting collisions and computing the collision response.
Enhance the required spline options. Some of these will require alterations to the user interface. Some suggestions:
- Implement higher degree polynomial splines (ones that are C3 or C4 continuous)
- Implement C2-interpolating splines allowing the user to specify the derivatives at the two endpoints
- Implement other types of subdivision curve.
- Let the user control the tension of the Catmull-Rom spline
- Add the ability to display cubic Bezier curves so that the two "inner" control points appear as "handles" on the interpolated "outer" points. (This would appear more intuitive to the user). See PowerPoint curves for an example.
- Add options to the user interface to enforce C0 or C1 coninuity between adjacent Bezier curve segments automatically. (It should also be possible to override this feature in cases where you don't want this type of continuity.)
- Add the ability to add a new control point to any curve type without changing the curve at all.
Implement a "general" subdivision curve, so the user can specify an arbitrary averaging mask.
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.