Classic Computer Magazine Archive START VOL. 5 NO. 1 / AUGUST 1990

ON DISK

Cyber Corner


METAMORPHOSIS

Tween The Easy Way

ARTICLE BY DAVE STUART
PROGRAM BY MARK KIMBALL



AT A GLANCE
Program:
Type:
Requirements:


Arcfile:
Files:



language:
Metamorph
CAD-3D desk accessory
CAD-3D version 2.0
Cyber Smash, 1 MB, high or
medium rez
MORPH.PRG
ANIMATE3.PRG
CADDEFS.H
FATAL.S
META.ACC
C and assembler






META.BAT
META.C
VROLAK.SEQ


Known as Metamorph, META.ACC is a metamorphic animator, which allows you to change the shape of an object during the animation. It's strength is that it works visually instead of by coordinates. Smooth deformations like stretching, scaling or bending the object, heretofore difficult, are easily achieved. Specify a starting and ending picture and Metamorph generates the frames in between, a process known as tweening.

An example of this is on disk, in a file named VROLAK.SEQ. VROLAK depicts a flying bat. Metamorph was used to tween the frames of the flapping wings since flapping is a process of smooth deformation--the number of faces and vertices of the wings remains the same, but their positions change.

This article discusses tweening, using VROLAK as an example. (For specific instructions on how to use Metamorph, read the sidebar "1-2-3 Tween.") To view VROLAK.SEQ double-click on the archive file MORPH.PRG. and choose Extract when the dialog box appears. Select a destination disk and the files will be un-ARCed directly onto that disk. In low or medium resolution double-click on ANIMATE3.PRG then select VROLAK.SEQ. ANIMATE3.PRG will run on a 512K machine; [Spacebar] pauses the animation, [Return] restarts it and [Undo] exits ANIMATE3.


VROLIK's Origins

Since Metamorph runs under CAD-3D version 2.0, this article assumes a working knowledge of that program, as well as familiarity with Antic Software's Cyber line.

The core of the VROLAK animation was created by Lee Seiler using NeoChrome, then mapping the 2D image onto a flat plane in Cyber Texture. Liking the artwork, I decided to animate it using the little known META.ACC.

Using Cyber Sculpt's Rotate function I made a set of four .3D2 pictures with the wings in various phases of flapping. Viewed in sequence the pictures showed one downsweep (or upsweep) of the wings. These were my key frames, named B1.3D2, B2.3D2, B3.3D2 and B4.3D2.

At this point I could have viewed the frames in Cyber Paint, creating a rudimentary animation by flipping between them. The action would be very jerky, however, due to the large displacements necessary to move the wings through one downsweep in so few frames. But the effort required to use Cyber Sculpt to create 30 frames depicting the downsweep would be enormous and tedious. This is where Metamorph came in. It easily created the between frames, resulting in a smooth animation with much less effort on my part.


Enter Metamorph

The next step was to create a Metamorph script file (see " 1-2-3 Tween") I wanted the resulting animation to show one complete cycle of flapping wings--down then up. The number of frames used for tweening determined how fast the wings flapped; the fewer the frames, the faster the flap. After trial and error I settled on 30 frames.

Here is the control file:

    load b1.3d2
    load b2.3d2
    5 frames
    begin a:\bird
    doit
    load b2.3d2
    load b3.3d2
    5 frames
    doit
    load b3.3d2
    load b4.3d2
    5 frames
    doit
    load b4.3d2
    load b3.3d2
    5 frames
    doit
    load b3.3d2
    load b2.3d2
    5 frames
    doit
    load b2.3d2
    load b1.3d2
    5 frames
    doit
    stop

I saved this file as BIRD.CTL.


metmorphosis1.jpg
metmorphosis2.jpg

VROLAK owes its smooth flying to Metamorph's tweening.



CAD-3D and Metamorph

In Concert I started up CAD-3D version 2.0, with the Metamorph and Cyber Smash desk accessories installed, then loaded B1.3D2. This initialized the palette and allowed me to choose settings necessary to the finished animation. I double-clicked on SuperView and set the rendering to solid and final. Returning to the main workspace, I activated the Metamorph accessory.

A file selector appeared; I chose BIRD.CTL. Metamorph did the rest, taking about 30 minutes to create the 30 frames I wanted. (You can tell when Metamorph is working because the file box will remain in center screen.) When the box disappeared, the object from file B1.3D2 was still in the camera window, since it was the last key frame accessed by Metamorph.

