Procedural Locomotion of Multi-Legged Characters in Dynamic Environments AhmadAbdulKarim1 2,ThibautGaudin2,AlexandreMeyer1,AxelBuendia2 3,SaidaBouakaz1 1 Universite´ deLyon,CNRS 1 Universite´ Lyon1,LIRIS,UMR5205,F-69622,France 2 Spir.OpsArtificialIntelligence,Paris,France 3 CNAM−CEDRIC,292,rueStMartin,75003Paris,France Abstract (a) 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 (b) 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 (c) 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 Figure1:(a)Spidermodelavoidscratesflaggedasforbid- Environments. denandstepsonothersflaggedassafe(b)Ant modelonaheightmap(c)Imaginary5-legged Robot. 1 Introduction Real or imaginary animals make frequent ap- pearances in video games, films and virtual that these virtual multi-legged characte rs per- world simulations. In this context, animated form is locomotion: the ability to move in virtual multi-legged characters like arachnids, these virtual worlds toward the points of in- insects, crustaceans or any imaginary n-legged terest. These locomotion animations are quite robots/creatures make these virtual worlds be- rich due to the variety of morphologies, gaits, lievable and life like. The most common task body sizes/proportions and due to the complex- ityoftheenvironmentwherethesemulti-legged presented approaches were dedicated or tested characters move: overcoming objects, cross- onthefamilyofanimalsandcreaturespresented ing uneven terrain, avoiding moving obstacles, in this paper, and to our knowledge, none ad- etc. The challenge of modeling such motions dresses the performance issues with level of arises from the lack of motion capture data detailstechniquesintroducedinoursystem. inherent to the difficulty to obtain them and Data-driven techniques use input data to by the fact that existing animation techniques produce the animation (like Motion Capture mostlyaddresshuman-likecharacters[1]. Data). These techniques, although the most We propose a system (See Figure 1) that natural looking, are fixed for a specific mor- procedurally generates locomotion animations phology and a specific context. Physics-based for dozens of multi-legged characters, without techniques are more generic and adapt better any motion data, in real-time using dedicated to the environment. They do so by simulating level of details (LOD) techniques, and with a theactualphysicalforces/torquesthatactonthe reactive adaptation to a dynamic environment. articulated body. But they are computationally Wefocusedongeneratingplausiblemovements expensive due to the number of equations to [2] that are, at the same time, believable and solve, which limits the number of characters fully controllable. Our technique produces a simulated at the same time. Several works multitude of locomotion styles, generated out were proposed to overcome the problems of of many input parameters like the creature the previous techniques or to mix them, like: morphology, gait/tempo, the overall locomo- Adaptingthemotiondatatodifferentmorpholo- tion speed, etc. These input parameters can gies (Motion Retargeting) using inverse kine- be edited through a user-friendly interface in matics in [4, 5] or mesh based techniques in real-time. We propose a foot path planning [6]. Using inverted pendulum model (IPM) system that assign to each foot the best cou- [7] to avoid complex kinematics and dynam- ple (footprint-trajectory), where the footprint ics calculations on the original multi-segments is selected among several candidates, and the skeleton. In [8] they animate the upper body of trajectoryisthe3Dpaththatreachthisfootprint. the character using Motion Capture data while Our system generates plausible locomotion an- the lower body is animated using an IPM. In imation at different level of details (LOD): the [9] they optimize their IPM controller using evaluation of the possible couples (footprint- Motion Capture data. In [10] they animate a trajectory) may be adapted according to the quadrupedinreal-timeusingforwarddynamics, desired LOD, typically depending on quality usingforcesdataextractedoutofrealquadruped criteria such as the on-screen importance, vis- Motion Capture data. Finally, several papers ibility, etc. These footprints and trajectories introduce a specific offline optimization pass, may change in real-time in a reactive manner to accommodate for predefined environmental according to the dynamic of the environment topologies and changes [11, 12]. The lack of andtheobstacles. Finally,oursystemgenerates motion data and the difficulties to obtain them the pelvis trajectory according to the overall for the family of animals and creatures that desired direction, speed, the actual context of we simulate has led us to avoid data-driven theenvironmentandthefeetpositionsandfeed- techniques. Inoursystemweconcentratedmore backs. Thus, our procedural approach provides ongeneratingplausiblemovements[2],making two important features for interactive applica- itmoreadapted(performancewise)toreal-time tions: reactivityandcontrol. applicationsthanthephysics-basedones. Procedural techniques use mathematical formulas and algorithms to generate the loco- 2 Related Work motion without any real motion data. They There are several techniques for generating lo- do so using empirical and biomechanics con- comotion, Multon et al. in [3] and Van Welber- cepts. These techniques offer high level of gen et al. in [1] identified in their surveys the controllabilityoverdata-drivenones: practically three major techniques: data-driven, physics- nomorphologicalconstraints,goodadaptability based and procedural. Notice that few of the to the environment, etc. These techniques take less computation time per character, making it itsmovementbasedon thefeetfeedback, butat possible of animating several characters at the thesametimeitimposestheoveralltrajectory. same time in real-time. However, they may When considering locomotion of multi- suffer from the lack of naturality in the move- legged animals, the possibility of using real ment, a disadvantage that we try to overcome data are strongly limited due to difficulties to in this paper by integrating basic biomechanics capture the motion of real creatures like dogs, principles. Wetookinspirationfromtheworkof horses, insects, spiders, etc. and is sometime Boulicetal.in[13]onahumanwalkingmodel impossible like for an imaginary 5-legged char- andtheworkofSinghetal.[14]thatshowhow acter. Thus, Girard et al. in [24, 25] propose a avoidance in dynamic crowds can be improved fullyproceduralsystemtoanimatemulti-legged usingbiomechanics-basedfootstepplanning. characters with visually plausible locomotion. Inparalleltothelocomotionanimation,apath Their system is limited to planner terrains. Our and footprints planning are needed in order to work can be considered as an extension into navigate through the environment. In [15] they dynamicenvironments. Johansenin[26]adapts search valid footprints using probabilistic nav- existing motion data (biped and quadruped) to igation graphs that take into account posture the environment using inverse kinematics and transition. Then,thesefootprintsaresubstituted footprintsprediction. In[27]theyanimateasix- with corresponding motion clips. Lamarche legged character (a cockroach) using reduced- in [16] generates navigation graphs and ceiling linear articulated body dynamics and gait pat- information and uses these information to cal- ternsobservedinbiology. Wampleretal.in[28] culate the best footprints around the optimized presentafullyautomaticmethodforgenerating trajectory,andtogeneratethefinalmotionusing locomotion and gaits for legged animals based motiondata,allowingfor3Dnavigationincom- on their shape and by the use of an off-line op- plexenvironments. Pathplanningtechniquesare timization pass that results in believable anima- also largely studied in robotics. In [17, 18, 19] tions. In[29]theyuseintelligentretargettingof (H7HumanoidRobot™andBostonBigDog™) 2-4-6-legged Motion Capture data without any their planner produce the footprints using feed- morphological constraint (the user can design forward loops, correcting itself after each step theirowncreature). Theobjectiveofoursystem for adaptation. In [20] (Honda ASIMO™) is to achieve similar results with the procedural they plans a sequence of footstep positions to techniques in real-time without using any off- navigate toward a goal location while avoiding line components, and with much more control static and dynamic obstacles, their method uses inadynamiccomplexenvironment. a time-limited planning horizon. Comparing Finally, as our method tries to generate plau- to our purpose of computer animation, robotics sibleandbelievablelocomotion,wecreatedour have to deal with the complexity related to the controllers in a way that reflects many studies: mobile robot mechanical constraints and with the effect of limb length and running speed on therealworldphysicsthatwedonotfullyhave. time of contact and step length in [30], the Most of previously cited techniques are Foot relationship between speed and step length in placement driven locomotion, where the feet humans in [31], and animal gaits: galloping, drive the locomotion and the overall trajectory trotting,pacing,etc.in[32]. of the center of mass. In [21] they generate lo- comotionbyoverlayingMotionCapturedataon 3 Overall Locomotion Controller predefinedfootplacement,whileTorkosetal.in [22] generate the locomotion of a quadruped Locomotionistheactofmovingfromoneplace usingexternalimposedfootprints,andreal-time to another. For most terrestrial animals that physics. Thesetechniquessufferfromtheprob- means putting one foot in front of the others in lem that the lower body (the legs) usually do a successive way until reaching the designated not control the locomotion. On the contrary, point of interest (target). During a normal foot the upper body imposes a logical trajectory movement there are two main phases explained that the lower body tries to follow [23]. Our more in [33]: the stance phase where the foot system respects this concept: the pelvis adapt is blocked on the ground and the swing phase These four blocks work together in order to generatethemovementofthefeetandthepelvis in 3D. Now, to obtain the final lower body Feet Path Planning locomotionmovementweapplyaninversekine- matics (IK) algorithm. We use a system called P elvis theCyclicCoordinateDescent(CCD)algorithm [34,35]whichcomputesthepositionandorien- tation of the legs joints that connect the pelvis with its feet. We chose the CCD because of itsperformanceandsimplicity: itminimizesthe error between the actual end effector position andthedesiredonebyiterativelymodifyingthe Figure2:SystemOverview angleofthejoints. where the foot flies in a parabolic-like curve 3.1 SystemParameters toward its target without any ground contact. (a) (b) Locomotion cycle is the act of repeating these feet movements, based on a certain rhythm or tempo. Our system follows these principles whengenerating-procedurallyandinreal-time- the locomotion of the multi-legged characters. Figure3:Spider Model: (a) internal representation of Themainadvantageoftheproceduralapproach the spider model with its IK system, in pink is the projected bounding box, in blue the feet is the reactivity as it adapts to the environment, orientation.(b)theactualspider3Dmodel. and the controllability (a list of all controllable parameters is detailed in Section 3.1). Starting Our system generates the locomotion anima- from an environment defined by a height map tions using several input parameters, that the and several obstacles (moving or static), the user provides or controls in real-time. All the overalllocomotionprocessiscomputedbyfour parameters(exceptthemorphologyparameters) blocksasshownonFigure2. can be edited at any time by the user or by any automaticcharactercontrollerwhenthefocusis • Thecharactercontrolleristhecentralmain toanimateacrowdofcreatures. Anoverviewof structure that manages the overall loco- alltheparametersfollows. motion of the multi-legged character (See Section 3.2). It relies on the three other • Multi-legged character morphology: the structurestocomputethemotionofthefeet user provides an initial static skeleton that andtheoverallpelvisdisplacement. can be associated with a skinned mesh. To automatically map the morphology, the • The gait manager regulates the feet tempo user provides the system with the name according to the movement patterns de- of each leg hip joint and the name of its finedbytheuser(SeeSection3.3). endeffector(e.g.thejointbeforethefoot). • The 3D path constructor is a utility struc- Out of these inputs our system detects the turethatconstructa3Dtrajectoryofafoot number of feet, leg sections, the relative usinganefficientdiscreterepresentationof hip positions and the initial feet relative the environment that can be easily main- positions. The user also needs to provide tained and updated with dynamic objects the system with the desired leg joint limits (SeeSection4). (for our CCD algorithm), real body center, projected body bounding box, body thick- • The footprints planner evaluates for each ness,andfinallytheprojectedfootshape(if footallthepossibletargetsandtrajectories itexists)anexampleisshownonFigure3. inreal-time,andchoosesthebestcoupleof footprinttargetand3Dtrajectory(SeeSec- • Gait/Tempo: using our interface, the user tion5). designs for each foot the stance and swing phase cycle. These cycles describe the multi-leggedcharactercenteronthisconvexhull patternofthefeetmovement. Thefinalgait we get the needed pelvis height and by adding canbesymmetricalorasymmetrical. the body thickness we get the actual pelvis height. Atthesametimethecharactercontroller • Locomotion speed: speed of the move- adds an oscillating (sinusoidal) movement on mentinmeter per second. thispelvisheight,basedonthefeetphases. The pitch angle of the multi-legged character body • Stepheight: thepreferred footstep height is calculated directly from the convex hull. It is inmeter. the slope of the line segment that contains the • Feet spacing: the preferred position of projectedcenterofthemulti-leggedcharacter. eachfoot,relativetothepelvis. For Each Foot 3.2 CharacterController Stance F oot State? New to Swing Phase Already in The character controller is the coordinator of Swing Phase the overall system. It is in charge of two main Do Nothing No For ced Replan? Yes tasks: managing the movement of the feet and Calculate Needed Target computingthepelvis3Dmovementbasedonthe Check 3D Trajectory Foot Path Planning userneedsandonthefinalpositionsofthefeet. Footprints 3D Path (a) 4) Preferred Target Position 3) Naive Target Yes Valid? No Planner Constructor Envi Position ron Figure5: Main job of the character controller per foot: me 1) Initial Position nt basedonthecurrentfootstateitcantakediffer- 2) Step Length entdecisions Feet movement: Figure 5 explains how the Vertical Slice in the Environment character controller manages the movement of (b) the feet (first task). At each time step, the gait manager informs the character controller about the feet that are going to enter swing phase as detailed in Section 3.3. For each of 2) Final 1) Environment Convex Hull these feet a preferred footprint target is calcu- Convex Hull 3) Center lated. As shown on Figure 4(a), the foot step Projection length is calculated based on the current speed, Multi-legged Character Body multi-leggedcharactermorphologyandthefoot Bounding Box Projection relative position that the user can impose as illustrated and explained directly on Figure 6. Figure4:Theverticalsliceintheenvironmentcancontain objects and obstacles, (a) computation of the After calculating this foot step length, we use preferred footprint target for each foot. The the initial position of the foot to calculate the naive target position is calculated by querying preferred 3D target position in the environment the environment about the elevation of the 2D (SeeFigure4(a)). point resulted from the initial position + the steplength(b)Computationofthepelvis’height Finally, the character controller calls the foot usingseveralconvexhullsthatcoverstheenvi- path planner to compute the 3D trajectory that ronmentslicethatinterestsus this foot will follow, as described in Section 5. Pelvisdefaultmovement: the2Dmovement Feetthatwerealreadyinswingphasemayneed of the pelvis on the ZX plan (assuming the anewa3Dtrajectory(path)forseveralreasons: Y-axis is up) is calculated based on the speed a new pelvis orientation (when turning), a new and orientation. While the computation of the desired relative position of the foot (Figure 6), pelvis height is more complex, as shown on a new overall speed, or something changed in Figure 4(b): we first construct a convex hull theenvironmentthusinvalidatingitscurrent3D based on the ground height underneath it and trajectoryoritscurrenttarget. Inthesecasesthe theactualpositionofthefeet. Byprojectingthe character controller processes this foot as if it just started its swing phase, and therefore it is Un-active Foot Currently in Foot 0 redirected to the previously explained foot path Swing Phase Feet Needle Foot 1 Foot 2 planning phase. Stance feet are blocked on the Foot 3 ground. Top View Foot Target Position Relative Interpolation Foot Current Needles Position Relative Position Rotation Direction Character Front Feet with Equal Target Next Feet to enter and Current Relative Swing Phase Position Figure8:Anexampleofafourfeet’sgaitasshownbythe Figure6:8-LeggedCharacterFeetSpacingInterface gaitmanager. Withthisinterface, theusercan editthepattern. Pelvismovementrefining: Aftermovingthe feet, the character controller refines the pelvis movementbasedonthefeetfeedback(shownon Gaits interpolation/transition During a lo- Figure 7). Each foot can choose a better target comotion cycle any creature changes its gait that adapts better to the context (see Section 5). constantly in order to adapt to the environment. In that case, the character controller averages To accommodate for this changes in the gait theoffsetbetweenthepreferredfootprinttargets and to introduce more variety in the locomo- (Figure 7 in blue) and the effectively chosen tion styles, our gait manager allows the transi- one (in green). The controller incorporates this tion/interpolation between any needed gaits on offset when it is quite significant, based on the the fly. Each swing phase sector has a start and multi-leggedcharactermorphology,otherwiseit a finish, we compute the transition to another discardsit. (destination) gait by simply interpolating the 2D Top View Foot start of the source sector toward the start of the Chosen destination sector in the direction that does not Target pass by the finish of the destination sector. On Pelvis Figure 9(a) we chose the clockwise direction Movement Direction Pelvis whileonFigure9(b)wechosethecounterclock- Foot Needed wise one. By doing so, the interpolation does Target not pass by any area of the circle that the user Figure7: Feet feedback: During the computation of the doesnotwantto. Theinterpolationofthedura- pelvisdisplacement,weusethefeetfeedback. tionoftheswingphase(thesizeofthesector)is quite straightforward, and the speed of all these processes can be fixed in advance by the user. 3.3 GaitManager So,oneachstepandwhenthefootisnotactive (in stance phase), we replace its disk with the The role of the gait manager is to organize and newdiskcalculatedintheinterpolationprocess, visualize the pattern of the feet’s cycle and to resultinginseamlessandlogicalinterpolation. performthetransitionbetweenpatterns. Sincea locomotioniscyclic,itseemednaturaltorepre- 4 3D Path Construction sent the gait/tempo with circles. As illustrated on Figure 8, each circle represents a foot, with During the swing phase, each foot has a cur- thecoloredsectorsrepresentingtheswingphase rent position (source) and a desired footprint portion of the foot movement. The feet needle target. The role of the 3D path construction is activatessectorsanddeactivatesothersbasedon toconstructthefoot3Dtrajectorythatnavigates its current position while turning. Activating a throughtheenvironment,fromthiscurrentposi- sectormeansthatthecorrespondingfootshould tiontowardthefootprinttargetwithoutcolliding enterintheswingphase. with any obstacle. This 3D path construction is Source Gait Destination Gait (a) Foot 0 Foot 1 Sector Start (a) Sector Finish Clockwise Interpolation 1 2 3 4 5 (b) (b) Counter Clockwise Interpolation 1 2 3 4 5 Figure10: (a) We firstly construct the path in a 2D Figure9:Interpolations Options: (a) deciding to do a voxel-basedrepresentationoftheenvironment clockwise position interpolation based on the (yellowdots)andthengeneratethefinalcurve actualdispositionofthegaitdisks(b)deciding (in black) with a selection of waypoints (red todoacounter-clockwisepositioninterpolation dots). (b) Using the elevations map and the previous 2D trajectory we construct the 3D trajectory. requested several times with different footprint targets by the foot path planner as it will be explained in Section 5. The environment itself namic objects when they move near our multi- can be very complex, and it can include several leggedcharacter. Inordertoavoidlegscrossing, objects represented by many triangles. That we add for each foot the projection of the other is why we have oriented this path construction legsintotheobstacles’mapasforbiddencells. process toward a discrete grid-based approach. Indeed, once the environment is converted and Start Position Pelvis Preferred Target represented by our grid, the path computation becomesindependentoftheobject’scomplexity. We also have chosen this over a vectorial based path planning because discrete algorithms are easiertoimplement. Grid-based representation of the environ- ment. We convert the 3D environment near theanimatedmulti-leggedcharacterintotwo2D grids: the obstacles’ map and the elevations map. The obstacles’ map describes the areas of the environment where the feet are allowed Figure11: An example of our environment discretiza- to pass, as illustrated on Figure 10(a). The tion: pinkspheresrepresentstheground, yel- black cells represent the obstacles, and we call low spheres contain the corner of an obsta- them the forbidden cells. The elevations map cle, green spheres contain an obstacle edge, blue spheres are an obstacle interior and red contains the elevation of the highest obstacle in spheresareanobstaclesizeincrease. each cell as shown on Figure 11. These two maps are computed using the terrain heightmap These maps are relatively small as they are andtheobjects: theboundingboxofeachobject only computed around our animated multi- isvoxelizedontothemaps. Concaveobjectsare legged character, speeding up calculations. subdivided into convex ones. We pre-compute Since a foot could not be punctual, we use the themap’srepresentationofstaticobjects. While bounding box of the foot shape to increase the we compute the map’s representation of dy- size of the obstacles in the opposite direction of the foot, as shown on Figure 12. Doing so preferredtargetcalculatedbythecharactercon- guarantees the non penetration of the foot with troller can be too close to an obstacle). That is theobstacles. whyinthisstepwecalculateandassigntoeach foot the best trajectory toward the best target in thecurrentenvironment. Obstacle Foot Shape and Orientation 5.1 PotentialFootprints Our algorithm evaluates several footprint tar- gets by exploring the potential cells around Contextual Foot Center new obstacle the preferred footprint (the one computed by Figure12: We increase each obstacle size using the the character controller in Figure 11). Several boundingboxofthefootanditsorientationin operations are done to do that. In both maps ordertobetteravoidcollision. (theobstacles’mapandtheelevationsmap),we Path construction. Always with a perfor- firstly increase the size of the obstacles using mance concern, we firstly compute the trajec- the foot shape (See Figure 12 and Figure 11 in tory from the actual foot position toward the red). Secondly, to eliminate possible intersec- targeted footprint in the ZX plan using the tion with other feet we fill the obstacles’ map projections of the source and the target on the with the position of these other feet. Thirdly, ZX plan (in black on Figure 11). Our system we identify all the -potential- cells that may uses a shortest path computation that processes accept a footprint: all the non-forbidden cells aWavefrontalgorithmcombinedwiththepoten- thatarenotasizeincreaseones(Figure13). For tialfieldmethod[36]fortheobstacleavoidance. eachpotentialtarget,wecalculateascorebased This method is quite similar to the well-known on several criteria’s: distance to the preferred Dijkstra’sshortestpathalgorithm. footprint, difference of elevation between the The resulting path off the wavefront algo- footprint and the surrounding cells, leading or rithm is constructed out of several cells that we not to a feet crossing, etc. The combination of call the naive cells of the plan (in yellow on all these criteria’s provides the final cell’s score Figure 10). We refine these naive cells, using (footprint score) that we normalize between 0 queries of line of sight (no intersection with and1. Figure13showsthesescores. a forbidden cell) to eliminate unwanted cells, 5.2 BestPairofFootprintandPath and we obtain the final cells of the the plan (in red). These cells are used to build the 2D path represented by a parametric Hermite curve as shownonFigure10)(a). We sample this 2D curve and elevate it in 3D using the elevations map. Resulting way- points are used as control points to define a 3D Hermite curve: this curve represents our 3D trajectorythroughtheenvironmentasshownon Figure10(b). Figure13: Potentialtargets: thecolorvariesfromgreen (besttarget)(score=1)toblue(worsttarget) 5 Footprints and Feet Path (score = 0). Crossed cells are the cells processed by our algorithm, in pink possible Planning trajectories,inblackthechosenone. In Section 3.2, we explained that starting from Avoidance-wise. During the 3D path con- the initial foot position the character controller struction (See Section 4), the forbidden cells in calculates a preferred footprint target according the obstacles’ map designate the parts of the to the locomotion parameters and the surround- environment that the 2D trajectory is going to ingenvironment(Figure11). Butthesecalcula- avoid and go around. This 2D trajectory passes tions do not take into consideration the actual through cells that have an elevation. The 3D state of the foot and its preferences (e.g. the path constructor uses this elevation to construct thefinal3Dtrajectory. Thesystemusesthisob- footprint target and 3D trajectory that this foot stacles’maptoprocessanobstacle: eithergoing should follow. We calculate the length of this arounditorgoingoverit. Ifthesystemwantsto 3D trajectory, and using the needed time given go around an obstacle, it just needs to add it to bythecharactercontroller,wemovethefooton the obstacles’ map as forbidden cells. In that thecurveataconstantspeed. way, the resulting 2D trajectory will definitely Trajectory scoring. We generate for each go around it. While if the system wants to go created 2D/3D trajectory a score based on the overanobstacle,itdoesnotneedtodoanything applicationspecifications,likethetotallengthof special as the obstacle is already present in thepath,theaccelerationandthecurvetangents the elevations map. And the obstacle will be profile, etc. For instance, the system shown in avoided accordingly based on its elevation. In theaccompanyingvideopreferstrajectoriesthat ordertoachievethisavoidancedistinctioninan are more straight (direct) with less curvature, optimal way in a complex environment (height a preference observed in biomechanics as it map plus obstacles), our system discretize the minimizestheenergycost[37,38]. elevations map on the Y-axis into slices (for instance slices of 10cm). For each slice, the 6 Level of Details techniques system fills the obstacles’ map with the cells (LOD) thathavehigherelevationthanthisslice. Inthat way, all calculated trajectories will go over all Ourmainalgorithm(Section5.2)executiontime obstacles,objectsandpiecesoftheenvironment can be controlled easily when simulating many that have an elevation lower or equal to the multi-legged characters in order to accelerate slice’selevation. Atthesametime,allcalculated the simulation itself. This comes from the trajectorieswillgoaroundallobstacles, objects ability of controlling the number of evaluated and pieces of the environment that have an ele- couples (target-trajectory) and from the ability vationhigherthanthechosenslice’selevation. of controlling the size of the slices used when Soeachtrajectorycangoaroundorovereach avoiding obstacles. But in order to always obstacle, which generates multiple trajectories have a plausible locomotion, we start applying toward a target. Each one of these trajecto- this LOD after we find the first valid couple ries has a score. Our search space is all the (target-trajectory), in this way we ensure that possible trajectories that go from the starting the algorithm will assign to each foot a valid pointtowardallthepossibletargets. Outofthis trajectorytowardavalidtarget(althoughitisnot multitude of possibilities, our main algorithm thebestcouple). picksupthebestcouple(target-trajectory)inan In our simulation and for off-screen charac- intelligentway. ters, the algorithm stops directly when finding Our algorithm (result shown on Figure 13) this first couple. While for the on-screen char- loops on all the possible targets based on their acters, we limit the number of couples evalu- score (in a descending way). For each one of ated after finding this first couple in a linear these targets, the algorithm first generates the way based on the distance of that multi-legged 2D trajectory and scores it, if the score of the character from the camera. In this way for far couple(target-trajectoryin2D)isbetterthanthe on-screen characters the algorithm stops also current best couple found till now, it continues. when it finds the first couple. In the same way, Thenitgeneratesthe3Dtrajectorybasedonthe for off-screen characters the algorithm tries to 2D one and scores it, if the score of the new go over any obstacle using no slices (not going couple(target-trajectoryin3D)isbetterthanthe around any obstacle). While for the on-screen currentbestcouple, thenittagsthisnewcouple characters,weincreasethesizeoftheslices(for as the best one and continues. The algorithm example10cm,15cm...noslices)inalinearway continuesevaluatingthecouplesuntilitreaches based on the distance of that character from the a couple (target-trajectory in 3D) with a score camera. ThisLODcanberegardedas: themore worse than the current best one, in this case it the character is far away from the camera (or stopsandthecurrentbestcoupleisthebestone. off-screen) the less our algorithm worries if the So,attheendofthealgorithmweobtainthebest chosen couple is comfortable. In next section Table1:Averagecomputationtimefor1008-leggedcharacters TotalforCharacters MapsPreparation CCDIKSystems AverageFPS LOD 0.026s 0.004s 0.013s ~30fps LODZoomed 0.028s 0.004s 0.006s ~30fps NoLOD 0.045s 0.004s 0.013s ~18fps we speak about the actual performance of our In LOD we make sure that all of the characters real-timesystem. are in the field of view of the camera, while in LOD Zoomed we zoom on one character and makesurethatatleast50%ofthecharactersare 7 Results shown on the screen. As we can observe, the In our implementation, the environment is rep- maps preparation is fixed, as it is pre-computed resented by two classes of objects: the terrain once,forallcharactersatthesametime. InLOD and the obstacles. A height map defines the Zoomed the system loses some computation terrainandisloadedwithoutanypre-processing time per character as there are more characters analysis (See Figure 11 ). The obstacles are doing full search for the best couple, while in mainly represented by crates with various sizes thesametimegainscomputationtimeintheIK and orientations randomly generated on the ter- systems as we do not calculate the IK for the rain (See Figure 1 and 14). These crates can be off-screencharacters. staticorcanmoveontheterrain(Seetheaccom- panying video). Without changing anything in 8 Conclusions the system, we have tested it on different kinds of terrain (flat surface, smooth terrain, regular We presented a system capable of procedu- stairs, etc.) with different kinds of obstacles rally generating believable locomotion anima- (static crates and moving ones). The size of the tion of several multi-legged characters (like discretization maps used in our tests is 70×70 arachnids, insects, or any imaginary n-legged with 7cm cells, which consumes little memory robots/creatures) in real-time with no a priori and is precise enough since the maps describe motion data nor any information about the en- only the environment close to each animated vironment. Our system is quite generic and can character. Theanimatedmulti-leggedcharacters beappliedonavarietyofmorphologies. Inrun- gaitsareinspiredfrombiologystudies[39,40] time the user can control many parameters like thethegait,thespeed,thedirection,etc. Nevertheless,thecurrentsystemassumesthat the feet of the character can be represented by a point. Our model does not include the feet’s metatarsus, which has a great impact on the naturalnessofthelocomotionwhenconsidering more complex characters. As a future work, it will be interesting to study this point, specially for bipeds/humans. And to study the addition ofaflexiblespine-likestructure,whichisessen- Figure14: Simulationsnapshot. tial when simulating quadrupeds [10]. We are The results show that our system is well also planning on improving the pelvis behavior adapted for real-time applications. In Fig- to incorporate dynamic-like balance reactions. ure14andintheaccompanyingvideoweshow Our system can serve as input to higher level many morphologically different characters ani- characters’controllersthatwouldliketoprovide matedinreal-timeusingourtestmachine(Core more animations than only the locomotion, like i7 2.7 GHZ, 8 GB RAM, 6870 ATI Radeon touching objects for discovering the environ- HD with 1GB vRam). Table 1 shows average ment,studyinginsect’sbehavior,etc. computation time for 100 8-legged characters.
Description: