Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged...

11
Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim 12 , Thibaut Gaudin 2 , Alexandre Meyer 1 , Axel Buendia 23 , Saida Bouakaz 1 1 Universit´ e de Lyon, CNRS 1 Universit´ e Lyon 1, LIRIS, UMR5205, F-69622, France 2 Spir.Ops Artificial Intelligence, Paris, France 3 CNAM-CEDRIC, 292, rue St Martin, 75003 Paris, France Abstract We present a fully procedural method capable of generating in real-time a wide range of locomotion for multi-legged characters in a dynamic environment, without using any motion data. The system consists of several independent blocks: a Character Controller, a Gait/Tempo Manager, a 3D Path Constructor and a Footprints Planner. The four modules work cooperatively to calculate in real-time the footprints and the 3D trajectories of the feet and the pelvis. Our system can animate dozens of creatures using dedicated level of details (LOD) techniques, and is totally controllable allowing the user to design a multitude of locomotion styles through a user-friendly interface. The result is a complete lower body animation which is sufficient for most of the chosen multi-legged characters: arachnids, insects, imaginary n-legged robots, etc. Keywords: Procedural Animation, Level Of Details, Multi-Legged Characters, Dynamic Environments. 1 Introduction Real or imaginary animals make frequent ap- pearances in video games, films and virtual world simulations. In this context, animated virtual multi-legged characters like arachnids, insects, crustaceans or any imaginary n-legged robots/creatures make these virtual worlds be- lievable and life like. The most common task (a) (b) (c) Figure 1: (a) Spider model avoids crates flagged as forbid- den and steps on others flagged as safe (b) Ant model on a height map (c) Imaginary 5-legged Robot. that these virtual multi-legged characters per- form is locomotion: the ability to move in these virtual worlds toward the points of in- terest. These locomotion animations are quite rich due to the variety of morphologies, gaits, body sizes/proportions and due to the complex-

Transcript of Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged...

Page 1: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

Procedural Locomotion of Multi-Legged Charactersin Dynamic Environments

Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre Meyer1, Axel Buendia2 3, Saida Bouakaz1

1 Universite de Lyon, CNRS1 Universite Lyon 1, LIRIS, UMR5205, F-69622, France

2 Spir.Ops Artificial Intelligence, Paris, France3 CNAM−CEDRIC, 292, rue St Martin, 75003 Paris, France

AbstractWe present a fully procedural method capableof generating in real-time a wide range oflocomotion for multi-legged characters ina dynamic environment, without using anymotion data. The system consists of severalindependent blocks: a Character Controller, aGait/Tempo Manager, a 3D Path Constructorand a Footprints Planner. The four moduleswork cooperatively to calculate in real-time thefootprints and the 3D trajectories of the feetand the pelvis. Our system can animate dozensof creatures using dedicated level of details(LOD) techniques, and is totally controllableallowing the user to design a multitude oflocomotion styles through a user-friendlyinterface. The result is a complete lower bodyanimation which is sufficient for most of thechosen multi-legged characters: arachnids,insects, imaginary n-legged robots, etc.

Keywords: Procedural Animation, LevelOf Details, Multi-Legged Characters, DynamicEnvironments.

1 IntroductionReal or imaginary animals make frequent ap-pearances in video games, films and virtualworld simulations. In this context, animatedvirtual multi-legged characters like arachnids,insects, crustaceans or any imaginary n-leggedrobots/creatures make these virtual worlds be-lievable and life like. The most common task

(a)

(b)

(c)

Figure 1: (a) Spider model avoids crates flagged as forbid-den and steps on others flagged as safe (b) Antmodel on a height map (c) Imaginary 5-leggedRobot.

that these virtual multi-legged characters per-form is locomotion: the ability to move inthese virtual worlds toward the points of in-terest. These locomotion animations are quiterich due to the variety of morphologies, gaits,body sizes/proportions and due to the complex-

Page 2: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

ity of the environment where these multi-leggedcharacters move: overcoming objects, cross-ing uneven terrain, avoiding moving obstacles,etc. The challenge of modeling such motionsarises from the lack of motion capture datainherent to the difficulty to obtain them andby the fact that existing animation techniquesmostly address human-like characters [1].

We propose a system (See Figure 1) thatprocedurally generates locomotion animationsfor dozens of multi-legged characters, withoutany motion data, in real-time using dedicatedlevel of details (LOD) techniques, and with areactive adaptation to a dynamic environment.We focused on generating plausible movements[2] that are, at the same time, believable andfully controllable. Our technique produces amultitude of locomotion styles, generated outof many input parameters like the creaturemorphology, gait/tempo, the overall locomo-tion speed, etc. These input parameters canbe edited through a user-friendly interface inreal-time. We propose a foot path planningsystem that assign to each foot the best cou-ple (footprint-trajectory), where the footprintis selected among several candidates, and thetrajectory is the 3D path that reach this footprint.Our system generates plausible locomotion an-imation at different level of details (LOD): theevaluation of the possible couples (footprint-trajectory) may be adapted according to thedesired LOD, typically depending on qualitycriteria such as the on-screen importance, vis-ibility, etc. These footprints and trajectoriesmay change in real-time in a reactive manneraccording to the dynamic of the environmentand the obstacles. Finally, our system generatesthe pelvis trajectory according to the overalldesired direction, speed, the actual context ofthe environment and the feet positions and feed-backs. Thus, our procedural approach providestwo important features for interactive applica-tions: reactivity and control.

