Computational Design of Mechanical Characters
Computational Design of Mechanical Characters
Computational Design of Mechanical Characters
Stelian Coros*1 Bernhard Thomaszewski*1 Gioacchino Noris1 Shinjiro Sueda2 Moira Forberg2
Robert W. Sumner1 Wojciech Matusik3 Bernd Bickel1
1 2 3
Disney Research Zurich Disney Research Boston MIT CSAIL
Figure 1: The interactive design system we introduce allows non-expert users to create complex, animated mechanical characters.
Abstract 1 Introduction
1. Given an articulated character as an input, the user selects a set the system recursively decomposes it into simpler sub-functions
of actuation points on the character and sketches associated until a match is found in the database. Similarly, Subramanian
motion curves. and Wang [1995] define valid configuration spaces for building
blocks and use an iterative deepening search to generate mechanism
2. For each input curve, the precomputed database is queried topologies and geometries that satisfy given motion constraints. Al-
to find an assembly that matches the motion specified by the ternatively, genetic algorithms or other stochastic search methods
user. This gives us both the type of mechanical assembly that can be applied [Cabrera et al. 2002]. Recently, Zhu et al. [2012]
is best suited for each motion curve, and a good initial set of suggested selecting a mechanism from a parameterized set accord-
parameter values (Sec. 4). ing to a priori knowledge of its motion. The selected mechanism is
3. Appropriate driving mechanisms are instantiated, connected then refined by optimizing over both discrete and continuous vari-
to the character, and their parameter values are further opti- ables using simulated annealing. While this approach can effec-
mized using a gradient-based formulation (Sec. 4.2). tively handle, e.g., linear, ellipsoidal or circular motions, creating
mechanical characters exhibiting complex motions requires a more
4. Once all driving mechanisms are set up, the gears that actuate general formulation. In our work, we use a sampling-based ap-
them are connected to each other through a gear train in a proach to generate a sparse but representative set of motions that
semi-automatic fashion (Sec. 6.1). different types of mechanisms can generate. This allows us to de-
termine which of the available mechanism types are well-suited to
5. For planar characters, our system then repositions the me- create a desired motion, and we use a gradient-based method in
chanical components to ensure that no collisions occur during order to further optimize the mechanisms generated by our frame-
operation (Sec. 6.2). work.
6. Finally, support structures are generated to hold the compo-
nents of the assembly in place (Sec. 6.3). The complete char- Motion and Interaction Analysis. There exists a variety of
acter model and the mechanical assembly driving it are then methods for analyzing the geometry of mechanisms in order to ex-
ready for fabrication (Sec. 6.4). tract the kinematic constraints that define their motions. For in-
stance, Mitra et al. [2010] present a semi-automatic technique for
2 Related Work depicting the operation of mechanical assemblies. Their method
determines the causal relationship between different parts of an
Mechanical Assemblies have tremendously changed our way assembly based solely on geometry. Such processes are also in-
of life since the industrial revolution — for a comprehensive in- vestigated for reverse engineering of scanned devices [Demarsin
troduction into mechanisms and mechanical devices we refer the et al. 2007]. Recent work also explores the creation of a print-
interested reader to the textbook of Sclater and Chironis [2001]. able articulated model from input geometry by analyzing a skinned
The potential to use specialized software for analysis and design mesh [Bächer et al. 2012] or offering an intuitive user interface
of mechanisms has been recognized since the early days of com- to control the placement and range of motion of joints [Calı̀ et al.
puters [Freudenstein 1954]. Consequently, a variety of approaches 2012]. While the resulting characters can be posed, these methods
for representing mechanical structures have been presented. Some do not address the challenge of animating them. In principle, how-
modeling systems, for instance, implement function-oriented and ever, the characters designed using these methods could be used as
shape-oriented approaches, where objects, assemblies and posi- input for our framework.
tional relationships are represented as nodes in a graph structure,
and an explicit or procedural representation is used for shape prim-
Design Systems and Personalized Fabrication are quickly
itives [Wesley et al. 1980; Gui and Mäntylä 1994]. Similar tech-
gaining interest in the computer graphics community. Interac-
niques are used to implement basic functionality for commercially
tive systems enable non-expert users to design, for example, their
available CAD/CAM tools. Despite the significant benefits pre-
own plush toys [Mori and Igarashi 2007] or furniture [Lau et al.
sented by such tools, creating complex mechanisms, such as those
2011; Umetani et al. 2012]. Rapid prototyping devices allow for
needed to animate mechanical characters, currently requires expert
the fabrication of physical objects with desired properties based
designers.
on custom microgemetry [Weyrich et al. 2009], reflectance func-
tions [Malzbender et al. 2012], subsurface scattering [Hasan et al.
Kinematic Synthesis. Several existing methods aim at automat- 2010; Dong et al. 2010] and deformation behavior [Bickel et al.
ing the design of devices that transform a specified input motion 2010]. Ensuring that printed objects are structurally stable, Stava
into a specified output motion. Chiou and Sridhar [1999], for et al. [2012] proposed to relieve stress by automatically detecting
instance, use symbolic matrices representing a library of mecha- and correcting problematic parts of the models. In our work, we
nism as basic building blocks. Starting with an intended function, focus on the problem of designing mechanical assemblies. Inspired
Figure 3: The driving mechanisms we use as building blocks can generate a continuous space of widely different motions. To generate
optimized assemblies that best match an input motion, we first perform a coarse exploration of the space of possible motions for each
mechanism, followed by a continuous parameter optimization.
by recent work in sketch-based interfaces [Eitz et al. 2012] and de- Pin Connections are used to model hinge joints between pairs
sign galleries [Marks et al. 1997], we present an interactive design of components i and j. The constraints output by this type of con-
system that allows non-expert users to intuitively create complex, nection take the form Cc = {(x(xi )i − x(xj )j )T (v(vi )i −
animated mechanical characters. v(vj )j )T }T . The parameters xi , xj , vi and vj define the position
and rotation axis of the pin joint. Note that while the Pin Con-
nections output six constraints, they only remove five degrees of
3 Assembly simulation freedom from the system: the two connected components can still
rotate freely with respect to each other about the axis v(vi )i (or
The recent method proposed by Zhu et al. [2012] simulates me- equivalently v(vj )j ). Attaching two pin connections between the
chanical assemblies in a two-stage process. First, the configuration same pair of components results in them being welded to each other.
of the driving assembly is computed using forward kinematics: by
assuming a tree-based representation of the mechanism [Mitra et al.
2010], the configuration of a component fully determines the con- Point On Line Connections ensure that a pin on component i
figuration of all other components that are connected to it. Second, always lies on a line defined on component j. This type of con-
the motion of the toys is computed using inverse kinematics. In nection outputs constraints Cc = v(vj )j × (x(xi )i − x(xj )j ),
contrast, we employ a constraint-based simulation of mechanical where xi represents the local coordinates of the pin on component
assemblies. This allows us to reconstruct the motion of the charac- i, and the vector vj and point xj define the line that the pin should
ter and the driving assemblies in a unified manner, and it enables us lie on. Using two point on line connections between the same pair
to simulate a much broader range of mechanisms, such as assem- of components allows us to model prismatic joints. As for the Pin
blies with kinematic loops, which cannot be simulated using the Connections, we can create three additional scalar constraints to en-
forward kinematics approach employed by [Zhu et al. 2012]. As sure that the two components can only rotate with respect to each
discussed shortly, this approach also allows us to efficiently com- other about one axis.
pute gradients needed to optimize individual sub-assemblies.
The components of an assembly are linked to each other through 3.2 Simulation
different types of connections. Each connection c outputs a set of
scalar constraints Cc . We have implemented four types of connec-
tions that, when combined, allow us to simulate a wide variety of To run a simulation step, we first advance the phase of the Input
mechanical assemblies: Driver forward in time. We then solve the following optimization
problem in order to compute component state values that satisfy all
the constraints:
1
min CT C, (1)
s 2
4 Mechanism Design
Our interactive design system allows users to sketch a set of curves
that specify the motion of different parts of the input character.
For each of the input curves, our system outputs optimized driv-
ing mechanisms that are attached to the character and control its
motion. Two problems need to be addressed in order to achieve Figure 4: We assume as input a library of parameterized driving
this. First, out of a library of input driving mechanism types, our mechanisms such as the ones illustrated here. These building blocks
system must choose an appropriate one. Second, the parameters of are instantiated by our framework, optimized and attached to the
the selected mechanism must be optimized in order to best match input character, driving its motion. The locations of the attachment
the motion specified through the input animation curves. points are highlighted.
∂Ft ∂x ∂x ∂st T
=( + ) (x(p, st ) − x̂t ), (3)
∂p ∂p ∂st ∂p
that a marker point specified on the character should follow a user- We minimize Eq. (2) by evaluating the matching objective and its
provided curve as closely as possible. The marker can either coin- gradient at a discrete number of points (i.e., t values). To improve
cide with the attachment point of the driving mechanism, or it can convergence rates we use the BFGS quasi-Newton method to esti-
be located at an arbitrary point on the character, as illustrated in mate the approximate Hessian ∂p ∂ ∂F
[Nocedal and Wright 2006].
∂p
Fig. 5. To optimize the resulting motion, we minimize the follow-
ing objective as a function of the mechanisms’s parameters p: 4.3 Timing control via non-circular gears
Z 1
1 Controlling the timing of motions is an integral part of character
F = (x(p, st ) − x̂t )T (x(p, st ) − x̂t )dt, (2) animation. We therefore also allow users to explicitly control the
2 t=0
timing of the characters’ motions. This is accomplished through
where t is the phase of the Input Driver, such that when t = 1 a full the use of non-circular gears, which are always used in pairs: a
cycle of the animation has been completed. x(p, st ) and x̂t denote constant angular velocity input signal applied to the first gear gets
the position of the marker point and its target position at phase t. transformed to variable angular velocity for the second gear. The
The state of the assembly at phase t, st , is computed by minimizing phase-dependent ratio of angular velocities of the two gears de-
Eq. 1 after instantiating the mechanism with the current set of pa- pends on the shape of their profiles, and in particular, on the ra-
rameters p. As the parameters of the mechanisms directly affect the tio of the gears’ radii at the point where they mesh. Asking users
connections between the different components, for the remainder of to directly provide the phase-dependent ratio of angular velocities,
this section we write the system constraints as an explicit function however, is not intuitive, as the integral of this ratio needs to re-
of the parameters and the state variables i.e. C(p, st ). main constant (otherwise one gear rotates more than the other over
a full cycle). Instead, we allow users to define the relative phase
Note that in Eq. (2), we use a point-based metric to measure the profile between the two gears, as illustrated in Fig 6 (left). This is
similarity between the input and output motion curves, rather than accomplished by allowing the user to set samples (α1i , α2i ) that
Let ci and cj denote closed, planar polygonal curves and let fi
and fj denote their corresponding feature vectors. We define the
distance metric as
p
d(ci , cj ) = ||fi − fj ||A = (fi − fj )T A(fi − fj ) ,
6 Character Finishing
Once the driving mechanisms that generate the desired motion of
the character are designed, three more steps have to be performed
before the character can be manufactured: the mechanisms have to
be connected to an input driver using intermediate gears (Sec. 6.1),
the assembly needs to be edited to ensure there are no collisions be- Figure 7: Types of connections generated during interactive gear
tween the various moving parts (Sec. 6.2), and a support structure layout: sequential (yellow), parallel (red), and combined (green).
that holds all components in place has to be designed (Sec. 6.3).
Gear Parameter Optimization The gear layout step provides us
with a number of ng interconnected gears, each of which we assign
five degrees of freedom pi = (x, y, z, r, ω)T , where x, y and z
are the gear’s coordinates, r is its radius, and ω its angular velocity. A
Without loss of generality, we assume that the z-axis is normal to
the surface of the gears. We convert the connections between the
B
gears into a set of equality constraints Ci and inequality constraints
Ii , as well as a number of ng objective terms Fi .
A sequential connection between two gears gi and gj is defined by
three constraints that ensure the gears mesh properly:
A
B
depth
Cseq (pi , pj ) = zi − zj
ω
Cseq (pi , pj ) = ri ωi + rj ωj
C
mesh
p
Cseq (pi , pj ) = (xj − xi )2 + (yj − yi )2 − (ri + rj ) .
The first constraint requires the gears to lie in the same plane (one Figure 8: Left: component placement in different planes to remove
could also take into account the thickness of the gears by formulat- collisions. Right: types of collisions that can occur between com-
ing corresponding inequality constraints instead). The second con- ponents.
straint requires that the relative angular velocities of the two gears
is correct, whereas the third one ensures that the distance between
them is equal to the sum of their radii. We model parallel gear con-
nections with four constraints, is very challenging, and it would require a close integration with
the mechanism design phase. While conceptually clean, this ap-
y
Cpar (pi , pj ) = yi − yj , x
Cpar (pi , pj ) = xi − xj proach would prevent us from treating sub-assemblies in isolation,
ω thus rendering the optimization process significantly more com-
Cpar (pi , pj ) = ωi − ωj plex. For assemblies where all the components move along parallel
depth
Ipar (pi , pj ) = zj − zi − h planes, and many of our results fall in this category, we can how-
ever address the intersection problem automatically by offsetting
each component along the direction normal to this motion plane.
The first two ensure that the gears are aligned correctly, the third
one asks that they have the same angular velocity, since both gears Overview We aim to place each component in a different plane,
are welded to the same support shaft, and the last constraint requires such that as the animation is playing, the assembly remains
that the gears should not be closer than the average gear thickness collision-free. We discretize the 3D space occupied by the assembly
h. In addition to these connections, we create non-intersection con- into layers that are parallel to the plane along which the components
straints for all pairs of gears that are not connected. To this end, are moving (Fig. 8, left), and we assign each component a layer (or
we convert the distance constraint from above to inequality form plane) index. We start the process by checking for collisions be-
and add a small negative safety threshold in order to prevent gears tween each pair of components (gears, linkages, and body parts of
from being too close to each other. We switch these constraints on the character) that were assigned the same layer index. Note that we
whenever two gears are closer than the gear thickness in the z di- do not need to deal with gear-gear collisions, since we apply non-
rection. Finally, we introduce inequality constraints in order to en- intersection constraints to all pairs of gears in the gear parameter
force a minimum admissible gear radius as well as unary equality optimization stage of the pipeline (Sec. 6.1). We perform standard
constraints that fix the parameters of gears that have been optimized collision checks between the triangle meshes of the components,
by previous user operations. after projecting them onto the motion plane. The two basic types
Given these constraints, we compute optimal gear parameters p by of collisions that may occur are shown in Fig. 8 (right): on the
solving the constraint optimization problem top, components A and B are detected as colliding; on the bot-
tom, component C is detected as colliding with a pin that connects
ng
X components A and B. For the first example, components A and B
p = arg min ((r̃i − ritarget )2 + kreg ||p̃i − p̄i ||2 ) (9) cannot be assigned to the same layer, while for the second exam-
p̃
i ple, component C cannot lie in a layer between those assigned to A
s.t. Ci (p̃) = 0 and Ii (p̃) ≥ 0 , and B. We solve the layer assignment problem using boolean op-
timization, a variant of discrete constrained optimization, with the
where ritarget denotes a user-provided (or otherwise automatically non-intersection conditions as constraints.
inferred) desired radius for gear i, kreg is a small regularizer coeffi-
cient, and p̄ represents the set of initial parameters. Since some of Algorithm With n components and m layers, there are mn pos-
the constraints are nonlinear, we solve (9) using a standard sequen- sible layer assignments, since each component can be placed in any
tial quadratic programming solver. of the layers. Even for relatively small problems, brute force ap-
proaches are intractable. One option for solving this problem is
6.2 Collision-free Layering for Planar Motions with integer programming, which can work quite well especially
if the problem is linear. Some of our constraints, however, are
Up to this point, no measures were taken to prevent different mov- non-linear. The non-linearity is due to the second type of con-
ing parts of the assembly from intersecting with each other. Our straint shown in Fig. 8, which states that a variable cannot lie be-
framework allows users to intuitively edit the assembly by indepen- tween two other variables, a disjunctive constraint expressed as
dently moving the driving mechanisms if intersections are detected. (C < A) ∨ (B < C). We therefore pose this as a constraint satis-
However, it would be desirable to also provide an automatic solu- faction problem (CSP) for which there are efficient, robust solvers
tion to this problem. For general three-dimensional motions, this for the scale of problems that we are interested in.
The CSP formulation assumes that we already know the number video, and they are summarized in Table 1. Before presenting our
of discrete layers m. Since this number is typically not known a results, we first validate some important design choices and discuss
priori, we seek to find the minimum number of layers such that all alternative approaches.
components can be laid out without collisions. We start by setting
m = 4 and increment until we obtain feasible solutions. Usually, 7.1 Validation
there are multiple solutions once a feasible m is found. By re-
peatedly running the constraint solver, we obtain a set of feasible Metric Comparison In order to compare the matching quality
solutions, and select the one that minimizes the total length of the of our metric to alternative measures, we created a set of hand-
pins connecting the components of the assembly. We then estimate drawn curves and retrieved the closest one for each of them from
the thickness of each layer as the maximum thickness of the com- a database containing 1000 randomly generated samples each for
ponents assigned to it and offset each component to the center of a four- and a five-bar linkage. Fig. 9 shows the best matching
the layer it was assigned to. curves (in red) for three different metrics: our feature-based metric
The worst-case running time for the CSP solver is exponential. with optimized coefficients (first row), the discrete Fréchet distance
However, even for our largest examples, which consists of close [Eiter and Mannila 1994] (second row) and our feature-based met-
to 100 components and more than 10 layers, an off-the-shelf CSP ric with all coefficients set to 1.0. While the two alternatives found
solver (Walksat [Selman et al. 1993]) using default parameters was reasonable curves in many cases, some of the matches (e.g., row
able to generate 1000 random solutions in less than 30 seconds. 2, column 2 or row 3, column 4) are clearly off. Although rank-
For comparison, a naive random search was unable to find a single ing the perceived similarity is difficult, our optimized metric yields
solution within a reasonable amount of time (several hours). well-matching curves in all cases.
for the same character. Our interface supports this style of motion
design by providing the user with intuitive ways to select driving
mechanisms that trace out desired motion curves and to adjust the
velocity profile along these curves. The latter is essential for creat-
ing the characteristic motion of EMA gallop, which our framework
implements using non-circular gears that directly control the timing
of the foot-falls.
Even when the individual driving mechanisms are restricted to pla-
nar trajectories, users can create compelling 3D motions by com-
bining components that operate in different planes. An example of
this can be seen in the side-to-side tail and body sway of the TRex
character shown in Fig. 11. Moreover, if the types of driving mech-
anisms available in the input library are capable of generating non-
planar motions, they can also be used within our framework. How-
ever, to fully exploit the pipeline we present, two changes would be
required: the curve distance metric (Sec. 5) should be extended to
operate on 3D curves, and the automatic method we use to ensure
that components do not collide with each other (Sec. 6.2) should Figure 10: PushingMan.
be revised to handle arbitrary 3D motions. The rest of our pipeline
does not need to be altered, and we used non-planar driving mech-
anisms to create the Scorpio character (Fig. 15). For this example
we optimized the dimensions of the leg concurrently with the other
parameters of the driving mechanism in order to obtain a desired,
non-planar trajectory. This mechanism has 23 parameters in to-
tal, but optimizing it took only about 2 minutes. We instantiated
the optimized leg six times and created a walking animation us-
ing physics-based simulation on the resulting mechanical assembly
(see accompanying video).
Many of our characters such as EMA, Pushing Man and TRex have
external gear boxes that are located below the characters. However,
our framework also allows the user to design mechanical assemblies
in which the gear boxes are internal to the character, as evidenced
by the Froggy and Clocky (Fig. 14, right) examples. Integrating
the gear box within the character allowed us to design free-roaming
examples such as Bernie (Fig. 12) and DrillR (Fig. 1, right).
Our system detects and reports failures at various stages in the de-
sign pipeline, for example, if the assembly is over or under con-
strained, or if there are collisions between the components of a non-
planar assembly as the animation is playing. The user is currently
expected to manually edit the assembly in order to fix these prob-
lems. An interesting direction for future work is to address such
problems automatically, or to provide helpful hints to guide the user
in addressing them in an optimal manner.