Aug 28, 1998 - features. In Section4 some needed concepts from graphics and network .... Power Animator 2] Alias/Wavefront software from Silicon Graphics.
Web-based approach for very complex animations through geometric programming C. Bajajy, C. Baldazziz, S. Cutchiny, A. Paoluzziz, V. Pascucciy and M. Vicentinoz z
y Texas Institute for Computational Dipartimento di Informatica e Automazione and Applied Mathematics Universita di Roma Tre University of Texas at Austin August 28, 1998
1 Introduction In this work a high-level animation methodology oriented towards building, simulating and analyzing very complex 3D scenes is de ned. The de nition of the methodology is oriented towards ful lling two goals. The rst goal being the creation of a compact and clear de nition of complex animated geometric environments. The second goal is that such animated geometric environments can be easily updated, and that dierent animation hypothesis be easily compared and analyzed. We experiment the methodology in two settings. First we use a simple Open Inventor based animation viewer to allow local display of the animations on any system including low-cost PC's. Second we experiment a web-based visualization framework that uses as key component an animation server implementing the introduced methodology. The compactness of the language representation used turns out to be an important advantage when used for transmitting geometry and animation information over the network. Towards this end we have extended the academic language PLaSM [12] for geometry modeling, recently integrated into the collaborative and distributed 3D toolkit Shastra [3], with the ability to generate platform-independent animated scene descriptions capable of be read by low-level animation systems, such as the Shastra animation module Gati [4], or Open Inventor [17], in the following denoted as OIV. The animation methodology introduced here is implemented as an extension of the PLaSM language, The work of these authors was partially supported by CERTIA, Research Consortium based at University of Rome, Tor Vergata.
1
providing a hierarchical description of scenes and capable of being exported to many generic animation engines. The construction of complex animations involving the comparison of complex scenes using minimal man-hours and low-cost hardware motivated the present approach. In addition it was noticed, by studying the animation software market, that the currently available tools either require skilled C++ programmers (when using class-based 3D toolkits like Open Inventor) or very skilled animators (when using speci c tools such as Power Animator, Lightwave or Maya), or even both. Therefore, a programming approach to animation is discussed that provides simple but powerful animation capabilities as extension of a geometric design language, so that both geometry design and animation can be performed in a uniform scheme. This goal is best accomplished in a geometric programming framework since animations are \programmable" as any other geometric information. In this way any designer or scientist may quickly de ne and simulate complex dynamic environments, where movements are described by using well-established methods of mathematical physics and solid mechanics. For very complex scenes, where typically more then one user need to cooperate to design the same dynamic environment, we develop a collaborative web-based interface where multiple client applications can interact with the same scene. Due to the compactness of the shared information multiple users, possibly distributed in a wide area network, can interact with the same animated scene either synchronizing their views or working with independent focus on dierent aspects of interest or competence. This provides a sheared workspace that easy the animation process and reduces its production time and cost. The paper aims also to demonstrate the great advantages of the use of a geometric programming approach. We show that using a declarative functional language like PLaSM may be very useful in both quickly implementing a very complex animation and in testing new animation methods. At this purpose, look at the solution proposed for describing the storyboard of very complex animations and computing the relative time constraints between dierent animation segments. Notice that a full \choreographic control" is achieved by implementing a \ uidity constraint" of the whole animation, which holds for any possible choice of expected durations of animation segments. The paper is organized as follows. In Section 2 a set of concepts and de nitions from the animation eld is given. In Section 3 the more interesting commercial softwares on the animation market are succinctly described, in order to abstract their common features. In Section4 some needed concepts from graphics and network programming are recalled. In Section 5 the design goals and implementation directions of the PLaSM 2
extension are quickly outlined. In Section 6 the static and run-time architecture of web-based Shastra's animation services are discussed. In Section 7 a complete implementation of a non trivial animation example is given and discussed. In the Conclusion section the on-going extensions to the described animation environment are outlined.
2 Methodology The animation methodology proposed in this paper is speci ed here. In order to focus the main aspects of the animation problem several de nitions are given. Most of them are quite standard in the animation eld, but it seems useful to provide a precise meaning to concepts used in the remainder of this work.
Animation An animation is a pair . A graphics scene is here
de ned as a function of some real parameters, with values in some suitable data type. Each feasible set of parameters de nes a con guration of the scene. A pair is a state of the animation. The product of the time domain times the con guration space gives the state-space of the animation. The animation behaviour is a curve in animation state-space.
Each part of the scene may change in time with respect to position, orientation, modeling parameters (e.g. the geometric handles of a curve or surface) and may even change its internal assembly structure.
Background The scene part which is time-invariant is called the background. Foreground The time-varying portion of an animated scene is called the foreground. So, any animation is the union of its foreground and a background, which is possibly empty. When exporting a scene from PLaSM both components will produce a suitable description of a hierarchical scene graph. In fact, both the background and the foreground are internally represented as a hierarchical graph. A new data type produced by a language primitive called XSTRUCT (for eXtended STRUCTure) was at this purpose introduced in PLaSM. In particular, exporting a XSTRUCT expression produces a set of geometry les (either .wrl, or .iv, or others), whereas exporting a MOVE expression also produces a set of motion les, to be interpreted by a generic animation engine.
Storyboard The high-level description of the animation behaviour is called the storyboard. It is represented as a hierarchical a-cyclic graph with only one node of in-degree 3
zero (called start or source node) and only one node of out-degree zero (called end or sink node). The source node will represent the animation start. The sink node will represent the animation end. The nodes and arcs of the storyboard are also called events and animation segments (or simply segments), respectively.
From an abstract viewpoint, the storyboard states a hierarchical partitioning of the animation behaviour (and scene) into independent components. In other words, the storyboard partitions the animation into largely independent \segments" and speci es both time constraints between such components, and the projection curves of the animation behaviour into lower-dimensional subspaces associated to segments.
Segment A segment is an arc of a storyboard. It represents a foreground portion
characterized by the fact that every interaction with the remaining animation is concentrated on the starting and ending nodes of the segment, i.e. on the starting and ending event.
Hence each segment may be modeled independently from the others, by using a local coordinate frame for both space and time coordinates. The concepts of storyboard and segment are interchangeable, in the sense that each complex segment of an animation can be modeled by using a local storyboard, which can be decomposed into lower-level segments. Every elementary segment, i.e. those without a segment storyboard, are characterized by a geometric model, by a behaviour and by a dynamic model. Both the geometric model and the behaviour are implemented in PLaSM, whereas the dynamic model is generated at run-time by the language interpreter by writing a suitable le format to be interpreted by the tool which automatically generates the animation. Every animation segment are associated with a time length (duration), directly introduced by the user for elementary segments, or computed by using the segment storyboard and a suitable algorithm. In particular, the computation of the critical path (i.e. the longest-time-path) of the storyboard network, can be used for this purpose. According to standard PERT methods, each segment of a storyboard may be de ned as either of type earliest start, or latest end or both, to denote the speci c time constraints on the animation segment. Every segment, thus the whole animation foreground, will possess its own dynamical model. This will be automatically generated by the PLaSM interpreter starting from the pair (generating function, behaviour) of the segment.
Event An event is a storyboard node. The segments starting from it may begin only 4
when all the segments ending in it have nished their execution.
Each event k is associated to a minimal spanning time tk and to a maximal spanning time Tk , de ned and computed as shown in Section 4.
Geometric model The geometric model of a segment is a description of both the
assembly structure and the geometry of its elementary parts. In PLaSM every geometric model results from the evaluation of some polyhedrally typed expression.
Geometric models are implemented in PLaSM as Hierarchical Polyhedral Complexes (HPC) [13]. Such a model may be exported as either VRML or OIV le. Container nodes of VRML/OIV les provide the geometric components for the dynamic model of storyboard segments. The geometric model of a foreground segment must provide some Degrees Of Freedom (DOFs) i.e. some unbounded parameters, often corresponding to parameters of ane transformations. Such a segment will be suitably exported using the MOVE primitive described in Section 5.2. The unbound parameters constitute one of main components of the motion le associated by the PLaSM interpreter to the foreground segments, identi ed as such by the user when applying the MOVE primitive.
Behaviour A continuous curve in segment con guration space XCS is called a behaviour of the segment. The segment con guration space is de ned as XCS = [0; 1] CS
where CS is the product space of the interval domains of segment DOFs, and [0; 1] is the time domain.
The d + 1 dimension of an XCS is related to the number d of unbound parameters of the geometric model of the segment. In order to represent a behaviour, sampled curves or splines of suitable degree, parameterized in the [0; 1] domain, will be used in PLaSM. A simple and often useful choice is to use Bezier curves for representing behaviors. In such a case the behaviour is completely speci ed by some points in XCS . In particular, any Bezier curve interpolates the rst and last points and approximates the other ones. The curve degree is de ned by the number of points minus one. So a linear behaviour will simply be described by giving two extreme points in XCS . If b : [0; 1] ! XCS; with b(u) = (b0(u); b1(u); : : :; bd(u))
is such a behaviour curve, then a quite obvious constraint is that it must be b0(uk ) > b0 (uh )
for each uk > uh : 5
The behaviour curves are implemented in PLaSM by using parametric curves and splines. The starting and ending times are implicitly computed by using the dynamic programming formulas recalled in Section 4.4. Conversely, the times associated with the interior control points may be given in relative time, usually equi-spaced in order to obtain a uniform time parameterization (i.e. a constant speed) of the curve. The sampled behaviour, i.e. a discrete and nite set of XCS points, will be exported to an external animation software, where a suitable engine will linearly interpolate between any pair of adjacent samples.
Actor We call an animation actor (or character) a connected chain of segments with
the same geometric model and with dierent behaviors. So, at any given time each actor has a unique xed set of parameters, i.e. a unique con guration.
Notice that the consequent behaviors of an actor are de ned as dierent curves in the same XCS . In fact, since the geometric model is invariant, the segment con guration space is also invariant. The dierent curves correspond to the events where the considered actor interacts with other actors, according to the storyboard.
Modeling and animation cycle To de ne a complex animation requires the following typical steps:
Problem decomposition into animation segments, and de nition of the storyboard as a graph.
Modeling of geometry and behaviour of the animation segments. Each segment will be modeled, animated and tested independently from each other.
Non-linear editing of segments by describing in PLaSM their events and time rela-
tionships (look at example of Section 7). The segment coordination is obtained by using the critical path method from PERT.
Simulation and parameter calibration of the animation as a whole. Feedback with possible storyboard editing, with the starting of a new cycle of modeling, editing, calibration and feedback, until a satisfying result is obtained.
3 Commercial animation software In this section we report the characteristics of the most diuse animation software. We concentrate only on the animation capabilities even when they oer also modeling tools. 6
Power Animator [2] Alias/Wavefront software from Silicon Graphics. It runs on
SGI and IBM platforms. It allows to animate objects, lights, cameras, surface properties and shading parameters. The basic tools de ne animations on the basis of key-frames and motion paths. It solves inverse kinematics problems. The user interface allows interactive de nition and editing of parameters curves. Interactive tools allow also ne tuning of the interaction among actors and with the background. It allows also to emulate physical phenomena like gravity, friction, turbulence or collisions. Advanced features include automatic generation of 3D solid and gaseous particles interacting realistically with the environment or automatic construction of transitions between segments with motion of animated actors.
Maya [1] Silicon Graphics Alias/Wavefront software for intuitive animation of syn-
thetic characters. The user can de ne the character behaviors using bye mean of hierarchical controls. The mechanism includes hierarchical deformations, inverse kinematics, facial animation, skinning tools. It provides a wide number of special eects and includes the scripting language MEL. MEL allows the user to de ne behaviors and controls for each character, including dynamic eects, modeling and procedural animation. It also provides a C++ API that allows to modify a number of functionalities as needed by the user.
LightWave [11] Software of the NewTek that runs on a wide number of platforms
including Silicon Graphics, Macintosh PowerPC, Windows NT and workstation Sun. The system is mostly modeling and rendering oriented (e.g. real-time transformation of polygonal surfaces into NURBS). It emulates the traditional approach of the animator. It provides advanced features for animation of characters, like automatic lips control as well as emotion-based face characterization. Advanced modeling features for modeling transitions are based on morphing techniques. Advanced features are also provided for dealing with evolving illumination and the de nition of dynamic systems of particles. The animations can be de ned through the scripting language L-script.
Electric Image [6] Electric Image software that runs on Silicon Graphics, Macin-
tosh PowerPC and Windows NT. It allows editing of parameters curves as a modeling tool of all the characteristics of one or more objects (spline and Bezier curves are typically used). 3D models can be build directly from their skeletons and shape transition performed through morphing techniques. Inverse kinematics can be also used. Ad hoc feature are available for sky and backgrounds. Automated synchronization of movements and sound. 7
Houdini [14] Software from Eects Software that runs Silicon Graphics, IRIX 6.x
platform. It is the new version of the animation software 3D PRISM already widely used. It is a procedural animation system that integrates multiple capabilities including: surface modeling, animation, materials, illumination, rendering and video editing. It provides a scripting language, a language for mathematical de nitions and a SDK for system capability customization. The procedural paradigm is implemented through a friendly user interface with a data- aw like structure.
3D Studio Max [10] Software of the Kinetics (Autodesk division) that runs on
Windows NT. It oers a uni ed environment for modeling, animation, illumination, rendering and video compositing. It is an object oriented environment with a exible animation control system where every feature is editable and extensible. It is provided along with each license of MAX SDK. It has a large library of plug-ins with advanced NURBS support and features complete input-output functionalities for VRML and animated VRML.
SoftImage V3.8 [15] Software of the SoftImage (Microsoft company) runs on Win-
dows NT platform. Beyond the classical features of integrated modeling, animation and rendering the software oers a high level interface for sequencing action, or sets of animation data, along the time axis. This allows easy animation editing of segmented hi resolution characters. If provides advanced features for skinning and inverse kinematics of physically based characters. Performs automated reduction of of polygonal models and colors and interactive tools for texturing and painting even on NURBS surfaces.
Sumatra [16] Software of the SoftImage based on a new generation 3D system
with new release by the end of the year. It rst introduces application of Non Linear Animation (NLA). The controls are completely scalable allowing the user to work at any desired level of detail. From the low level editing of single curves to the high level parameter of the entire Animation. Includes all the functionalities of the previous SoftImage V3.8 but with the use of the NLA introduces a new editing paradigm allowing local control of the animation completely independent from the timeline. In this way the user can work both with single and multiple animation sequences. This better allows to partition a complex animation in simple components which can be reorganized, scaled or composed to create more complex animations. The characters can be designed describing multiple interactions allowing the designer to betters focus on the global aspects of the animation instead of the low level details.
8
4 Background This section presents necessary background information for understanding the material presented in this paper. First the PLaSM model of functional programming is described, then the important graphics concepts of hierarchical assemblies and parametric curves are recalled, nally the main concepts of network programming, including critical path method, are brie y described.
4.1
PLaSM
model of computation
The PLaSM language [12] is a geometry-oriented extension of a subset of the functional language FL [5]. Generally speaking, each PLaSM program is a function. When applied to some input argument each program produces some output value. Two programs are usually connected by using functional composition, so that the output of the rst program is used as input to the second program. The composition of PLaSM functions behaves exactly as the standard composition of mathematical functions. E.g. the application of the compound mathematical function f g to the x argument (f g )(x) f (g (x)) means that the function g is rst applied to x and that the function f is then applied to the value g (x). The PLaSM denotation for the previous expressions would be (f g) : x f : (g : x) where stands for function composition and where g:x stands for application of the function g to the argument x. In PLaSM, a name can be assigned to a geometric model by de ning it as a function without formal parameters. In such a case the body of the function de nition will describe the computational process which generates the geometric value. The parameters which it depends on will normally be embedded in such a de nition. For example we may have DEF object = (Fun3
Fun2
Fun1):parameters;
The computational process which produces the object value can be thought as the computational pipeline shown in Figure 1. In several PLaSM scripts the dependence of the model upon the parameters is implicit. In order to modify the generated object value it is necessary (a) to change the source code in either the body or the local environment of its generating function, (b) to compile the new de nition and (c) to evaluate again the object identi er. 9
object
fun3
fun2
fun1 parameters
Figure 1: Example of computational pipeline. A parametric geometric model can be conversely de ned, and easily combined with other such models, by using a generating function with formal parameters. Such kind of function will be instantiated with dierent actual parameters, so obtaining dierent output values. It is interesting to note that such a generating function of a geometric model may accept parameters of any type, including other geometric objects. For a list and meaning of pre-de ned PLaSM operators, the interested reader should read paper [12]. Anyway, most of times the operator meanings are consistent with their names.
4.2 Hierarchical structures Hierarchical structures are a fundamental graphics concept. A structure is inductively de ned as an ordered set (sequence) of structures, ane transformations and elementary geometric objects. The semantics of the structure concept is very simple. Every ane transformation contained in a structure is (ordinarily) applied to all the subsequent objects which follow it in the sequence. This application returns a sequence of geometric objects all lying in the same coordinate frame, when originally they were independently de ned using local coordinate systems. Structures are represented as oriented acyclic graphs. In particular, each structure is associated with a node, whereas the elements in its sequence are represented as the child nodes of the parent node. The structure n = S;
with
S = fn1 ; n2; : : :; nk g;
is therefore implemented as an oriented graph with nodes fng [ S and arcs fng S: A structure network 1 or hierarchical scene graph 2 is simply the union graph of the subgraphs of the dierent structures. Such a graph is not necessarily a tree, since the same node may have more than one parent node at an upper level. 1 2
ISO/PHIGS terminology SGI/OIV and VRML terminology
10
A traversal algorithm linearizes such a graph, suitably transforming all the geometrical objects, each one de ned in a local coordinate frame, into the coordinate frame of the root, often called world coordinate system. Such a traversal is often performed by some prede ned viewer available in the chosen toolkit (e.g. in Open Inventor) and is executed at a frequency of at least 20 fps to achieve uid animation. The animation eect is obtained when some of geometric parts of the scene change position, orientation or internal con guration. Such change is often implemented by editing the internal values of parameters of some ane transformation. It is therefore necessary that such parameters be identi ed as such by the PLaSM++ interpreter.
4.3 Polynomial Parametric Curve A polynomial parametric curve is a vector-valued function of a real variable u, obtained by the combination of some control points with the elements of a suitable polynomial basis in the u variable. In particular, a Bezier curve c of degree n is a polynomial combination of n + 1 control points qi 2 E d : n X c : < ! E d : c(u) = Bin (u) qi; i=0
where the blending functions Bin : < ! < are the Bernstein polynomials: ! n i n Bi (u) = u (1 ? u)n?i : i Notice that the image c(u) of the curve is a continuous set of points in the same space that qi control points are de ned, which synthetically describe the curve shape. Remember also that a Bezier curve interpolates the rst and last control points, and approximates the intermediate control points.
4.4 Network programming In order to independently edit the developed animation segments as a whole, we propose the use of network programming techniques, and in particular the dynamic programming algorithm of deterministic PERT to compute minimal and maximal times of events as well the completion time of the whole project. Since the animation storyboard is represented as a network, this algorithm can be used to coordinate in time the animation of the various actors, according to the framework discussed in Section 2. The PERT (Program Evaluation and Review Technique) [9], also known as Critical Path Method, is well known for managing, i.e. programming and controlling, very complex projects and in particular for scheduling and optimum allocation of resources. The 11
2
3
4 8
1 4
7
1
6 5 2
9 3
5 6
Figure 2: Directed a-cyclic graph used to represent a set of coordinated activities. Labels of arcs represent the expected durations. controlled projects may have tens or hundred of thousands of activities and events. Deterministic PERT for computation of critical activities is probably the most well known variation of network programming techniques, in which a bundle of inter-dependent activities is represented as a directed a-cyclic graph. This graph is then used as the computational basis for analysis and forecasts. The network of activities is used to schedule their execution as well as the allocation of resources. In particular the network model allows for computation of the expected date of project completion, as well as discovering the critical path, i.e. the set af activities where no wasted time occurs. Such types of network programming techniques also allow for scheduling the starting and nishing dates of activities using only their expected durations as input. Such techniques can be directly used to coordinate the time execution (jargon: to perform the non-linear editing) of independently de ned animation segments, according to framework of Section 2. The network representation of a project as well as the computation of minimal and maximal dates of events are quickly recalled in the next paragraphs.
Project Representation A project is represented as a network, i.e. a directed acyclic
graph with just one source node and just one sink node. The source node represents the project start; the sink the project end. The arcs represent the project activities; the nodes represent the events of completion of all the entering arcs. Notice that activities (arcs) exiting from a node may start only when all the activities (arcs) entering that node have nished. Some main concepts of critical path method are described below.
Minimal spanning time (tk ) of a node k is the minimal time for completing the activities entering the node k. Notice that such activities can be completed into this date.
12
Tik
i
ti
k
k
tk
Tk
Tki
T ij
Sij
i
Ti t
Tj
i
time
(a) (b) Figure 3: (a) Graphics representation of forward and backward computations; (b) scheduling of the (i; j ) activity in the feasible time interval.
Maximal spanning time (Tk) of a node k is the maximal time for completing the
activities entering the node k. Notice that such activities must be completed into this date.
Critical path method The more important computation concerns minimal and
maximal spanning times of nodes. The dynamic programming algorithm is very easy: tk = max fti + Tik g;
Tk = min fTi ? Tki g
i2pred(k)
i2succ(k)
There are two subsequent step in the computation, respectively called forward and backward computation.
Forward computation of minimal times tk . Set t = 0. Then try to compute the 0
minimal time te of ending node, i.e. the completion time of the whole project. The recursive formula allows for computing the tk of all nodes.
Backward computation of maximal times Tk . Set Te = te . Then try to compute the maximal time T0 of starting node. The recursive formula allows for computing the Tk of all nodes.
Activity slacks The slack Sij of the arc (i; j ) is de ned as the quantity of time which
may elapse without a corresponding slack of the completion time of the project. The activity slack is given by Sij = (Tj ? ti ) ? Tij ; where Tij is the expected duration of the activity (i; j ). The critical activities have empty slacks: Sij = 0. 13
5 Design of the language extension This section outlines the extensions to the PLaSM language implemented for de ning and exporting complex objects which may contain geometry, non-geometric attributes and animations. Such exporting was targeted towards commonly available 3D toolkits. The reference model for such graphics extension of the PLaSM geometric language is the hierarchical scene graph, called a structure network in the ISO graphics standard system PHIGS. From the animation viewpoint the language extensions allow for modeling the different actors and their interactions on the scene, as well as for modeling and simulating the independent behaviours of animation segments. The time assembly of independent animation segments was automatically guaranteed. At this point of the project no interaction or feed-back is allowed from the outside world into the animated scene. The only exception regards the animation of the camera, which is obtained outside the language by using some appropriate viewing tool. In other words the described approach is planned to perform only o-line geometric animations. The previous PLaSM implementation allowed for geometric computations without considering non-geometric attributes such as colors, lights and textures. The current extension introduces such non-geometric features into the language, using as reference a hierarchical scene graph with non-geometric nodes. In particular, colors, lights and textures were added to the language. A basic design decision was that of introducing only small modi cation to the existing language interpreter. The language was so mainly extended by modifying the pre-de ned functional environment. Since a new data type was introduced, careful consideration was given to the new primitives introduced into the language. The fundamental extension is related to the new XSTRUCT operator, which may be applied to both polyhedral complexes and ane transformations, and to new data objects describing non-geometric attributes. It will return data objects of the new internal type XHP C (eXtended Hierarchical Polyhedral Complex). In particular such operators will be applied to any sequence of expressions which may return any kind of data acceptable as nodes of a scene graph, e.g. geometry, colors, lights, materials, textures.
5.1 Static animation with classic PLaSM In PLaSM the animation of a polyhedral scene can be implicitly represented by explicitly giving the degrees of freedom as formal parameters of a function which generates the polyhedral values. 14
x
x α3 α1
α1
-y
α2
α2
-y
α3
Figure 4: Two planar arm con gurations generated by the expressions arm: and arm:. The desired behaviour can also be modeled as a curve in con guration space. The movement can nally be emulated by: (a) sampling the curve; (b) appling the generating function of the shape on each sampled con guration (set of parameters); and nally by (c) aggregating all the resulting polyhedral complexes in a unique structure. The resulting covering of the working space will therefore represent the movement.
Example: Modeling a planar arm Consider the very simple planar robotic arm with three degrees of freedom shown in Figure 4. There are three rotational degrees of freedom, respectively named 1; 2 e 3. Notice that all angles are given in degrees. DEF rod = T:::(CUBOID:) DEF DOF (alpha::IsReal) = T:2:-18
(R::(PI/180 * alpha));
DEF arm (a1,a2,a3::IsReal) = STRUCT:< rod, DOF:a1, rod, DOF:a2, rod, DOF:a3, rod >
Example: Modeling a movement The desired movement is modeled as a cubic Bezier curve de ned by four points in con guration space [?180; 180] < . Such 3
3
curve is shown in Figure 5a. Notice that the Sampling function produces a sampling of the unit interval [0; 1].
DEF CSpath = Bezier:; DEF Sampling (n::IsIntPos) = (AA:LIST
15
AA:/
DISTR):;
-y
α3
z
α
1
α
2
x
(a)
(b)
Figure 5: (a) cubic Bezier curve in con guration space; (b) geometric object generated by the PLaSM expression (STRUCTAA:armAA:CSpath):(Sampling:18) . Such a movement is emulated by applying the arm function to a sequence of 18 curve samples and by accumulating the resulting polyhedral complexes in a structure:
(STRUCT AA:arm AA:CSpath):(Sampling:18)
The result obtained by assembling the resulting set of planer arm con gurations is displayed in Figure 5b.
5.2 Animation with extended PLaSM In order to discuss the extensions to PLaSM which produce the extended design language PLaSM++, the example of the plane robot arm has been enriched with colors and animated according to the behaviour curve already presented. For the purpose of de ning non geometric features as well as de ning and exporting the behaviour of animation segments, we have introduced two new primitives in PLaSM++, respectively named XSTRUCT and MOVE. The XSTRUCT (eXtended STRUCTure) primitive is used to assemble into a hierarchical scene graph both geometric primitives (polyhedral complexes and ane transformations) and non-geometric nodes related to colors, light, materials and textures. The MOVE primitive will conversely be used to de ne generalized and segmented animations. Several new functions have been introduced in the pre-de ned functional environment to emulate the OIV/VRML de nitions of non-geometric features. The result of the evaluation of an XSTRUCT is an external geometry le (either OIV or VRML, according to the user directive). In the user functional environment the le name (or URL) is maintained for use when referenced by other such geometries. An intermediate .motion le (to be used as input to the target animation engine) is instead produced by each evaluation of the MOVE primitive. 16
Example: Modeling arm motion and geometry The extended PLaSM code for
the description of both a colored version of the planar arm and of its motion is given in the following. DEF red = Color:;
DEF green = Color:;
DEF blue = Color:;
DEF white = Color:;
DEF Rod = T:::(CUBOID:); DEF DOF (alpha::IsReal) = T:2:-18
(R::(PI/180 * alpha));
DEF Arm (a1,a2,a3::IsReal) = XSTRUCT: < red,Rod, DOF:a1, green,Rod, DOF:a2, blue,Rod, DOF:a3, white,Rod >; DEF t1 = 10; DEF t2 = t1 + 5; DEF Motion = Bezier:< , , , >; DEF Behaviour = (AA:Motion
Sample):18;
DEF Sample (n::IsIntPos) = (AA:LIST
AA:/
DISTR):;
DEF Animation = MOVE:Arm:Behaviour;
Semantics of MOVE In the following we concentrate on discussing the semantics of
the MOVE primitive. Consider at rst the body MOVE:Arm:Behaviour of the Animation function. First MOVE is applied to a function arm :
; DEF hinge = (MKPOL~UKPOL):(hinge2D * Q:0.5); DEF DoubleHinge = STRUCT:; DEF hbasis = circle:(2*PI):1.2:24 * Q:2; DEF femaleJoint = STRUCT:< T:3:-5:hbasis, T:2:0.85,R::(PI/2):DoubleHinge>; DEF maleJoint
= STRUCT:< R::PI,
T:3:-5:hbasis, T:2:0.25,R::(PI/2):Hinge>; DEF rod = T::: (CUBOID:); DEF JointedRod = maleJoint TOP rod TOP femaleJoint;
Then the lamp basis and head are de ned, where the conic part as well the cylinder part are both generated by using the function TrunCone, whose de nition is given in the Appendix. The head function depends on an implicit integer parameter, which speci es the grain of the polyhedral approximation of surfaces. DEF basis = (circle:(2*PI):basisRadius:32 * Q:basisHeight) TOP femaleJoint; DEF head = STRUCT~[ K:maleJoint, K:(T:3:5), embed:1~circle:(2*PI):4, TrunCone:, K:(T:3:8), TrunCone: ];
Luxo lamp assembly The lamp as a parametric hierarchical geometric model is
de ned as follows. Notice that the oset of joints from their center of rotation is 5, and that a JointedRod contains two such joints. This explains the term 10 in the z translation parameter (rodHeight+10).
DEF Luxo (a1,a2,a3::IsReal) = XSTRUCT:
;
Notice also that the Luxo function has signature ;
Luxo's and friend's paths As we have said, the animation storyboard is given as
a network model, with animation segments associated to the arcs and (coordination) events associated to the nodes. The expected durations of single animation segments are rst given. The dummy segment, drawn as hatched in Figures 8 and 9, are used only as constraints and have duration zero. 22
DEF Time_0_1 = 3;
DEF Time_5_6 = 10;
DEF Time_1_2 = 5;
DEF Time_6_7 = 5;
DEF Time_2_3 = 3;
DEF Time_7_8 = 2;
DEF Time_3_4 = 4;
2
5
3
1
0 0 5
2 0
10
6
4 3
0 5
4 0
7
2
8
Figure 8: Representation of the storyboard as an abstract graph.
Coordination events The minimal and maximal spanning times of storyboard events can be directly computed by looking at the storyboard network, shown in Figures 8 and 9. The minimal times ti are denoted as t0,...,t8; The maximal times Tj are denoted as tt0,...,tt8. DEF t0 = 0;
DEF tt0 = tt1-Time_0_1;
DEF t1 = t0+Time_0_1 ;
DEF tt1 = RMIN:;
DEF t2 = RMAX:;
DEF tt2 = RMIN:;
DEF t3 = RMAX:;
DEF tt3 = tt4-Time_3_4;
DEF t4 = t3+Time_3_4 ;
DEF tt4 = t4;
DEF t5 = t1;
DEF tt5 = tt6-Time_5_6;
DEF t6 = t5+Time_5_6 ;
DEF tt6 = RMIN:;
DEF t7 = RMAX:;
DEF tt7 = tt8-Time_7_8;
DEF t8 = t7+Time_7_8 ;
DEF tt8 = tt3;
Example of curve in segment CS One of the con guration space curves of the
storyboard segments is given in the following. It is here generated as a Bezier curve of degree 3 in a con guration space of dimension 6. The PLaSM function generating Bezier curves of any degree in any d-dimensional space is given in the Appendix. The remaining CS curves are also given in the Appendix. DEF CSpath_0_1 = AA:((Bezier~AA:XCAT):< ,
23
7
2
3
6
8
1
0 4 5
Figure 9: Projection in E 2 of the storyboard embedded in con guration space. ,
> );
Choreographic control The timing of the (i; j ) segment of the storyboard may be
computed by using either minimal or maximal spanning times for the starting and ending events of the segment. If the (ti ; ti + Tij ) pair is used, then the segment is executed \earliest". If the (Tj ? Tij ; Tj ) pair is instead used, then the segment is executed \latest". More interesting, when the pair (ti ; Tj ) is used, the segment timing is automatically adapted to the nish and start times of the incident segments. If such choice is done for all the \critical" segments, i.e. for all segments on the critical path, their animation will be executed as completely uid, and no actors must stop and wait for restart in such storyboard segments. This choice cannot by directly assumed for non-critical segments, since if (h; i), (i; k) are two incident non-critical segments, it would be Ti 6= ti , so that the timing given by (th ; Ti) and (ti ; Tk ) would produce a time overlap for their execution. 24
A good solution is that of assuming for all events the timing given by their average spanning time, i.e. to use the timing (tmi ; tmj ) for each segment (i; j ), with ti + T i ; tm i =
for all i (1) 2 This clearly implies tmi = ti = Ti for critical events, and prevents from time overlaps for non-critical events. It is very important to notice that the \ uidity constraint" of the whole animation induced by Formula (1) holds for any possible choice of expected durations of animation segments. DEF tm0 = (t0 + tt0) / 2;
DEF tm5 = (t5 + tt5) / 2;
DEF tm1 = (t1 + tt1) / 2;
DEF tm6 = (t6 + tt6) / 2;
DEF tm2 = (t2 + tt2) / 2;
DEF tm7 = (t7 + tt7) / 2;
DEF tm3 = (t3 + tt3) / 2;
DEF tm8 = (t8 + tt8) / 2;
DEF tm4 = (t4 + tt4) / 2;
Scene animation The whole animated scene can be nally generated by just evaluat-
ing the following PLaSM de nition, which contains a MOVE expression for each storyboard segment. A number of 10 behaviour samples is here generated for each segment. DEF SceneAnimation = ANIMATION:< MOVE:mobileLuxo:(behaviour::CSpath_0_1:10), MOVE:mobileLuxo:(behaviour::CSpath_1_2:10), MOVE:mobileLuxo:(behaviour::CSpath_2_3:10), MOVE:mobileLuxo:(behaviour::CSpath_3_4:10), MOVE:mobileLuxo:(behaviour::CSpath_5_6:10), MOVE:mobileLuxo:(behaviour::CSpath_6_7:10), MOVE:mobileLuxo:(behaviour: :CSpath_7_8:1) >; SceneAnimation;
Segment sub-timing The approach shown in this paper allows also for any subtiming of segments, according to the degree of the Bezier map [0; 1] ! [0; 1] used
for generating the time samples to be passed to the MOVE primitive. This gives the animator the maximal freedom in accelerating/decelerating the animation speed within any segment, also maintaining the constraint of uidity of the full animation. 25
As an example of non linear sub-timing, look at segment (7; 8) of the above example, where the time samples are generated by the partial map Behaviour:
where tm7,tm8 respectively stand for tm7 ; tm8 . Since the Behaviour function, given in Appendix A.2, is applied to a sequence of four values, the time sampling is done with a cubic real-valued Bezier map. According to the four control values, which are not equally spaced in the interval [tm7 ; tm8 ], the samples are accumulated towards the interval end, so suitably decelerating the rst part and accelerating the second part of the (7; 8) segment animation. Clearly, when only two time values are passed to the Behaviour primitive, a linear segment animation will be performed.
Figure 10: Animation preview by super-imposition of segment key-frames.
References [1] Alias Wavefront (Silicon Graphics) Maya 26
http://www.aw.sgi.com/pages/home/pages/products/pages/maya
[2] Alias Wavefront (Silicon Graphics). Power Animator. http://www.aw.sgi.com/pages/home/pages/products/pages/poweranimator
[3] Bajaj, C.L. and Anupam, V. \SHASTRA - An Architecture for Development of Collaborative Applications" International Journal of Intelligent and Cooperative Information Systems, Vol. 3, No. 2, (1994), pp. 155-172. [4] Bajaj, C.L. and Cutchin S. \The GATI Client-Server Animation Toolkit" Proceedings: Computer Graphics International, CGI93, Communicating with Virtual Worlds, edited by N. Thalmann and D. Thalmann, Springer Verlag, (1993), pp. 413-423 [5] Backus, J., Williams, J.H. and Wimmers, E.L. \An Introduction to the Programming Language FL". Research Topics in Functional Programming, D.A. Turner (Ed.), (1990). [6] Electric Image. Electric Image.
http://www.electricimage.com
[7] Faber, R.L. \Dierential geometry and relativity theory. An Introduction". Monographs and texbooks in pure and applied mathematics, Marcel Dekker, (1983). [8] Foley, J., van Dam, A., Feiner, A. and Hughes, J. \Computer Graphics: principles and practice" (second edition). Addison Wesley (1993). [9] Kelley, J.E. and Walker, M.R. \Critical Path Planning and Scheduling". Proc. of the Eastern Joint Computer Conference, 1959. [10] Kinetics. 3D Studio Max. http://www.ktx.com [11] NewTek. LightWave.
http://www.newtek.com
[12] Paoluzzi, A., Pascucci, V. and Vicentino, M. \Geometric Programming. A Programming Approach to Geometric Design". ACM Transactions on Graphics Vol. 14, No. 3 (July 1995), pp. 266-306. [13] Paoluzzi, A., Pascucci, V. and Ferrucci, V. \Dimension-Independent Convex-Cell Based HPC: Skeletons and Product". International Journal of Shape Modeling, Vol. 2, No. 1 (1996), pp. 37-67. [14] Side Effects Software. Houdini. [15] SoftImage. SoftImage V3.8.
http://www.sidefx.com
http://www.softimage.com
27
[16] SoftImage. Sumatra.
http://www.softimage.com
[17] Wernecke, J. The Inventor Mentor. Addison{Wesley, 1994.
A APPENDIX A.1 Geometry toolbox DEF Q = QUOTE~IF:; DEF ButLast = REVERSE~TAIL~REVERSE; DEF circle (a::IsReal) (r::IsReal) (n::IsInt) = (S::~JOIN):(MAP:([cos,sin]~s1):((Q~#:n):(a/n))); DEF TrunCone (r1,r2,h::IsReal)(n::IsInt) = MAP:[ x * cos~s2, x * sin~s2, z ]:(Q:1 * (Q~#:n):(2*PI/n)) WHERE x = K:r1 + s1 * ( K:r2 - K:r1 ), y = K:0, z = s1 * K:h END; DEF convert (seq::IsSeq) = (AA:*~DISTL):< PI/180, seq >;
A.2 Motion toolbox DEF Sampling (n::IsIntPos) = (AA:LIST ~ AA:/ ~ DISTR):; DEF convert (seq::IsSeqOf:IsReal) = (AA:*~DISTL):< PI/180, seq >; DEF XCAT = CAT~AA:(IF:); DEF time (tseq::IsSeqOf:IsReal) = (CAT~AA:(Bezier:(AA:LIST:tseq))); DEF behaviour (Constraints::IsSeq) (CSpath::IsFun) (nSamples::IsInt) = (aa:AL~trans~[time:Constraints,CSpath]):(Sampling:nSamples) DEF GTpred (a,b::IsReal) = GT:a:b; DEF LTpred (a,b::IsReal) = LT:a:b; DEF greater (a,b::IsReal) = IF::; DEF lesser (a,b::IsReal) = IF::; DEF RMAX (seq::IsSeqOf:IsReal) = TREE:greater:seq; DEF RMIN (seq::IsSeqOf:IsReal) = TREE:lesser:seq;
A.3 Bezier curves of any degree DEF Fact (n::IsInt) =
*:(CAT:);
DEF BinCoeff (n,i::IsInt) = Fact:n / (Fact:i * Fact:(n-i)); DEF Bernstein (n::IsInt)(i::IsInt) =
28
* ~ [K:(BinCoeff:),** ~ [ID,K:i],** ~ [- ~ [K:1,ID],K:(n-i)]] ~ s1; DEF BernsteinBase (n::IsInt) = AA:(Bernstein:n):(0..n); DEF Bezier (ControlPoints::IsSeq) = (CONS~AA:(+~AA:*~TRANS)~DISTL): WHERE degree = LEN:ControlPoints - 1 END;
A.4 Segment CS curves DEF CSpath_0_1 = AA:((Bezier~AA:XCAT):< ,
,
,
> ); DEF CSpath_1_2 = AA:((Bezier~AA:XCAT):< ,
,
,
> ); DEF CSpath_2_3 = AA:((Bezier~AA:XCAT):< ,
,
> ); DEF CSpath_3_4 = AA:((Bezier~AA:XCAT):<
> ); DEF CSpath_5_6 = AA:((Bezier~AA:XCAT):< ,
29
> ); DEF CSpath_6_7 = AA:((Bezier~AA:XCAT):< ,
,
,
> ); DEF CSpath_7_8 = AA:((Bezier~AA:XCAT):< ,
,
,
> );
30