2 Related WorkThere are several techniques for generating lo-comotion, Multon et al. in [3] and Van Welber-gen et al. in [1] identified in their surveys thethree major techniques: data-driven, physics-based and procedural. Notice that few of the

presented approaches were dedicated or testedon the family of animals and creatures presentedin this paper, and to our knowledge, none ad-dresses the performance issues with level ofdetails techniques introduced in our system.

Data-driven techniques use input data toproduce the animation (like Motion CaptureData). These techniques, although the mostnatural looking, are fixed for a specific mor-phology and a specific context. Physics-basedtechniques are more generic and adapt betterto the environment. They do so by simulatingthe actual physical forces/torques that act on thearticulated body. But they are computationallyexpensive due to the number of equations tosolve, which limits the number of characterssimulated at the same time. Several workswere proposed to overcome the problems ofthe previous techniques or to mix them, like:Adapting the motion data to different morpholo-gies (Motion Retargeting) using inverse kine-matics in [4, 5] or mesh based techniques in[6]. Using inverted pendulum model (IPM)[7] to avoid complex kinematics and dynam-ics calculations on the original multi-segmentsskeleton. In [8] they animate the upper body ofthe character using Motion Capture data whilethe lower body is animated using an IPM. In[9] they optimize their IPM controller usingMotion Capture data. In [10] they animate aquadruped in real-time using forward dynamics,using forces data extracted out of real quadrupedMotion Capture data. Finally, several papersintroduce a specific offline optimization pass,to accommodate for predefined environmentaltopologies and changes [11, 12]. The lack ofmotion data and the difficulties to obtain themfor the family of animals and creatures thatwe simulate has led us to avoid data-driventechniques. In our system we concentrated moreon generating plausible movements [2], makingit more adapted (performance wise) to real-timeapplications than the physics-based ones.

Procedural techniques use mathematicalformulas and algorithms to generate the loco-motion without any real motion data. Theydo so using empirical and biomechanics con-cepts. These techniques offer high level ofcontrollability over data-driven ones: practicallyno morphological constraints, good adaptabilityto the environment, etc. These techniques take

Page 3: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

less computation time per character, making itpossible of animating several characters at thesame time in real-time. However, they maysuffer from the lack of naturality in the move-ment, a disadvantage that we try to overcomein this paper by integrating basic biomechanicsprinciples. We took inspiration from the work ofBoulic et al. in [13] on a human walking modeland the work of Singh et al. [14] that show howavoidance in dynamic crowds can be improvedusing biomechanics-based footstep planning.

In parallel to the locomotion animation, a pathand footprints planning are needed in order tonavigate through the environment. In [15] theysearch valid footprints using probabilistic nav-igation graphs that take into account posturetransition. Then, these footprints are substitutedwith corresponding motion clips. Lamarchein [16] generates navigation graphs and ceilinginformation and uses these information to cal-culate the best footprints around the optimizedtrajectory, and to generate the final motion usingmotion data, allowing for 3D navigation in com-plex environments. Path planning techniques arealso largely studied in robotics. In [17, 18, 19](H7 Humanoid Robot™ and Boston BigDog™)their planner produce the footprints using feed-forward loops, correcting itself after each stepfor adaptation. In [20] (Honda ASIMO™)they plans a sequence of footstep positions tonavigate toward a goal location while avoidingstatic and dynamic obstacles, their method usesa time-limited planning horizon. Comparingto our purpose of computer animation, roboticshave to deal with the complexity related to themobile robot mechanical constraints and withthe real world physics that we do not fully have.

Most of previously cited techniques are Footplacement driven locomotion, where the feetdrive the locomotion and the overall trajectoryof the center of mass. In [21] they generate lo-comotion by overlaying Motion Capture data onpredefined foot placement, while Torkos et al. in[22] generate the locomotion of a quadrupedusing external imposed footprints, and real-timephysics. These techniques suffer from the prob-lem that the lower body (the legs) usually donot control the locomotion. On the contrary,the upper body imposes a logical trajectorythat the lower body tries to follow [23]. Oursystem respects this concept: the pelvis adapt

its movement based on the feet feedback, but atthe same time it imposes the overall trajectory.

