developer.com - Reference
Click here to support our advertisers
SOFTWAREFOR SALE
BOOKSFOR SALE
SEARCH CENTRAL
JOB BANK
CLASSIFIED ADS
DIRECTORIES
REFERENCE
Online Library
Reports
TRAINING CENTER
JOURNAL
NEWS CENTRAL
DOWNLOADS
DISCUSSIONS
CALENDAR
ABOUT US
Journal:
Get the weekly email highlights from the most popular online Journal for developers!
Current issue
developer.com
developerdirect.com
htmlgoodies.com
javagoodies.com
jars.com
intranetjournal.com
javascripts.com
All Categories :
VRML
Chapter 9
Creating Advanced 3D Animations for the Web
-by Kelly Murdock
CONTENTS
Warping the Model's Surface
Showing Relative Speed with Motion Blurs
Using Constrained Animation and Behaviors
Using Rotoscoping
Character Animation Using Inverse Kinematics with Martin Hash's 3D Animation
Using Particle Systems
Extending Your 3D Package with Plug-Ins
Using Adobe's Premiere to Edit 3D Animations
Combining Several Animation Sequences into One
Adding Sound to Your Animations
Adding Special Effects to Your 3D Animations
Workshop Wrap-up
During your last look at 3D animations, you covered camera fly-bys,
animated models and textures, and keyframes. There are still many
ways to enhance your animations, both inside and outside the 3D
package. This chapter covers several of these advanced techniques:
Creating animations by warping the surface of models
Using motion blur to make your animations more realistic
Using model constraints and behaviors to control the motion
of your models
Using rotoscoping to place video clips in your animation
Creating advanced character animation with inverse kinematics
Using particle systems to create special effects, like explosions
and disintegrations
Extending your 3D software with plug-ins, such as 3D Studio
IPAS routines
Using video-editing packages, such as Adobe's Premiere, to
edit your animations and add sound
Adding post-production special effects to animations with
products like Strata's MediaPaint
Once again, you'll be introduced to many different products to
give you a well-rounded base from which to create.
Warping
the Model's Surface
Animation shows how things change over time; it would be pretty
boring to have an animation where nothing changes! Most of the
time, things change by moving their position or orientation, but
another type of movement is when the surface changes. Think of
how the ocean surface changes. An animation of the beach scene
wouldn't show the ocean model moving back and forth, but the ocean
surface rippling along.
To animate surface movement, you create a deformation object or
matrix that defines how the surface moves. You can then move the
object through this deformation object or move it over the stationary
object. Take a look at an example of how trueSpace does this:
Open the Primitives Panel and click the Add a Free Standing
Pipe for Deformation button. A cylinder appears, along with the
Deformation Nav panel that lets you move, rotate, and scale the
deformation cylinder.
With the cylinder selected, the cursor is in Face Select mode.
The light green lines indicate the faces. Click near any of the
green lines and select one of the navigation buttons in the Deformation
Nav panel. Clicking the Object tool changes the deformation object
to light blue and allows you to move, rotate, and scale the deformation
object, just as you do with other objects. When the cylinder is
deselected, it turns orange. This helps you distinguish deformation
objects from other models.
Next, load the model you want to deform. When the model is
selected, the deformation object turns dark red. Select the Start
Deforming by Stand Alone Deformation Object tool in the Model
section of the toolbar. When the cursor changes to a glue bottle,
click on the deformation object.
Click the Animation tool and set it to 30, then move the model
through the deformation object. The model will distort to match
the shape of the deformation object, which won't be seen in the
final rendered image.
By using deformation objects, you can make objects move in different
ways without going to the trouble of changing their surfaces.
This works by moving the deformation object or moving the model.
You can also use the Stop Deforming button, which makes the object
unaffected by the deformation object. These two buttons together
allow you to turn a deformation on and off as the animation progresses.
In Figure 9.1, I've used a deformation object to bend a fish as
it moves through the water.
Figure 9.1: A fish moving through the water is distorted by means of a deformation object that makes it look like it's swimming.
Showing
Relative Speed with Motion Blurs
When a car goes speeding by and you catch it out of the corner
of your eye, it looks like a blur whizzing past. Motion blur
is an advanced animation technique in which you tell the computer
to blur objects that are moving quickly in the scene. This blur
helps you understand the speed of objects and adds to the movement's
realism.
Creating motion blur in trueSpace is very simple. It's a render
option that you specify when you render an animation. Here's an
example:
Set up your scene. If you plan on using motion blur, then
you need to make sure there's some motion in your scene.
Set your keyframes to create your animation.
When you're ready to render the animation, click the Render
to File icon in the View group. The Render to File dialog box
will open.
Under the Resolution settings are three radio buttons: Motion
Blur, Depth of Field, and Field Rendering. Turn motion blur on
by clicking the On radio button.
Note
Field Rendering is how you set the focus of the rendered image. If you want the nearby and faraway objects blurred, then turn the Field Rendering effect on and change the setting to the focus distance you want.
To the right of the radio buttons are the settings. The Blur
Length setting controls how long the blur is. The Blur/Depth Frames
setting tells the computer how many sequential frames to use to
create the blur effect. Click the Render button to start the rendering.
Tip
To create a time-exposure effect, set the Blur Length setting equal to the total number of frames.
In Figure 9.2, one frame of a motion-blurred animation is shown.
To really see the effect, you need to run the entire animation.
Motion blur applies to all moving items, whether they are models,
textures, lights, or reflections.
Figure 9.2: In a classic animal versus machine race, motion blur is used to give the animation a realistic feel of motion. Any guesses on who wins ?
Using
Constrained Animation and Behaviors
Have you ever driven a car that suddenly left the road and floated
above it, or thrown a ball into the air that never came down,
or held a machine that suddenly fell into different parts? Controlling
the movements of 3D objects can be difficult because they don't
have to obey the laws of nature. That is, not unless you tell
them to-that's where constrained motion and behaviors come in.
Constrained motion tells a model the limits of its motion-that
it can move this far but no farther or rotate only halfway around.
For example, you can make a head turn, but not turn all the way
around. After all, it's not very realistic if your human figures
have their heads on backwards. You can also link parts together
so that they move in relation to one another.
With defining behaviors, you can, for example, tell your
models to sit, roll over, and beg. By giving your models behaviors,
they can interact with other models and the scene without being
directed along every step. For example, if you give a ball a bounce
behavior, then it automatically bounces off an object when it
hits one. In the following example, Ray Dream Studio uses both
constrained motion and defined behaviors:
Start with a model that requires constrained motion, such
as a three-wheeled vehicle. Certain sections of the model, like
the front and rear wheel assemblies, need to move together. Group
all parts belonging to each of those groups into two different
groups.
Next, select the Front Wheel Assembly group and bring up the
Object Properties dialog box by choosing Edit | Object Properties.
Click the Link tab; under this tab are all the different ways
you can constrain motion in Ray Dream Studio. Select the Axis
menu option, which allows rotation but not movement. Click the
Z-axis option and set the rotate option to Limited. This lets
the front wheel assembly rotate about 20 degrees in each direction.
Note
Here are the other types of constrained motion:
Lock locks the object to its parent
Slider allows movement along one axis
Axis lets an object rotate, but not move
Shaft allows movement and rotation along
one axis
2D Plane lets the object move within a plane
Ball Joint allows an object to rotate all
around a fixed point
There's also a custom setting for defining your own constraints.
Repeat the previous step for the Rear Wheel Assembly, but
this time select the Axis link around the X-axis and let the object
rotate freely. This option lets the back tires spin.
With the Object Properties dialog box still open for the Rear
Wheel Assembly, click on the Behaviors tab. You'll see an empty
box and four buttons. Click the Add button, and select the Spin
behavior. Next, select the X-axis and set the speed to the desired
movement per frame. In this example, I set the tires to rotate
10 degrees every frame. This causes the back wheels to rotate
throughout the animation.
Note
Other behaviors include Point At, Bounce, Inverse Kinematics, Track, and Alignment.
With these settings, it becomes much easier to animate your models
without worrying about parts flying away from the rest of the
model. Behaviors can automate simpler motions to ease the animating
process. Figure 9.3 shows the three-wheeler model with these settings.
Figure 9.3: A three-wheeler model with constrained motion and behavior links for the front and rear wheel assemblies.
Using
Rotoscoping
Imagine you want to animate a scene in which a simple 2D animation
you've created is playing on a television screen in a 3D scene.
The question is-would you have to re-create the simple 2D animation
using 3D models, or is there some way to use the existing 2D animation?
The answer is, you can use the existing 2D animation-with rotoscoping.
Rotoscoping is the technique of adding 2D animations into
a 3D scene.
Not only will rotoscoping work for the television example, but
it's also useful as another way to animate textures. Think of
the ocean example; you could rotoscope a simple repeating animation
of waves to create a realistic ocean scene.
Rotoscoping isn't limited to models, either. Many packages let
you rotoscope background images, which is useful for creating
the sense of motion without having to move models. Look at how
Ray Dream handles rotoscoping:
In the Shader Browser, select a Shader. Then choose the Shader
| Duplicate menu option to create a copy of that Shader. Then
double-click on the newly created Shader to load it into the Shader
Editor dialog window.
Click the Color tab in the Shader Editor, then choose Components
| Movie from the menu. A File dialog box opens, where you can
select the movie file you want to rotoscope.
The movie is loaded into the Shader Editor, and several controls
are made available that let you rotate the movie's orientation,
set the tiling, and play the movie.
With the Shader set up, drag the new material onto the model
or part that will display the movie, and you're done. The animation
sequence includes this movie as the file is rendered.
The example in Figure 9.4 shows how rotoscoping displays an advertising
message across a new line of furniture.
Figure 9.4: Advertising a new furniture line with rotoscoping.
Character
Animation Using Inverse Kinematics with Martin Hash's 3D Animation
Inverse kinematics is a buzzword in 3D graphics. A package that
supports it can more easily animate complex systems of interrelated
parts than a package that doesn't. The human body is an excellent
example of a complex system of interrelated parts.
To make a human model do something as simple as walking, these
are the steps you'd have to use in a 3D package without inverse
kinematics: First move the body forward, then move the thigh forward,
then the calf, then the foot, then the toes, then the toenails.
Since the 3D package doesn't know the relationship between the
different parts, each part has to move independently.
Kinematics helps define how these parts are connected.
The connection helps determine how the parts move as a system;
therefore, when the leg moves, the foot follows, and when the
arm moves, the hand follows. Furthermore, you can apply constraints
to these parts so that the system won't move in unnatural ways,
like bending a knee backward (unless you're modeling an ostrich).
Any package that supports hierarchy structure has the advantage
of kinematics; that is, child parts attached to a parent move
along with the parent. The inverse part is where inverse
kinematics differs. In packages supporting inverse kinematics,
the child parts still understand the connections. This means you
can pull a character's big toe and its leg will follow. Inverse
kinematics makes it very easy to position animation keyframes.
Until recently, inverse kinematics was available only in high-end
3D packages, but now it's common to find it in low-end packages,
such as Ray Dream Studio and Martin Hash's 3D Animation (MH3D).
Take a look at how MH3D uses inverse kinematics to animate human
characters:
Start by creating a new Choreography with the File | New Choreography
command. In the dialog box that opens, give the new choreography
a name and click OK.
The first things you need to add to your new scene are a camera
and a light. Click the Add Mode button (or press the A
key), then click in the Direction window to add a path to the
scene. Next, click the Assign a Camera button. Add another path
to the scene and click the Assign a Light button to add a light.
Note
The scene starts with a default light, camera, and camera target, but these can't be moved. Adding new elements replaces the default ones with ones you can move.
Add another path and click the Add a Figure button. A Figure
dialog box opens for creating a new figure or selecting an existing
figure. I selected the duck figure from the MH3D CD-ROM, as Figure
9.5 shows.
Figure 9.5: A duck wadding across the screen, produced by using inverse kinematics.
Note
The figure will probably be displayed in Bound mode, which makes it look like a group of boxes. This is the fastest draw mode. You can change the draw mode by opening the Attributes panel with the command Window | Attributes Panel. Under the Type box are buttons with a circle, a diamond, and a square-they represent the Curved, Vector, and Bound draw modes.
You can add more points to the path by clicking the Add Mode
button and dragging the existing path control point to where the
new point will be located. Repeat this process to add multiple
path points. You can also add multiple path points to the light
and camera paths, too. The Edit Mode tool (the arrow tool) lets
you select and move individual path control points.
Paths control how objects move across the scene, but to move
the model parts, you need to build motion scripts. Open the Script
window by choosing Edit | Script, then click the Add button. Another
dialog box opens where you can select an existing action or build
a new one. Click the New button and give the new action a name.
This moves you into Skeletal mode. Move to the view on the
right and select frame 3 as the current frame number, then drag
the lower box representing one of the duck's feet and move it
slightly forward. Next, advance the frame to frame 6 and return
the feet together. Select frame 9 and move the other foot forward;
at frame 12, return them to their starting position. This is inverse
kinematics in action. You don't have to worry about moving the
legs when positioning the feet. Try moving the wings and the torso
around, too.
Close the Skeletal window and click through all the frames
using the Go to Next Frame button in the upper-right corner (or
press the + key). The figure will walk along the path performing
the action you just built.
In Figure 9.5, you can see a frame of the duck waddling across
the screen. Although this motion is simple, using inverse kinematics
is invaluable when you're animating complex motions.
Using
Particle Systems
Remember a few sections back when you learned how to use constrained
motion to link objects together? Well, sometimes you don't want
your models to be organized-you might want to have parts fly off
chaotically into millions of pieces. These millions of pieces
are called particles, and when grouped together are known
as a particle system. These particle systems can be controlled
and given behaviors.
Three common types of particle system movements are shatter, explode,
and atomize. These special effects are so common that some 3D
packages have them built in, and the results are, well, chaotic.
In Studio Pro, these three particle motions can be used to create
some spectacular effects, like the following:
Load a model into the Studio Pro workspace and manipulate
it to the position where the animation will start.
Select a point on the model where the effect will start, then
choose Animation | Special Effect | Atomize. This opens a dialog
box where several control options are available.
The Atomize special effect converts the entire object into
small spheres that jump and dance around the screen. In the Control
dialog box, you can select the size of the spheres and their instability
and energy, which affect how they move and the time for the entire
animation.
Once you click the OK button in the Control dialog box, Studio
Pro begins creating the animation script. These types of animation
are quite complex and take some time and memory to complete. Some
images from a bowling pin that was atomized are shown in Figure
9.6.
Figure 9.6: Images from an animation of a bowling pin atomized in Studio Pro.
Extending
Your 3D Package with Plug-Ins
3D packages sometimes play leapfrog with features, so to get the
latest effects and features, you often have to buy the newest
product released. To stop this insanity, 3D packages are beginning
to support plug-ins. This way, additional functions can be added
to a package without buying a whole new version.
In much the same way that Netscape and Photoshop have added functionality
to their core products, plug-ins can add special effects or streamline
tedious tasks. Although it's a new concept for some 3D packages,
others have used plug-ins for a while.
The king of these 3D package plug-ins is the granddaddy of 3D
animation for the PC-3D Studio. 3D Studio uses what are called
IPAS routines, which exist as different programs that run
in the 3D Studio environment.
Note
3D Studio is made by Autodesk, the same people who make AutoCAD, a popular PC-based CAD package. Autodesk recently renamed its multimedia tools group and now calls it Kinetix.
There are several different types of IPAS routines available for
3D Studio; most of them are made by third-party vendors.
3D Studio isn't the only 3D package to support plug-ins. Lightwave
and SoftImage also support plug-ins, and even Ray Dream Studio
ships with an extension kit that helps third-party vendors build
plug-in modules.
Because of the wide variety of plug-ins available, it wouldn't
do justice to show one as an example. Over time, you can expect
the more popular plug-ins to begin to show up within the actual
program.
Using
Adobe's Premiere to Edit 3D Animations
Remember in the last chapter how you used Photoshop to touch up
some of your 3D images? You could do the same thing with animations
if you edited each frame individually, but that would be a lot
of work. A better solution is using a video-editing package like
Adobe's Premiere; Adobe has created several great editing tools.
So what can you do with video-editing software? You can move the
frames around and reorder them, you can add transitions, such
as dissolves or fade-outs, and you can add sound to your animations.
Combining
Several Animation Sequences into One
Most animations move the camera or objects consistently from start
to finish. To produce an animation with several different viewpoints,
you need to re-render each animation with a different camera selected.
These different segments can then be combined into a single animation
by using a video-editing package like Premiere. Take a look at
how this is done for an accident reconstruction sequence:
Using trueSpace, re-create an accident and render several
animations from different viewpoints. I rendered one from the
air looking down on the accident, one from the truck driver's
perspective, one from the car's perspective, and the last one
from a witness's car at the scene.
Then, in Paint Shop Pro, make four images to introduce the
animations, such as aerial view, truck view, car view, and witness
view.
Open all four animations and all four text images in Premiere
and drag them into the Construction Window in the first Video
track. Make sure to align them so that the introduction image
comes before its respective animation.
Open the Controller by selecting Windows | Controller and
click the Play button to see the animation.
You can add transitions to the project by dragging them from
the Transitions library into the Transitions track under the first
Video track.
Finally, render the finished movie by selecting Make | Make
Movie, and give it a name.
The CD-ROM shows the finished product, and Figure 9.7 shows the
Premiere environment with the line-up compiled. There's a lot
more you can do with Premiere, such as loading several animations
and overlaying them. Before you leave Premiere, you'll look at
another valuable addition that can liven up your 3D animations.
Figure 9.7: An accident-reconstruction animation mode from several single animations tied together with Premiere.
Adding
Sound to Your Animations
Adding sound to your animations is more of a requirement these
days-nothing makes the experience more real than sound that's
well synchronized with the action. Adding a sound track with Premiere
is easy:
Open the sound file by using the File | Open command. The
sound file shows up in the Project window with the other elements.
Drag the sound clip onto the Audio portion of the Construction
window.
In the Construction window, you can move and drag the sound
clip around to help synchronize it with the scene.
Create the movie with the Make | Make Movie command.
Tip
Because of the size that sound data takes up, limit all sound that will go on the Web to 11 KHz, 8-bit mono sound.
I'd show you the results of this example in a figure, but that
wouldn't help much since it's an example of an animation with
sound, so go to the CD-ROM to hear it.
Adding
Special Effects to Your 3D Animations
Premiere lets you draw right on top of the individual frames,
but similar packages are beginning to appear that allow you to
add special effects like bubbles, fire, and lightning to your
animations in what is called post-production, or the work
done after the animation is rendered.
One such package is Strata's MediaPaint. The core product has
functions much like an image-editing package, but add-in packages,
such as Special Effects, Volume 1, can easily extend the features
of the core product. This special effects pack lets you easily
add otherwise difficult effects, such as bubbles, laser beams,
fire, fireworks, lens flares, and lightning, among others. Now
for an example.
Caution
MediaPaint requires that your computer be set to 24-bit true color mode for the program to work properly.
Load a pre-rendered animation into MediaPaint with the File
| Open command. The first frame of the animation will show up
in the Edit window, and the entire animation will be visible in
the Filmstrip window.
Select a color from the Color Palette window and a brush size
from the Brush area. Next, select an effect from the Tools window,
such as BabyBoom.
Click the Record button in the Movie Controls panel. If this
panel isn't visible, choose View | Movie Control Panel. A warning
dialog box appears, telling you that you can't undo the operation.
Click Proceed to continue.
With the Record button pressed, the frames automatically advance
once you start to paint in the Edit window.
When you're finished, rewind the video and hit the Play button
on the Movie Controls panel to see the results.
Adding special effects after an animation is complete offers you
another way to enhance your 3D animations for your Web site. For
this example, the sparks flying off the Apollo command module
as it re-enters the atmosphere would have been difficult to create
in a 3D package. Figure 9.8 shows the MediaPaint environment.
Figure 9.8: Using Strata's MediaPoint to add special effect to your animation.
Workshop
Wrap-up
You've now expanded on what you've already learned and have seen
a sampling of what tools and technologies the real 3D pros use.
To create that special scene you see in your mind's eye, you may
need to use some of these advanced tricks to unfold your vision
to the world. Not everything you need to be a professional 3D
animator was covered, but at least now you know where to look.
Next Steps
So where do you go after learning about creating advanced rendered
images? Well, anywhere you want actually, but I would recommend
the following:
The next chapter, Chapter 10, "Using
Apple's QuickTime VR," moves you one step closer to the real-time
3D worlds with an interesting look at Apple's new technology.
For a real-world example, skip over to Chapter 12,
"Real-Life Examples: Creating a MYST-like Adventure on the
Web."
VRML is still coming up in Chapter 13,
"Exploring VRML Browsers and Development Tools."
Q&A
Q:I used constrained motion and behaviors to animate my models, but their motions still don't look very realistic. Is there any way to improve my models' motions?
A:Most of the high-end 3D packages support motion capture data. Motion capture is the process of placing reflective tape or sensors on an actual person and recording the motions of these sensors as the person performs some motion. The recorded motions are recorded in a format that 3D packages can read. You then line up the points of motion data with your model, and the model is controlled by the motion data.
These systems for recording motion data are very expensive, but the resulting motions are extremely realistic. Viewpoint Datalabs also sells a limited number of motion capture datasets. Contact Viewpoint if you're interested.
Q:I'm interested in the plug-ins that add more functions to your 3D package. Is it possible to create your own plug-ins?
A:Several companies make their living from creating IPAS routines. Some of the more popular are 4Division, Pyros Partnership, The Yost Group, and Digimation. These teams have serious graphics programmers, and their products represent the state of the art.
If you're a programmer and would like to try your hand at creating plug-ins, contact the company that produced your 3D package and ask them about an SDK or software developer's kit. These kits have the information you need to begin building your own plug-ins.
Q:I noticed that you covered video-editing packages as a means of editing 3D animations. Can these products be used to integrate real-life video with 3D-generated models?
A:Yes, both Premiere and MediaPaint can be used to integrate real-life video with 3D-rendered models, scenes, and elements. Premiere does this by loading the 3D animation into one channel and the video into another, then marking how they overlay one another.
Use of this site is subject to certain
Terms & Conditions.
Copyright (c) 1996-1998
EarthWeb, Inc.. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Please read the Acceptable Usage Statement.
Contact reference@developer.com with questions or comments.
Copyright 1998 Macmillan Computer Publishing. All rights reserved.
Wyszukiwarka
Podobne podstrony:
UAS 13 zaoer4p2 5 13Budownictwo Ogolne II zaoczne wyklad 13 ppozch04 (13)model ekonometryczny zatrudnienie (13 stron)Logistyka (13 stron)Stereochemia 13kol zal sem2 EiT 13 2014EZNiOS Log 13 w7 zasobywięcej podobnych podstron