Tutorial VII Logo

TUTORIAL VII

Multiple Morph Targets


Download Tutorial VII
Click the button to download the tutorial.
Includes the HTML file and all the images.
Download size 88KB.

Multiple Morph Targets

One of the problems that can occur when morphing objects in Imagine is the way the object is "tweened" between each morph target. In the case of Imagine each morph target would be a state. Imagine will tween between two states linearly. Sometimes this may be fine but it can cause extremely strange effects. To demonstrate this try out the following exercise.

TUTORIAL VII - Part A

Showing The Potential Problems With Morphing

Step 1a - Creating the Object to Morph

In the detail editor add a tube by selecting Tube from Primitive New in the Object menu. Type in 10 for the Radius, 94 for the Height, 32 for the Circle Section and 32 for the Vertical Sections. Also ensure that the Stagger Points, Close Bottom and Close Top check boxes are unchecked. In order to align the axes correctly for the deformations we will do later select the object in Object Select mode. Then choose Transformations from the Objects menu. Click on the Rotate check box and type 0, -90, 0 for X, Y, Z then click on the Size check box and type in 32, 32, 32 for X, Y, Z. Finally, ensure the Transform Axes Only check box is checked and click on Perform. The tube should now look like the one in Figure 1 below. Next apply all of the attributes, textures and brush maps you want. NOTE for each texture or brush you apply type in STRAIGHT for the Tacking State. This is so the brush and/or texture is locked to, what is going to be, our first state called STRAIGHT. This means that the texture/brush will deform as the object deforms.

Finally we are going to define the first state. With the object still selected pick Create from States in the States menu. Leave the name as DEFAULT and ensure that only the Shape, Object Props. and Textures/Brushes check boxes are checked. Click on OK. In order to be sure that the states will work correctly we will make an identical state called STRAIGHT so, with the object still highlighted select Clone from States in the States menu. Pick DEFAULT as the Select Source State. Then type in STRAIGHT for the new state name and click on Change followed by Close.

We are now going to create a new state with the tube bent double. Select the tube in object select mode and pick To Cylinder from Conformations in the Functions menu. Type in 30 for the Cylinder Radius and 94 for the object width. The object should now look like the one shown in Figure 2 below. To make a new state, with the object still highlighted select Create from States in the States menu. Type in BENT_OVER for the state name and ensure that only the Shape check box is checked. Lastly select the object and save it as " bendybar.iob".

Straight Object Picture Bent Double Picture
Figure 1
Figure 2

Step 2a - Animating the Morph Object

Go to the Stage Editor and pick New from Project. Set the frame count to 32. Next pick Load in the Object menu and choose "bendybar.iob" as the object to open. Click on OK at the Actor Info dialogue box and when the Object File Info dialogue box is displayed select browse for the State Name and pick STRAIGHT. Next go to the Action Window by selecting Action Dialog in the Editor menu. Find the TUBE object and double click on the blue align bar and type in -180, 90, 0 for X, Y, Z, click on OK. Then double click on the red actor bar and when the Object File Info dialog box is displayed type in 1 for the End Frame. Finally click just to the right of the red actor bar and drag out a new actor bar between frames 2 and 32. Pick "bendybar.iob" as the new object and when the Object File Info dialogue box is displayed select browse for the State Name and pick BENT_OVER. To set up the camera select it and pick Transformations from the Object menu. Click on the Alignment check box and type in 0, 0, -90 for X, Y, Z then click on the Position check box and type in -340, -25, 45 for X, Y, Z. Click on OK. To check that everything has been set up correctly turn go to the first frame by selecting First in the Frame menu and turn on the stage bluing by selecting Bluing from Stage Settings in the View menu. Then go to the last frame by selecting Last in the Frame menu. The Right view look like the one display below in figure 3.