Checking the directory I found two new files, BIRD.DLT and BIRD.PI1. If this was done in high resolution, I would have found a BIRD.PI3 file. These two files were needed for the animation. What had happened is that Metamorph generated the frames between the key frames, then sent them to CAD-3D, which created the delta and picture files.


Flying High

As far as Metamorph goes, its job was done. Running VROLAK.SEQ, however, you'll notice that the bat's wings flap three times and it flies towards you. The subsequent flaps were done using Cyber Paint's splice button, and the increasing bat size was achieved using its APM special effects.

I hope this example has given you some ideas on how to animate your own CAD-3D images.

Dave Stuart is a veteran computer animator and an Antic Software author. He lives in southern Oregon


 1-2-3 TWEEN       BY MARK KIMBALL

The Metamorph desk accessory works under CAD-3D version 2.0, which, in turn, requires at least 1MB of memory and runs in high or medium resolution. The Cyber Smash desk accessory also should be installed.

To install META.ACC, double-click on the archive file MORPH.PRG. and choose Extract when the dialog box appears. Select a destination disk and the files will be un-ARCed directly onto that disk. Copy META.ACC to the root folder of your boot disk. The next time your computer boots, the accessory will be installed.

When you're in CAD-3D and ready to use Metamorph (see "Metamorphosis" for an explanation of how Metamorph and CAD-3D interact), left-click on the Metamorph option under the Desk menu. Select the desired script file, which is simply a list of Metamorph commands.


Script Language

Scripts are ASCII files that can be created by a word processor before entering CAD-3D, or by using the Flash Capture buffer, or by using the script function in Cyber Control. Any filename is valid; the default extension is .CTL.

The script language consists of five commands. Metamorph is case sensitive about commands, so be sure they are in lower case.

1) begin path\filename: Filename is the name of the Metamorph output files, a .DLT and .PIx file. Tells Metamorph the path and filename of the output files. Don't include an extender; CAD-3D will supply one.

2) doit: Begin tweening.

3) xx frames: The total number (xx) of tweening frames.

4) load filename: Filename is a key-frame .3D2 file. Tells Metamorph to load the specified keyframe file. Include the file's .3D2 extension. Filenames are not case sensitive.

5) stop: End of script.

Here is an example:

load bird0.3d2
load bird1.3d2
load bird2.3d2
40 frames
begin b:\fly
doit
stop

Metamorph divides the frames between each set of key frames. This file creates an animation with 20 frames between each key frame. Alternately, the script could read:

load bird0.3d2
load bird1.3d2
20 frames
begin b:\fly
doit
load bird1.3d2
load bird2.3d2
20 frames
doit
stop

The first script is faster; however, distortions sometimes appear when tweens are performed in sequence. These blemishes can be edited out using Cyber Paint, but you can avoid them altogether by using the more detailed script file.


Caveats

Metamorph needs 200K of RAM for itself, above and beyond the memory reserved by CAD-3D.

Metamorph has a limit of nine key frames, each no larger than 10K. Each key frame can contain multiple objects, up to CAD-3D's limit.

Aborting Metamorph requires you to hold down the spacebar until a dialog box appears asking if you wish to abort. A single keypress won't work due to CAD-3D's keyboard handler.

Set CAD-3D options- camera, light, zoom, rendering--before using Metamorph. Also, only camera1 is implemented.

Metamorph uploads the object-color and color-group information for the first object in the list. So if you start CAD-3D and then Metamorph, you most likely will see a wireframe animation. Exit Metamorph and change the camera, zoom, and light settings to what you want.


Frame Changes

Objects must be consistent from key to key; you can't get an animation showing the transformation of a cube into a sphere. Each object in successive key frames must have the same number of faces and vertices, and the face assignments must be the same. Some Cyber Sculpt operations can change the face assignments so be cautious when distorting objects.

The interpolation algorithm used for Metamorph forces the animation to pass exactly through the key frames. This is handy for predicting how it will turn out, but the algorithm possibly can produce ringing or overshoot if the key-to-key differences are extreme. Usually such extreme changes aren't very realistic anyway;-how many objects execute an abrupt right-angle turn?

Metamorph works best on animations that transform similar objects. For example, Metamorph can demonstrate how a tennis ball is flattened when it hits a wall. Or, use Metamorph to expand a two-dimensional automobile like a sponge, giving it width as well as length and height.

Mark Kimball is an electrical engineer who lives near Portland, Ore. This is his first program for START.