animated and paint with project Dogwaffle

Amapi Keyframe Animation for Flash Animation

by Philip Staiger, July 1999 - using Amapi 4.1.5

Here's an easy set of steps which show how you can use Amapi to create a keyframe based animation in which to morph (transform) a shape into another shape. Each shape even between keyframes can then be saved in its own DXF file, for example so as to use it with Vecta3D's conversion capability to generate vectors for Macromedia Flash.  Another way to achieve this would be to do a final render in Amapi, e.g. into an AVI file, and extract the frames to perform edge detection on them (e.g. Photoshop or Illustrator combo). In order to get decent results, Amapi's clean cartoon style in the hybrid renderer can be used.

Let's start... in this very simple example we'll just use a sphere. Get your front view (2) and select the sphere from the construction toolkit.
Create a sphere
Keep you left hand on those arrow keys to easily navigate around your 3D model, it will help you in getting a sense for what you're doing.

 I recommend using the natural design interface, also known as the Workshop interface. It's much more fun and performing. Use the basic wireframe display type in Workspace settings (Edit>Preferences>Workspace)

Freeze the first Keyframe
Swipe the cursor (magic Wand) to the right edge until you see the Modeling toolkit (with the Mold, Bend and Stretch tools). But we're not ready to start changing the sphere quite yet - first we need to save this current shape as keyframe zero.
If the yellow assistant palette is enabled select the 'Render' toolkit in the upper right corner. Or simply hit the SPACEBAR to toggle to that same alternate toolkit. Select the icon in the middle which looks like a keyframe action taker from the movie industry (silence - camera - action!). Since this is the first keyframe for this object, it automatically gets inserted into keyframe number zero. But you could also drag-and-drop the object (sphere) into a different placeholder of the keyframe sequencer.

Swipe the tool away when done. Then return to the Modeling toolkit (hit the SPACEBAR for example). We'll now start changing the shape for the next keyframe.


Change the Shape with the Mold Tool to make a second keyframe shape
Select the Mold tool from the modeling toolkit. In the upper-right corner, select the 'circular mode' (sphere of influence) (or hit CONTROL-SPACEBAR). 

Use the arrow keys to select your view, e.g. from the front.

Select the desired radius for the circle, using the plus/minus keys.

Click and drag a few points of the sphere object and release.
Repeat for a few other vertices of the sphere to change the shape. Then swipe the tool away.