When considering locomotion of multi-legged animals, the possibility of using realdata are strongly limited due to difficulties tocapture the motion of real creatures like dogs,horses, insects, spiders, etc. and is sometimeimpossible like for an imaginary 5-legged char-acter. Thus, Girard et al. in [24, 25] propose afully procedural system to animate multi-leggedcharacters with visually plausible locomotion.Their system is limited to planner terrains. Ourwork can be considered as an extension intodynamic environments. Johansen in [26] adaptsexisting motion data (biped and quadruped) tothe environment using inverse kinematics andfootprints prediction. In [27] they animate a six-legged character (a cockroach) using reduced-linear articulated body dynamics and gait pat-terns observed in biology. Wampler et al. in [28]present a fully automatic method for generatinglocomotion and gaits for legged animals basedon their shape and by the use of an off-line op-timization pass that results in believable anima-tions. In [29] they use intelligent retargetting of2-4-6-legged Motion Capture data without anymorphological constraint (the user can designtheir own creature). The objective of our systemis to achieve similar results with the proceduraltechniques in real-time without using any off-line components, and with much more controlin a dynamic complex environment.

Finally, as our method tries to generate plau-sible and believable locomotion, we created ourcontrollers in a way that reflects many studies:the effect of limb length and running speed ontime of contact and step length in [30], therelationship between speed and step length inhumans in [31], and animal gaits: galloping,trotting, pacing, etc. in [32].

3 Overall Locomotion ControllerLocomotion is the act of moving from one placeto another. For most terrestrial animals thatmeans putting one foot in front of the others ina successive way until reaching the designatedpoint of interest (target). During a normal footmovement there are two main phases explainedmore in [33]: the stance phase where the footis blocked on the ground and the swing phase

Page 4: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

Feet Path Planning

Pelvis

Figure 2: System Overview

where the foot flies in a parabolic-like curvetoward its target without any ground contact.Locomotion cycle is the act of repeating thesefeet movements, based on a certain rhythm ortempo. Our system follows these principleswhen generating -procedurally and in real-time-the locomotion of the multi-legged characters.The main advantage of the procedural approachis the reactivity as it adapts to the environment,and the controllability (a list of all controllableparameters is detailed in Section 3.1). Startingfrom an environment defined by a height mapand several obstacles (moving or static), theoverall locomotion process is computed by fourblocks as shown on Figure 2.

• The character controller is the central mainstructure that manages the overall loco-motion of the multi-legged character (SeeSection 3.2). It relies on the three otherstructures to compute the motion of the feetand the overall pelvis displacement.

• The gait manager regulates the feet tempoaccording to the movement patterns de-fined by the user (See Section 3.3).

• The 3D path constructor is a utility struc-ture that construct a 3D trajectory of a footusing an efficient discrete representation ofthe environment that can be easily main-tained and updated with dynamic objects(See Section 4).

• The footprints planner evaluates for eachfoot all the possible targets and trajectoriesin real-time, and chooses the best couple offootprint target and 3D trajectory (See Sec-tion 5).

These four blocks work together in order togenerate the movement of the feet and the pelvisin 3D. Now, to obtain the final lower bodylocomotion movement we apply an inverse kine-matics (IK) algorithm. We use a system calledthe Cyclic Coordinate Descent (CCD) algorithm[34, 35] which computes the position and orien-tation of the legs joints that connect the pelviswith its feet. We chose the CCD because ofits performance and simplicity: it minimizes theerror between the actual end effector positionand the desired one by iteratively modifying theangle of the joints.

3.1 System Parameters

(b) (a)

Figure 3: Spider Model: (a) internal representation ofthe spider model with its IK system, in pinkis the projected bounding box, in blue the feetorientation. (b) the actual spider 3D model.

Our system generates the locomotion anima-tions using several input parameters, that theuser provides or controls in real-time. All theparameters (except the morphology parameters)can be edited at any time by the user or by anyautomatic character controller when the focus isto animate a crowd of creatures. An overview ofall the parameters follows.

• Multi-legged character morphology: theuser provides an initial static skeleton thatcan be associated with a skinned mesh.To automatically map the morphology, theuser provides the system with the nameof each leg hip joint and the name of itsend effector (e.g. the joint before the foot).Out of these inputs our system detects thenumber of feet, leg sections, the relativehip positions and the initial feet relativepositions. The user also needs to providethe system with the desired leg joint limits(for our CCD algorithm), real body center,projected body bounding box, body thick-ness, and finally the projected foot shape (ifit exists) an example is shown on Figure 3.

• Gait/Tempo: using our interface, the userdesigns for each foot the stance and swing

Page 5: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

phase cycle. These cycles describe thepattern of the feet movement. The final gaitcan be symmetrical or asymmetrical.

• Locomotion speed: speed of the move-ment in meter per second.

• Step height: the preferred foot step heightin meter.

• Feet spacing: the preferred position ofeach foot, relative to the pelvis.

3.2 Character ControllerThe character controller is the coordinator ofthe overall system. It is in charge of two maintasks: managing the movement of the feet andcomputing the pelvis 3D movement based on theuser needs and on the final positions of the feet.

3) Naive Target

Position

4) Preferred Target Position

Vertical Slice in the Environment

1) Initial Position

2) Step Length

(a)

Envi

ron

me

nt

1) Environment Convex Hull

Multi-legged Character Body Bounding Box Projection

2) Final Convex Hull

3) Center Projection

(b)