To complete the scene we will add a few lights. So, ensure you are at the first frame by selecting First from the Frame menu. Select Light Source from Add in the Object menu leave every thing as is but change the intensity to 150. Select the light in Object Select Mode and pick Transformations from the Objects menu. Click on the Position check box and type in 0, 0, 400 for X, Y, Z then click on Perform. Repeat this procedure to add another light source but change its position to -200, -200, 300. If there are any other objects you want to include such as a floor can be added now. To render it first save the scene as "badbend.ist". Then select Render from the Project menu and add frames 1 to 32 to the render queue. Set up the rendering parameters as required and generate an AVI (Quick snippet from R.Foster, You can render an AVI and save separate image files at the same time! good for long renders in case there is a crash!). Hopefully, you will end up with an animation looking something like the one in Figure 4, shown below.

Why The Morph Did Not Work

As you will discover the object does not morph as you might expect or at least not how you want it to morph. The is because Imagine achieved the transitions between states using linear interpolation. In other words take a point on the starting state, X, Y, Z and that same point on the ending state, X', Y', Z'. To get from X,Y,Z to X',Y',Z' a straight line is drawn between them in 3D space, this is shown as two black solid line on Figure 5 below. This results in the strange deformations of the object as we really require for the point to follow a curve, as shown by the grey dotted lines.

Blued Stage Showing Morph Targets Badly Bent Animated Gif Linear Interpolation
Figure 3
Figure 4
Figure 5

TUTORIAL VII - Part B

Fixing any Potential Problems With Morphing

Step 1b - Adding More States To The Object to Morph

In order to achieve a smooth morph without significantly distorting the object we will need to add more states, i.e. extra morph targets. What we are actually trying to achieve by adding more morph targets (which will be interpolated linearly) is to allows us to approximate to the required "Morph Curve". So go back to the detail editor and load "bendybar.iob". What we are going to do is add three intermediate states called BEND1, BEND2 and BEND3. Select the object then ensure that we are in state STRAIGHT by selecting Set To from States in the States menu and picking STRAIGHT. Now with the object selected pick To Cylinder from Conform To in the Functions menu. Type in 135 for the Cylinder Radius and 440 for the Object Width. Then select Create from States in the States menu. Call the new state BEND1 and ensure that only the Shape check box is checked. Repeat this procedure with 64 for the Cylinder Radius and 220 for the Object Width to create BEND2. Use 40 for the Cylinder Radius and 150 for the Object Width to create BEND3. The three new states are shown below in figures 6, 7 and 8. Lastly select the object and save it as "bendybar.iob".

Bend 1 Morph Target Bend 2 Morph Target Bend 3 Morph Target
Figure 6
Figure 7
Figure 8

Step 2b - Updating the Stage

To finish go back to the stage editor. Open the Action Dialog window and delete the TUBE red actor bar between frames 2 and 32. Then add the following, new, actor bars to TUBE. Frames 2 to 7 - object is "bendybar.iob " - state is BEND1. Frames 8 to 13 - object is "bendybar.iob" - state is BEND2. Frames 14 to 19 object is "bendybar.iob" - state is BEND3. Frames 20 to 32 - object is " bendybar.iob" - state is BENT_OVER. Save the project as "goodbend.ist". Render the animations as before. Hopefully, it will look like Figure 9 shown below.

Good Bend Animated GIF
Figure 9

And Finally..........

You may notice that the bendy tube shown above is still not perfect. It still requires something like one more morph target between states STRAIGHT and BEND1. Otherwise the BEND1 state may need tweaking. If anyone is wondering how I got the values for the conformations here we go. Firstly I worked out that with the tube bent double the radius required is around 30 in order to maintain the tube length (½C=PIr so r=tube length/PI). With the two object on screen STRAIGHT and BENT_OVER. I then added a disk which I scaled it to be an oval with the major radius the height of the STRAIGHT tube and the minor radius the width of the BENT_OVER tube (i.e. 100x30). The oval formed the curve that I wanted the tube to follow as it deformed. I copied the STRAIGHT tube three times. For each of these, using trial and error, I conformed them to a cylinder so that they fell within my oval curve. This gave my the required conformation parameters.


Mail Me

Any Suggestions and/or Comments

Back to Tutorials Menu

Return to Tutorials

Main Index

Back to Main Index


© Richard Jennings 1997 to 2002