Save the new Shape as the second keyframe, Keyframe #5
Return to the Render/Animation toolkit (hit the SPACEBAR or select the Render toolkit in the upper right corner of the yellow assistant palette.

Select the keyframer again. The previously entered keyframe (#0) is still there. You can now drag and drop the new shape into the desired keyframe, e.g. #5 or any thereafter.

Then swipe the tool away. You can now preview the animation by clicking the double-eyed icon just above the keyframer icon. You can even use the arrow keys during this preview to inspect what's happening from various angles.

Create yet another shape and save it as the third keyframe (#10)
You can now easily repeat the steps with the Molding tool to change the shape one more time. Use the circle of influence again or try the other tools (stretch, mold with +/- keys to increase or decrease sensitivity and scope of molding, or use the MetaNURBS tool with the Nurbs cage. The Weld tool is great for some things too.

Then return to the animation toolkit and save the new shape as keyframe 10. (your third keyframe)


Repeat an existing keyframe shape - close the loop
If you want to create an animation sequence in which the last frame is closing on to the first frame, you can easily do just that by copying the first frame back to the last. 

Enter the keyframer, and you'll see the current 3 keyframes which you have defined (even potentially with some gaps in between, i.e. not all numbered spaces have to be occupied, there may be gaps).

Click the first frame and drag-and-drop it into the scene. You'll see the sphere take on the shape from keyframe #0 (the first keyframe).

Then Drag-and-drop the sphere from the scene back into an open slot in the keyframer, such as the next available one #15, which becomes a new keyframe. It is identical in shape as #0. You now have an animation sequence with 16 frames (0 through 15)  which is ready for previewing.


Preview the animation
You can preview the animation by clicking the two eyes in the middle of the animation/render toolkit.  During the preview, hit ESCAPE to exit, or use the viewing controls (arrow keys) to see it from various angles.

If you have a floating view inset (menu: View/NewView/FreeView) you will see the sequence there too, optionally in shaded or wireshade modes, even from a different camera's vantage point if one is defined..


Saving each frame as a DXF File for Vecta3D / Macromedia Flash
If you're into 'flashy' things, you are possibly a webmaster wanting to create 3D content for animations in Macromedia Flash. There's a product coming out soon  called Vecta3D, which can accept a number of DXF files and convert each into a frame for a flash animation sequence. I'll show here how to save each frame from our morphing sequence into its own DXF file. 

Start by selecting the keyframer,. At the left edge of the keyframer, you'll see a counter with a current frame number and two arrows (left/right, e.g. increase/decrease controls).

You simply enter the desired frame number (e.g. 0) and quit the keyframer. The object is now shaped according to the first frame. You then saVe the current shape in its own DXF file.

From the File menu, select 'Save As...' or 'Export'. If using SaveAs, specify the format. Enter the desired filename according to the frame number (e.g. 0.dxf), in fact you can leave it up to Amapi to add the file extension (.dxf), so only enter the number (0).

When you entered the name, Amapi asks if you want it to be saved as polymesh or not. Select your preference.

Also, be advised that in the menu called Edit>Preferences>IOSettings, you can configure certain parameters for exporting to each format, including DXF, such as IOClean or IO Smooth objects, and whether X/Y/Z axes should remain X/Y/Z or otherwise swapped or inverted.

After you have saved this first frame in a file '0.dxf', return to the keyframer, select the next value for the keyframe counter, which will change the shape of the object as indicated by the two surrounding keyframes.

It would of course be nice if Amapi had a feature to save each frame in its own filename (with count number in filename) automatically, sort of in a batch process. That may come in the future, but in the meantime be sure to understand that you can further speedup this process by assigning shortcuts with the Shortcuts editor to certain keys. That way a function like SaveAs can be obtained without the need for placing and clicking the mouse on the menu (in fact that particular one is assigned to CTRL-E by the MFC window standard).

You now have a bunch of files in DXF format, each containing a different shape from the entire aanimation sequence.

If you want a more automated approach, here's what to try next:

  1. Amapi has a raytracer with hybrid rendering capability: it supports ActiveStyles rendering (from TGS) and can do cartoons and draft technosketh styles and others. With that, you can get a nice hidden-line drawn cartoon look with fill color the same as background color (e,g, black) while the color and thickness of the edges is controllable too.
  2. One of the styles includes 'Fat Edges' with a random number generator, it makes it look like a Dr.Katz effect (nervous widdles).
  3. Either way, if you also add multi-pass anti-aliasing in the Render Settings menu, you'll get a great single frame rendering, or if you render the whole animation into a AVI or Quicktime movie, you can then use other tools and toys to extract each frame from the animation.
  4. Once you have each frame in its file (rendered pixels now, no longer DXF polygons or lines). then you can pass these frames through a sequence of operations as simple as edge detection and conversion to polylines (various programs do that, such as Photoshop and/or Illustrator I think), and then you're ready again with a bunch of Illustrator files or whatever format for Vecta3D.or other Fasl authoring tools.
Here's an example of doing this cartoon style rendering:
Selecting a Cartoon Style and Rendering with AntiAliasing
First, select the part (in this case there's still just one), then select Render/Shader or the shader in the lower-right corner of the bottom control panel, or use the shortcut key assigned to the Render controls if you have one assigned.

Select the Active Style materials collection or Create a new Style, and select Clean Cartoon, for example. Try various colors and also fill colors and edge widths.

Select the Render>Settings options and apply anti-aliasing.

Then hit ENTER to do a test render onscreen.

If the rendering is good and shows good edges which will easily be detected in your imaging  tool for edge detection, render this to an image file Render>RenderFile (Targa is default).

Repeat the rendering for each shape in the animation sequence. The render to file command should easily be assigned to a keyboard shortcut to speed this up.

If you Render the whole sequence into an AVI movie instead, then be sure to use no compression codec, or one which will allow your imaging software to extract the frames. Then again can you pasas those individual images through the edge detection process. Voila!


Selecting Cartoon Styles...


Selecting Anti-Aliasing