Figure 4: The vertical slice in the environment can containobjects and obstacles, (a) computation of thepreferred footprint target for each foot. Thenaive target position is calculated by queryingthe environment about the elevation of the 2Dpoint resulted from the initial position + thestep length (b) Computation of the pelvis’ heightusing several convex hulls that covers the envi-ronment slice that interests us

Pelvis default movement: the 2D movementof the pelvis on the ZX plan (assuming theY -axis is up) is calculated based on the speedand orientation. While the computation of thepelvis height is more complex, as shown onFigure 4(b): we first construct a convex hullbased on the ground height underneath it andthe actual position of the feet. By projecting the

multi-legged character center on this convex hullwe get the needed pelvis height and by addingthe body thickness we get the actual pelvisheight. At the same time the character controlleradds an oscillating (sinusoidal) movement onthis pelvis height, based on the feet phases. Thepitch angle of the multi-legged character bodyis calculated directly from the convex hull. It isthe slope of the line segment that contains theprojected center of the multi-legged character.

Foot Path Planning

For Each Foot

Do Nothing

Stance

Check 3D Trajectory

Already in Swing Phase

Valid? Yes

New to Swing Phase

No

Calculate Needed Target

Footprints Planner

Yes No

3D Path Constructor

Foot State?

Forced Replan?

Figure 5: Main job of the character controller per foot:based on the current foot state it can take differ-ent decisions

Feet movement: Figure 5 explains how thecharacter controller manages the movement ofthe feet (first task). At each time step, thegait manager informs the character controllerabout the feet that are going to enter swingphase as detailed in Section 3.3. For each ofthese feet a preferred footprint target is calcu-lated. As shown on Figure 4(a), the foot steplength is calculated based on the current speed,multi-legged character morphology and the footrelative position that the user can impose asillustrated and explained directly on Figure 6.After calculating this foot step length, we usethe initial position of the foot to calculate thepreferred 3D target position in the environment(See Figure 4(a)).

Finally, the character controller calls the footpath planner to compute the 3D trajectory thatthis foot will follow, as described in Section 5.Feet that were already in swing phase may needa new a 3D trajectory (path) for several reasons:a new pelvis orientation (when turning), a newdesired relative position of the foot (Figure 6),a new overall speed, or something changed inthe environment thus invalidating its current 3Dtrajectory or its current target. In these cases thecharacter controller processes this foot as if it

Page 6: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

just started its swing phase, and therefore it isredirected to the previously explained foot pathplanning phase. Stance feet are blocked on theground.

Character Front

Feet with Equal Target and Current Relative

Position

Foot Current Relative Position

Foot Target Relative Position

Position Interpolation

Top View

Figure 6: 8-Legged Character Feet Spacing Interface

Pelvis movement refining: After moving thefeet, the character controller refines the pelvismovement based on the feet feedback (shown onFigure 7). Each foot can choose a better targetthat adapts better to the context (see Section 5).In that case, the character controller averagesthe offset between the preferred footprint targets(Figure 7 in blue) and the effectively chosenone (in green). The controller incorporates thisoffset when it is quite significant, based on themulti-legged character morphology, otherwise itdiscards it.

Foot Chosen Target

Movement Direction Pelvis

Foot Pelvis

Needed Target

2D Top View

Figure 7: Feet feedback: During the computation of thepelvis displacement, we use the feet feedback.

3.3 Gait Manager

The role of the gait manager is to organize andvisualize the pattern of the feet’s cycle and toperform the transition between patterns. Since alocomotion is cyclic, it seemed natural to repre-sent the gait/tempo with circles. As illustratedon Figure 8, each circle represents a foot, withthe colored sectors representing the swing phaseportion of the foot movement. The feet needleactivates sectors and deactivates others based onits current position while turning. Activating asector means that the corresponding foot shouldenter in the swing phase.

Foot Currently in Swing Phase Feet Needle

Needles Rotation Direction

Next Feet to enter Swing Phase

Un-active

Foot 0 Foot 1 Foot 2 Foot 3

Figure 8: An example of a four feet’s gait as shown by thegait manager. With this interface, the user canedit the pattern.

Gaits interpolation/transition During a lo-comotion cycle any creature changes its gaitconstantly in order to adapt to the environment.To accommodate for this changes in the gaitand to introduce more variety in the locomo-tion styles, our gait manager allows the transi-tion/interpolation between any needed gaits onthe fly. Each swing phase sector has a start anda finish, we compute the transition to another(destination) gait by simply interpolating thestart of the source sector toward the start of thedestination sector in the direction that does notpass by the finish of the destination sector. OnFigure 9(a) we chose the clockwise directionwhile on Figure 9(b) we chose the counterclock-wise one. By doing so, the interpolation doesnot pass by any area of the circle that the userdoes not want to. The interpolation of the dura-tion of the swing phase (the size of the sector) isquite straightforward, and the speed of all theseprocesses can be fixed in advance by the user.So, on each step and when the foot is not active(in stance phase), we replace its disk with thenew disk calculated in the interpolation process,resulting in seamless and logical interpolation.

4 3D Path ConstructionDuring the swing phase, each foot has a cur-rent position (source) and a desired footprinttarget. The role of the 3D path construction isto construct the foot 3D trajectory that navigatesthrough the environment, from this current posi-tion toward the footprint target without collidingwith any obstacle. This 3D path construction is

