1. Introduction
Triangle meshes in Art of Illusion are an amazingly powerful tool for creating
objects with complex shapes. They are also proof that I am a programmer, not
a salesman. If I were a salesman, I would have called them "Hyper-Morphic
NURBoid Meta-Meshes", or something equally impressive sounding. This is, in
fact, the sort of name that similar tools tend to have when they appear in
other 3D programs: Meta-NURBs in Lightwave, Hyper-NURBs in Cinema 4D, etc.
They actually have very little to do with NURBs (in fact, they are much more
powerful than NURBs), but I guess the salespeople liked the way it sounded.
I, being merely a programmer, refer to them by the rather more humble
description of "triangle meshes".
So what, exactly, are triangle meshes? The most obvious answer is, "a surface
composed of triangular facets." In most 3D programs, that would also be the
complete answer. In Art of Illusion, it is only the beginning.
A more accurate answer is, "a surface defined by a mesh of triangular facets."
Note the difference: "defined by" rather than "composed of". The triangular
facets act as a control mesh by which you can define the surface. The
surface itself, however, may be either faceted or smoothly rounded. Or half
one and half the other. Or mostly smooth, but with a few sharp points and
creases. Or anything in between.
This tutorial will introduce you to triangle meshes: what they are, how to
create them, and some of the tools available for editing them. It is not
intended to be comprehensive: I will not be covering every last feature of the
mesh editor. I will, however, try to get most of them, and the remaining ones
should be easy enough to figure out.
Before going on to the tutorial itself, I should mention two other types of
objects that can also be used for creating free-form surfaces: spline meshes
and polymeshes. Spline meshes lend themselves more naturally to creating
certain types of shapes than do triangle meshes, but they are much less
powerful overall. For this reason, you will sometimes want to use spline
meshes for creating certain types of fairly simple objects, but not for anything
which is very complex. Polymeshes, on the other hand, are in some ways more
powerful than triangle meshes, in that they allow faces to have more than
three sides. This makes them very useful for many types of objects, although
they are less efficient to render and in some cases produce a less smooth surface.
Triangle meshes also offer a second tool which you can use to control the
shape of the surface: every vertex and every edge has a smoothness
value associated with it. A value of 0 produces a sharp point or crease. A
value of 1 gives a smooth surface. Values between these extremes give
intermediate results: rounded points, beveled edges, etc.
The following figure gives you an idea of what can be done just by changing
the smoothness values of a mesh. All of the images show the same object: a
cube which was converted to a triangle mesh, and whose smoothing method was
set to "approximating". The only difference between the images is the
smoothness values for vertices and edges.
This cylinder was then converted to a triangle mesh with a large
tolerance. This is shown in the center, with the smoothing method set to
"none". It is clear from the image that the mesh is only a very rough
approximation to the original cylinder.
Once you have created a triangle mesh, select it and choose "Edit Object" from
the Object Menu. A new window will appear which looks something like this.
The triangle mesh editor window is quite similar to the main scene editor
window. The four viewports in the center show the object that is being edited
(both the control mesh, in black, and the actual surface, in blue). The tool
palette along the left edge provides various tools for editing the mesh, and
the line of text at the bottom describes how to use the current tool.
Two of the tools should already be familar to you from the scene editor: Move
View and Rotate View. These tools merely change the direction from which you
are looking at the object, and do not affect the object itself in any way.
The most important tool is the Select and Move tool. As the name suggests,
this tool is used for two purposes: selecting portions of the mesh to edit,
and moving around selected vertices. You can select vertices by clicking on
them, select several vertices by shift-clicking, or drag a box to select
everything inside it. Clicking on a vertex and then dragging will move all
the selected vertices.
The next five tools (Scale, Rotate, Skew, Taper, and Outset) are all used to
deform pieces of the mesh in specific ways. To use any of these tools, you
must first select a portion of the mesh to deform. It will then display a set
of handles around the selection, which you can drag to deform the selected
region. If you experiment with the various
tools, you will quickly get a feel for what each one does. Be sure to read the
text at the bottom of the screen, since it will tell you about various keys you
can hold down that affect the behavior of the tool.
The multicolored sphere icon represents the compound Move/Scale/Rotate tool.
As the name suggests, it combines most of the functions of the Move, Scale, and
Rotate tools into a single tool. Its user interface is a little more
complicated than the others, but once you get comfortable with it, it can be
very convenient to use, since it lets you do many operations without having to
change tools.
The two light blue icons are the Bevel/Extrude and Create Point tools. They
are discussed in sections 6 and 7 below.
The green stick figure icon represents the Skeleton tool. It is used for
creating and editing the mesh's skeleton, and will be discussed in detail in
section 9.
In the previous paragraphs, I referred to selecting and moving vertices.
Actually, the editing tools are a little more general than that. In the lower
left corner of the window, you will notice three buttons labeled "Point",
"Edge", and "Face". These are the three selection modes supported by the
mesh editor. In "Edge" mode, the basic objects which you can select and
manipulate are the edges of the mesh (the lines connecting vertices). In
"Face" mode, the basic objects are faces. Try experimenting with all three
modes. Also notice what happens to your current selection when you switch
modes.
The commands discussed so far have allowed you to move existing vertices, but did
not change the number of vertices in the mesh. This section discusses two commands
that do change the number of vertices: one for adding detail, and another for
removing it.
Suppose you are trying to create a head for a character. You might start with a
sphere (a reasonable first approximation to the shape of a head), then convert
it to a triangle mesh to refine the shape: square the forehead, pull out the jaw,
etc. Suppose that when you come to do the face, however, you find that your
mesh is too low resolution. There simply are not enough vertices in it to let
you sculpt a realistic nose, mouth, eyes, and so on. What can you do?
The answer is to use the "Subdivide" command. This command adds detail to your
mesh by subdividing the selected region to increase the number of vertices,
faces, and edges. The precise way in which it does this depends on your current
selection mode:
- In "Edge" mode, it adds a new vertex in the middle of each selected edge. The
edge itself is split into two edges, and the adjoining faces are similarly split.
- In "Face" mode, it adds a new vertex in the center of each selected face. New
edges are added connecting this vertex to each of the corners of the face, and the
face itself is split into three faces.
Here is a subtle but very important point: when using the Subdivide command in Edge
mode, the subdivision is done based on your selected smoothing method. If the
smoothing method is "None" or "Shading", the new vertex will be placed exactly in
the center of the selected edge, midway between the two endpoints. If it is set
to "Interpolating", the new vertex may be slightly off of the original edge so as
to maintain the smoothness of the mesh. If it is set to "Approximating", then not
only will a new vertex be added to each edge, but the old vertices themselves may
move slightly.
If this sounds very confusing, simply remember this rule: if you are in Edge mode
and you repeatedly use the Subdivide command, the control mesh will quickly
converge toward the actual smoothed surface of the object. Try it a few times and
you will see what I mean.
In addition to the "Subdivide" menu item, there is also the Create Point tool
which does the same thing in a more interactive way. With this tool selected, you
can click on an edge or face (depending on which selection mode you are in),
and it will be split at exactly the point where you clicked.
By using the Subdivide command, you can create large numbers of new vertices and
edges very quickly. This itself can be a problem. Remember what I said before
about simple meshes being easier to work with. Once you have finished subdividing
and editing a part of the mesh to create the shape you want, you often will find
that it has more vertices than are actually required. After a few cycles of
editing, this can become a serious problem.
The solution is to use the "Simplify" command. This does the opposite of the
Subdivide command: it merges adjacent vertices together to reduce the total
number of vertices, edges, and faces in the mesh. To use it, select the portion
of the mesh you wish to simplify and select "Simplify Selection" from the Mesh
menu. Alternatively, if nothing is selected, the command changes to "Simplify
Mesh", which simplifies the entire mesh.
The simplification is done based on a local error metric. This means that you are
prompted to enter a maximum allowed error, and the control mesh is then
simplified as far as possible while ensuring that no point on the new, simplified
mesh is further than that distance from the original, unsimplified mesh. Small
values ensure that the simplified mesh remains very close in shape to the original
mesh, but also limit how much it can be simplified. Larger values result in a
simpler final mesh, but may cause noticeable changes to the shape of the surface.
There also is a Bevel/Extrude tool which provides a more interactive (though less
precise) interface for doing the same thing. To use it, select a portion of the
mesh and then drag the handle shown in the center of the selected region. You
can move the mouse up and down to change the extrude height, and left and right
to change the bevel width.
All of the commands discussed so far have an important feature in common: they preserve
the topology of the mesh. None of them can be used to create a hole in a mesh, or to
create a new connection between distant parts of the mesh. In this chapter, we look at
several commands that do change topology.
The first such command is the "Clear" command in the Edit menu. This deletes the selected
vertices, edges, or faces from the mesh, leaving a hole where they were. You can also
do this by pressing the Delete key on your keyboard.
The "Close Selected Boundary" command does the exact opposite: it creates a new set of
faces to close off a hole in the mesh. To use it, make sure you are in Edge selection
mode, then select the edges which surround the hole you want to close off. (You must
select all edges surrounding the hole; if there is a break anywhere in the
selection, the menu item will be disabled.)
The "Join Selected Boundaries" command works in a similar way, but instead of closing
off a single hole, it creates faces that connect two holes in different parts of the
mesh. To use it, select the boundary curves of both holes that you want to connect
and select the command from the Mesh menu.
To connect the two holes, an edge must be added linking each vertex of one boundary
to a vertex of the other boundary. There are, of course, many ways to do that. The
editor tries to make a good guess about how best to connect the holes, but it will not
always do it exactly the way you want. It therefore displays a dialog with a preview
of how the object will look after joining the boundaries. You can use the controls in
this dialog to edit how the two boundaries should be connected together. When you are
satisfied with the way it looks, click OK to complete the operation.
The skeleton of a triangle mesh is much like the skeleton of a person. When someone
looks at you, they cannot see your skeleton; it is hidden inside you. But every
time you move, the structure of your skeleton is clearly revealed in the way the
different parts of your body move in relation to each other. The same is true for
meshes. Their skeletons are not actually visible, but they determine how the different
parts of a mesh move together.
Skeletons are a useful tool for creating meshes, but when you come to animation
they become absolutely critical. There are two specific ways in which skeletons
help you to animate objects:
- They allow you to create keyframes quickly and easily. For example, if you
want a character to raise its left arm, you simply select the bone corresponding
to the arm and raise it. There is no need to select all the vertices which make
up the arm and try to rotate them in a realistic way.
- When Art of Illusion interpolates between the keyframes you have set, it will
use information about the object's skeleton to interpolate in a more physically
realistic way than it could otherwise.
A skeleton is composed of bones, which are connected to each other at
joints. You create and edit bones with the Skeleton tool. Note that
I will sometimes talk about a bone and the joint at the end of that bone as if they
were the same thing. For example, if I say to select and drag a bone, I really
mean that you should click on the joint at the end of that bone and drag it.
You will find, however, that the results of doing it make more sense if you think
in terms of selecting and moving the bone, not the joint.
The figure above shows a simple mesh, and its skeleton consisting of three bones.
The bones are the diamond shaped objects, and the joints are the crosses at the
ends of them.
The Skeleton tool is very easy to use. You select a joint by clicking on it, and
drag to move it. The currently selected joint is colored red, as shown in the
figure above. To create a new bone, click the mouse with the control key held
down. This will create a new joint at the place you clicked, and a new bone
connecting it to the previously selected joint. If no joint is currently selected,
the new joint will not be connected to any bone. This allows you to create
skeletons consisting of several separate groups of bones, with no connection
between one group and another.
Notice that one of the joints in the skeleton is colored green. This joint has been
locked. You can lock or unlock any joint by shift-clicking on it.
When you drag any other joint, a locked joint (and everything beyond it) will remain
fixed, and the bones in between will bend to follow your movements. Try creating a
skeleton, and experiment with moving the pieces of it around. You will quickly get a
feel for how it works. If you want to delete a joint, simply select it and press
the delete key.
Notice the red handle coming out from the side of the selected joint. If you drag
it, the selected joint will bend without changing any other joint. This can be
useful when you want to make precise adjustments in the shape of the skeleton.
A handle is drawn for every unlocked degree of freedom of the selected joint.
I'll explain in the next section exactly what that means.
Now you know how to create and move a skeleton, but that isn't very useful by itself.
It's the mesh that you really want to reshape, and moving the skeleton doesn't seem
to have any effect on it so far. To make that happen, you must bind the
mesh to the skeleton. Here is how you do that:
- Choose "Select All" from the Edit menu.
- Choose "Bind Points to Skeleton..." from the Skeleton menu.
- Click "OK", accepting the default value for IK Weight Blending.
By now, you have learned how to create a skeleton, how to bind the mesh to it,
and how to reshape the skeleton and mesh together. All of this is easy to do, but
there's more going on than meets the eye. In this chapter, we will look at the
process a little more closely.
Select a vertex in your mesh and choose "Edit Points..." from the Mesh menu.
You will notice two items in the window called IK Bone and
IK Weight. IK stands for inverse kinematics, which is the name for
the way the skeleton bends to follow your movements as you drag a joint around
the screen.
The first option allows you to specify which bone of the skeleton this particular
vertex is bound to. Any time that bone moves, the vertex will move with it. By
repeatedly selecting vertices, choosing "Edit Points...", and setting bones for
them, you can manually bind the mesh to the skeleton. You usually will not need
to, since the "Bind Points to Skeleton..." command does this for you automatically.
If you simply bound each vertex to a bone, the results would not be very satisfying.
When you adjusted the skeleton, sharp creases or distortions would appear in the mesh
around every joint, as the vertices bound to one bone moved in a different direction
from those bound to the next bone over. To reduce this problem, a vertex can be
"partially bound" to two bones at once. That is what the IK weights are for. If
you bind a vertex to a bone with a weight of 1, it is completely bound to that bone.
As you reshape the skeleton, its position will be entirely determined by the motion
of that bone. On the other hand, if you set its weight to 0, it will not be bound
to that bone at all. Instead, it will be entirely bound to that bone's parent
in the skeleton. And if you assign a weight between 0 and 1, it will be partly
bound to each of the two bones, and its motion will be determined by a weighted
average of their respective positions. By using intermediate weights around each
joint, you can smooth out the distortions in the mesh and create much more
satisfactory results.
Most of the time, you do not need to worry about any of this. The "Bind Points to
Skeleton..." command generally does a fairly good job of figuring out which bone to
attach each vertex to and what weight to use. There may be times, however, when you
are not satisfied with its assignments, and in these cases you will want to adjust
them by hand.
One other command that is very useful is "Temporarily Detach Skeleton" in the Skeleton
menu. Suppose you have carefully bound your mesh to its skeleton, adjusting weights
until you are satisfied with the result. Then you decide you want to change the
position of the skeleton slightly without affecting the mesh. You could
select all the points, set them to be not bound to any bone, move the skeleton,
and then manually reattach them again. That would be a huge amount of work, however.
Instead, you can simply select "Temporarily Detach Skeleton". Whenever this
option is selected, moving the skeleton has no effect on the mesh regardless of
whether points are bound to it or not. When you are done moving the skeleton, you
can simply deselect the option again.
Now let's look at a single bone in more detail. Select a bone and choose the
"Edit Bone..." command from the Skeleton menu. (Of course, it is really a joint
you are selecting, but this is one of those cases where things make far more sense
if you think in terms of selecting bones, not joints. For example, if you want to
control how a character's arm bends at the elbow, you do not select the elbow,
but instead select the joint at the end of the arm. This seems bizarre if you think
in terms of joints, but makes sense if you think in terms of bones. You want to
control the motion of the forearm. Therefore you want to select the forearm, which
means clicking on the joint at its end.) A window will appear which
looks something like this:
Who would have guessed that a single bone could have so much information to display
and edit! The window is divided into four sections, one for each of the bone's
four degrees of freedom. A degree of freedom is a way in which the bone can
move or change.
The first two, X Bend and Y Bend, describe the orientation of the
bone relative to its parent bone. To understand these, hold your arm pointing
straight out to one side. Move the arm slowly up and down. You are changing its
X Bend angle. Now move it slowly forward and backward. You are changing its Y
Bend angle. Make sense?
The third degree of freedom, Twist, describes a rotation of one end of the
bone relative to the other around the axis of the bone. To understand this, hold
your arm straight out in front of you with the palm facing down. Now rotate your
hand so the palm faces upward. That is your forearm's twist degree of freedom.
Notice how one end of your forearm (the end connected to your wrist) rotates by
180 degrees, while the other end (the end connected to your elbow) hardly moves
at all.
Of course, real bones are solid objects whose ends cannot rotate relative to each
other. Your forearm actually contains two different bones which rotate around each
other to create the twist of the arm as a whole. For our purposes, however, it
is much easier to use only a single bone and allow it to have an internal twist.
The final degree of freedom is Length. Once again, real bones are solid
objects which cannot change in length. But why should you be bound by reality?
So what are all of those options for each degree of freedom? First and most
importantly is the actual value for the angle (or distance in the case of length).
You can edit it by typing in a new value, or by dragging the handle on the dial
next to it.
Next there is the "Lock" checkbox, which allows you to lock a particular degree
of freedom so that it cannot be changed. Each degree of freedom represents a
way in which the bone can move, and different bones move in different ways. For
example, your upper arm can rotate up and down (X Bend) and forward and back
(Y Bend), but it cannot twist or change length. Your forearm can bend at the
elbow in one direction (X Bend) but not in the other direction (Y Bend). Imagine
how strange it would look if an animated character had elbow joints that could
bend in any direction, just like a shoulder joint!
Next, you can restrict the range of motion for a degree of freedom. For example,
your forearm can go from being completely straight (0 degrees) to being quite sharply
bent inward (perhaps 150 degrees). But it cannot bend inward any further than that,
nor can it bend outward at all. Setting ranges for each degree of freedom is important
for making an animated character move in a realistic fashion.
If you want still more control over the motion of a degree of freedom, you can set a
comfort range for it. This is a subset of its allowed range over which it
moves most easily. As it moves outside its comfort range, it becomes stiffer and moves
less easily. Thus, although it can still move all the way to the end of its allowed
range, it will usually tend to remain within the comfort range.
Finally, you can set an overall stiffness for each degree of freedom which
determines how easily it moves. Suppose, for example, you are modelling an animal
with a long tail, and you place a series of several bones along the length of the
tail so that it can bend freely. To bend the tail, you want to simply lock the
joint at the base of the tail, select the end of the tail, and drag it. You may find
that you are not satisfied with the way it bends, however. Perhaps it bends too
much at the end and not enough near the base. You can fix this by increasing the
stiffness of the joints near the end. Or perhaps it bends too much near the base and
not enough at the end. In that case, you would increase the stiffness of the joints
near the base.
If all of these options sound a little overwhelming, don't worry! You can safely
ignore most of them, especially the stiffness values and comfort ranges. They are
a handy tool once you get more comfortable working with skeletons, but they are only
that: a tool which you can use or not as you choose.