Page 7: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

Source Gait Destination Gait

Sector Start

Sector Finish

Foot 0 Foot 1

(a)

1 2 3 4 5

(b)

1 2 3 4 5

Clockwise Interpolation

Counter Clockwise

Interpolation

Figure 9: Interpolations Options: (a) deciding to do aclockwise position interpolation based on theactual disposition of the gait disks (b) decidingto do a counter-clockwise position interpolation

requested several times with different footprinttargets by the foot path planner as it will beexplained in Section 5. The environment itselfcan be very complex, and it can include severalobjects represented by many triangles. Thatis why we have oriented this path constructionprocess toward a discrete grid-based approach.Indeed, once the environment is converted andrepresented by our grid, the path computationbecomes independent of the object’s complexity.We also have chosen this over a vectorial basedpath planning because discrete algorithms areeasier to implement.

Grid-based representation of the environ-ment. We convert the 3D environment nearthe animated multi-legged character into two 2Dgrids: the obstacles’ map and the elevationsmap. The obstacles’ map describes the areasof the environment where the feet are allowedto pass, as illustrated on Figure 10(a). Theblack cells represent the obstacles, and we callthem the forbidden cells. The elevations mapcontains the elevation of the highest obstacle ineach cell as shown on Figure 11. These twomaps are computed using the terrain heightmapand the objects: the bounding box of each objectis voxelized onto the maps. Concave objects aresubdivided into convex ones. We pre-computethe map’s representation of static objects. Whilewe compute the map’s representation of dy-

(a)

(b)

Figure 10: (a) We firstly construct the path in a 2Dvoxel-based representation of the environment(yellow dots) and then generate the final curve(in black) with a selection of waypoints (reddots). (b) Using the elevations map and theprevious 2D trajectory we construct the 3Dtrajectory.

namic objects when they move near our multi-legged character. In order to avoid legs crossing,we add for each foot the projection of the otherlegs into the obstacles’ map as forbidden cells.

Start Position Pelvis Preferred Target

Figure 11: An example of our environment discretiza-tion: pink spheres represents the ground, yel-low spheres contain the corner of an obsta-cle, green spheres contain an obstacle edge,blue spheres are an obstacle interior and redspheres are an obstacle size increase.

These maps are relatively small as they areonly computed around our animated multi-legged character, speeding up calculations.Since a foot could not be punctual, we use thebounding box of the foot shape to increase thesize of the obstacles in the opposite direction

Page 8: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

of the foot, as shown on Figure 12. Doing soguarantees the non penetration of the foot withthe obstacles.

Foot Shape and Orientation

Obstacle

Contextual new obstacle

Foot Center

Figure 12: We increase each obstacle size using thebounding box of the foot and its orientation inorder to better avoid collision.

Path construction. Always with a perfor-mance concern, we firstly compute the trajec-tory from the actual foot position toward thetargeted footprint in the ZX plan using theprojections of the source and the target on theZX plan (in black on Figure 11). Our systemuses a shortest path computation that processesa Wavefront algorithm combined with the poten-tial field method [36] for the obstacle avoidance.This method is quite similar to the well-knownDijkstra’s shortest path algorithm.

The resulting path off the wavefront algo-rithm is constructed out of several cells that wecall the naive cells of the plan (in yellow onFigure 10). We refine these naive cells, usingqueries of line of sight (no intersection witha forbidden cell) to eliminate unwanted cells,and we obtain the final cells of the the plan (inred). These cells are used to build the 2D pathrepresented by a parametric Hermite curve asshown on Figure 10)(a).

We sample this 2D curve and elevate it in3D using the elevations map. Resulting way-points are used as control points to define a 3DHermite curve: this curve represents our 3Dtrajectory through the environment as shown onFigure 10(b).

5 Footprints and Feet PathPlanning

In Section 3.2, we explained that starting fromthe initial foot position the character controllercalculates a preferred footprint target accordingto the locomotion parameters and the surround-ing environment (Figure 11). But these calcula-tions do not take into consideration the actualstate of the foot and its preferences (e.g. the

preferred target calculated by the character con-troller can be too close to an obstacle). That iswhy in this step we calculate and assign to eachfoot the best trajectory toward the best target inthe current environment.

5.1 Potential FootprintsOur algorithm evaluates several footprint tar-gets by exploring the potential cells aroundthe preferred footprint (the one computed bythe character controller in Figure 11). Severaloperations are done to do that. In both maps(the obstacles’ map and the elevations map), wefirstly increase the size of the obstacles usingthe foot shape (See Figure 12 and Figure 11 inred). Secondly, to eliminate possible intersec-tion with other feet we fill the obstacles’ mapwith the position of these other feet. Thirdly,we identify all the -potential- cells that mayaccept a footprint: all the non-forbidden cellsthat are not a size increase ones (Figure 13). Foreach potential target, we calculate a score basedon several criteria’s: distance to the preferredfootprint, difference of elevation between thefootprint and the surrounding cells, leading ornot to a feet crossing, etc. The combination ofall these criteria’s provides the final cell’s score(footprint score) that we normalize between 0and 1. Figure 13 shows these scores.

5.2 Best Pair of Footprint and Path

Figure 13: Potential targets: the color varies from green(best target) (score = 1) to blue (worst target)(score = 0). Crossed cells are the cellsprocessed by our algorithm, in pink possibletrajectories, in black the chosen one.

Avoidance-wise. During the 3D path con-struction (See Section 4), the forbidden cells inthe obstacles’ map designate the parts of theenvironment that the 2D trajectory is going toavoid and go around. This 2D trajectory passesthrough cells that have an elevation. The 3Dpath constructor uses this elevation to construct

Page 9: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

the final 3D trajectory. The system uses this ob-stacles’ map to process an obstacle: either goingaround it or going over it. If the system wants togo around an obstacle, it just needs to add it tothe obstacles’ map as forbidden cells. In thatway, the resulting 2D trajectory will definitelygo around it. While if the system wants to goover an obstacle, it does not need to do anythingspecial as the obstacle is already present inthe elevations map. And the obstacle will beavoided accordingly based on its elevation. Inorder to achieve this avoidance distinction in anoptimal way in a complex environment (heightmap plus obstacles), our system discretize theelevations map on the Y -axis into slices (forinstance slices of 10cm). For each slice, thesystem fills the obstacles’ map with the cellsthat have higher elevation than this slice. In thatway, all calculated trajectories will go over allobstacles, objects and pieces of the environmentthat have an elevation lower or equal to theslice’s elevation. At the same time, all calculatedtrajectories will go around all obstacles, objectsand pieces of the environment that have an ele-vation higher than the chosen slice’s elevation.

So each trajectory can go around or over eachobstacle, which generates multiple trajectoriestoward a target. Each one of these trajecto-ries has a score. Our search space is all thepossible trajectories that go from the startingpoint toward all the possible targets. Out of thismultitude of possibilities, our main algorithmpicks up the best couple (target-trajectory) in anintelligent way.

Our algorithm (result shown on Figure 13)loops on all the possible targets based on theirscore (in a descending way). For each one ofthese targets, the algorithm first generates the2D trajectory and scores it, if the score of thecouple (target-trajectory in 2D) is better than thecurrent best couple found till now, it continues.Then it generates the 3D trajectory based on the2D one and scores it, if the score of the newcouple (target-trajectory in 3D) is better than thecurrent best couple, then it tags this new coupleas the best one and continues. The algorithmcontinues evaluating the couples until it reachesa couple (target-trajectory in 3D) with a scoreworse than the current best one, in this case itstops and the current best couple is the best one.So, at the end of the algorithm we obtain the best

footprint target and 3D trajectory that this footshould follow. We calculate the length of this3D trajectory, and using the needed time givenby the character controller, we move the foot onthe curve at a constant speed.

Trajectory scoring. We generate for eachcreated 2D/3D trajectory a score based on theapplication specifications, like the total length ofthe path, the acceleration and the curve tangentsprofile, etc. For instance, the system shown inthe accompanying video prefers trajectories thatare more straight (direct) with less curvature,a preference observed in biomechanics as itminimizes the energy cost [37, 38].

6 Level of Details techniques(LOD)

Our main algorithm (Section 5.2) execution timecan be controlled easily when simulating manymulti-legged characters in order to acceleratethe simulation itself. This comes from theability of controlling the number of evaluatedcouples (target-trajectory) and from the abilityof controlling the size of the slices used whenavoiding obstacles. But in order to alwayshave a plausible locomotion, we start applyingthis LOD after we find the first valid couple(target-trajectory), in this way we ensure thatthe algorithm will assign to each foot a validtrajectory toward a valid target (although it is notthe best couple).

In our simulation and for off-screen charac-ters, the algorithm stops directly when findingthis first couple. While for the on-screen char-acters, we limit the number of couples evalu-ated after finding this first couple in a linearway based on the distance of that multi-leggedcharacter from the camera. In this way for faron-screen characters the algorithm stops alsowhen it finds the first couple. In the same way,for off-screen characters the algorithm tries togo over any obstacle using no slices (not goingaround any obstacle). While for the on-screencharacters, we increase the size of the slices (forexample 10cm, 15cm...no slices) in a linear waybased on the distance of that character from thecamera. This LOD can be regarded as: the morethe character is far away from the camera (oroff-screen) the less our algorithm worries if thechosen couple is comfortable. In next section

Page 10: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

Table 1: Average computation time for 100 8-legged charactersTotal for Characters Maps Preparation CCD IK Systems Average FPS

LOD 0.026s 0.004s 0.013s ~30fpsLOD Zoomed 0.028s 0.004s 0.006s ~30fps

No LOD 0.045s 0.004s 0.013s ~18fps

we speak about the actual performance of ourreal-time system.

7 ResultsIn our implementation, the environment is rep-resented by two classes of objects: the terrainand the obstacles. A height map defines theterrain and is loaded without any pre-processinganalysis (See Figure 11 ). The obstacles aremainly represented by crates with various sizesand orientations randomly generated on the ter-rain (See Figure 1 and 14). These crates can bestatic or can move on the terrain (See the accom-panying video). Without changing anything inthe system, we have tested it on different kindsof terrain (flat surface, smooth terrain, regularstairs, etc.) with different kinds of obstacles(static crates and moving ones). The size of thediscretization maps used in our tests is 70 × 70with 7cm cells, which consumes little memoryand is precise enough since the maps describeonly the environment close to each animatedcharacter. The animated multi-legged charactersgaits are inspired from biology studies [39, 40]

Figure 14: Simulation snapshot.

The results show that our system is welladapted for real-time applications. In Fig-ure 14 and in the accompanying video we showmany morphologically different characters ani-mated in real-time using our test machine (Corei7 2.7 GHZ, 8 GB RAM, 6870 ATI RadeonHD with 1GB vRam). Table 1 shows averagecomputation time for 100 8-legged characters.

In LOD we make sure that all of the charactersare in the field of view of the camera, while inLOD Zoomed we zoom on one character andmake sure that at least 50% of the characters areshown on the screen. As we can observe, themaps preparation is fixed, as it is pre-computedonce, for all characters at the same time. In LODZoomed the system loses some computationtime per character as there are more charactersdoing full search for the best couple, while inthe same time gains computation time in the IKsystems as we do not calculate the IK for theoff-screen characters.

8 ConclusionsWe presented a system capable of procedu-rally generating believable locomotion anima-tion of several multi-legged characters (likearachnids, insects, or any imaginary n-leggedrobots/creatures) in real-time with no a priorimotion data nor any information about the en-vironment. Our system is quite generic and canbe applied on a variety of morphologies. In run-time the user can control many parameters likethe the gait, the speed, the direction, etc.

Nevertheless, the current system assumes thatthe feet of the character can be represented bya point. Our model does not include the feet’smetatarsus, which has a great impact on thenaturalness of the locomotion when consideringmore complex characters. As a future work, itwill be interesting to study this point, speciallyfor bipeds/humans. And to study the additionof a flexible spine-like structure, which is essen-tial when simulating quadrupeds [10]. We arealso planning on improving the pelvis behaviorto incorporate dynamic-like balance reactions.Our system can serve as input to higher levelcharacters’ controllers that would like to providemore animations than only the locomotion, liketouching objects for discovering the environ-ment, studying insect’s behavior, etc.

Page 11: Procedural Locomotion of Multi-Legged Characters in ... · Procedural Locomotion of Multi-Legged Characters in Dynamic Environments Ahmad Abdul Karim1 2, Thibaut Gaudin2, Alexandre

References[1] H. Van Welbergen, B. J. H. Van Basten, A. Egges,

Zs. M. Ruttkay, and M. H. Overmars. Real timeanimation of virtual humans: A trade-off betweennaturalness & control. Computer Graphics Forum,29(8).

[2] Ronen Barzel, John F. Hughes, and Daniel N. Wood.Plausible motion simulation for computer graphicsanimation. In Proceedings of the Eurographicsworkshop on Computer animation and simulation,1996.

[3] Franck Multon, Laure France, Marie-Paule Cani-Gascuel, and Gilles Debunne. Computer animationof human walking: a survey, 1999.

[4] Michael Gleicher. Retargetting motion to new char-acters. In Proceedings of the 25th annual conferenceon Computer graphics and interactive techniques,SIGGRAPH, 1998.

[5] Franck Multon, Richard Kulpa, Ludovic Hoyet, andTaku Komura. From motion capture to real-timecharacter animation. In Motion in Games, 2008.

[6] Edmond S. L. Ho, Taku Komura, and Chiew-LanTai. Spatial relationship preserving character motionadaptation. ACM TOG, 29(4), 2010.

[7] Shuuji Kajita, Fumio Kanehiro, Kenji Kaneko,Kazuhito Yokoi, and Hirohisa Hirukawa. The 3dlinear inverted pendulum mode: A simple modelingbiped walking pattern generation. In InternationalConference on Intelligent Robots and Systems, 2001.

[8] Yao-Yang Tsai, Wen-Chieh Lin, Kuangyou B.Cheng, Jehee Lee, and Tong-Yee Lee. Real-timephysics-based 3d biped character animation using aninverted pendulum model. IEEE Transactions onVisualization and Computer Graphics, 16(2), 2010.

[9] Taesoo Kwon and Jessica Hodgins. Control sys-tems for human running using an inverted pendulummodel and a reference motion capture sequence.In Proceedings of ACM SIGGRAPH/EurographicsSymposium on Computer Animation, SCA ’10, 2010.

[10] Stelian Coros, Andrej Karpathy, Ben Jones, LionelReveret, and Michiel van de Panne. Locomotionskills for simulated quadrupeds. ACM Trans. Graph.,2011.

[11] Jia-chi Wu and Zoran Popovic. Terrain-adaptivebipedal locomotion control. ACM Transactions onGraphics, 29(4):72:1–72:10, Jul. 2010.

[12] Jack M. Wang, David J. Fleet, and Aaron Hertzmann.Optimizing walking controllers for uncertain inputsand environments. ACM Trans. Graph., 29, 2010.

[13] Ronan Boulic, Nadia Magnenat-Thalmann, andDaniel Thalmann. A global human walking modelwith real-time kinematic personification. Vis. Com-put., 6:344–358, November 1990.

[14] Shawn Singh, Mubbasir Kapadia, Glenn Reinman,and Petros Faloutsos. Footstep navigation for dy-namic crowds. In Symposium on Interactive 3DGraphics and Games, I3D ’11. ACM, 2011.

[15] Min Gyu Choi and Jehee Lee. Planning biped loco-motion using motion capture data and probabilisticroadmaps. ACM Transactions on Graphics, 2003.

[16] F. Lamarche. Topoplan: A topological path plannerfor real time human navigation under floor & ceilingconstraints. Computer Graphics Forum, 2009.

[17] James Kuffner Jr, Jr. Koichi, Nishiwaki SatoshiKagami, Masayuki Inaba, and Hirochika Inoue.Footstep planning among obstacles for biped robots.In Proc. of 2001 IEEE Intl. Conf. on IntelligentRobots and Systems (IROS, pages 500–505, 2001.

[18] James Kuffner, Satoshi Kagami, Koichi Nishiwaki,Masayuki Inaba, and Hirochika Inoue. Online foot-step planning for humanoid robots. In in Proc. ofthe IEEE Int. Conf. on Robotics and Automation(ICRA’03, pages 932–937, 2003.

[19] Marc Raibert, Kevin Blankespoor, Gabriel Nelson,and Rob Playter. Bigdog, the rough-terrain quadupedrobot.

[20] Joel Chestnutt, Manfred Lau, German Cheung,James Kuffner, Jessica Hodgins, and Takeo Kanade.Footstep planning for the honda asimo humanoid. Inin Proceedings of the IEEE International Conferenceon Robotics and Automation, 2005.

[21] B. J. H. van Basten, P. W. A. M. Peeters, andA. Egges. The step space:example-based footprint-driven motion synthesis. Comput. Animat. VirtualWorlds, 21, 2010.

[22] Nick Torkos and Michiel van de Panne. Footprint-based quadruped motion synthesis. In In GraphicsInterface, pages 151–160, 1998.

[23] Alain Berthoz. La simplexite. Odile Jacob, 2009.[24] Michael Girard and A. A. Maciejewski. Computa-

tional modeling for the computer animation of leggedfigures. In SIGGRAPH, 1985.

[25] Michael Girard. Interactive design of 3d computer-animated legged animal motion. IEEE Comput.Graph. Appl., 7, 1987.

[26] Rune Skovbo Johansen. Dynamic Walking WithSemi-Procedural Animation. PhD thesis, 2009.

[27] Michael McKenna and David Zeltzer. Dynamicsimulation of autonomous legged locomotion. InSIGGRAPH, New York, NY, USA, 1990. ACM.

[28] Kevin Wampler and Zoran Popovic. Optimal gait andform for animal locomotion. ACM Trans. Graph., 28,2009.

[29] Chris Hecker, Bernd Raabe, Ryan W. Enslow, JohnDeWeese, Jordan Maynard, and Kees van Prooijen.Real-time motion retargeting to highly varied user-created morphologies. ACM Trans. Graph., 27, 2008.

[30] Donald F. Hoyt, Steven J. Wickler, Edward, A. Cog-ger, Department Of Biological Sciences, and De-partment Of Animal. Time of contact and steplength: The effect of limb length, running speed, loadcarrying and incline. J. Exp. Biol, 203, 2000.

[31] Arthur D. Kuo. A simple model of bipedal walkingpredicts the preferred speed-step length relationship.Journal of Biomechanical Engineering, 2001.

[32] Biren A. Patel Jesse W. Young and and Nancy J.Stevens. Body mass distribution & gait mechanicsin fat-tailed dwarf lemurs (cheirogaleus medius) &patas monkeys (erythrocebus patas). Journal ofHuman Evolution, 2007.

[33] VERNE T. INMAN. Human locomotion. CanadianMedical Association, 1966.

[34] David G. Luenberger. Linear and Nonlinear Pro-gramming. Addison-Wesley, 1984.

[35] G. V. Reklaitis, A. Ravindran, and K. M. Ragsdell.Linear and Nonlinear Programming. Wiley, 1983.

[36] O. Khatib. Real-time obstacle avoidance for manip-ulators and mobile robots. 1990.

[37] R.M.N. Alexander. Optima for animals. Princetonpaperbacks. Princeton University Press, 1996.

[38] R.M.N. Alexander. Principles of animal locomotion.Princeton University Press, 2003.

[39] Donald M. Wilson. Stepping patterns in tarantulaspiders. The Journal of Experimental Biology, 1967.

[40] R.W. Blake. Efficiency And Economy in AnimalPhysiology. Cambridge environmental chemistryseries. Cambridge University Press, 2005.