World Space Servoing for Character Animation Under Simulation Pawel Wrotek Electronic Arts Chad Jenkins Brown University Morgan McGuire Williams College Character Motion • An integral part of modern video games FIFA 2006 (EA) San Andreas (Rockstar) Antigrav (Harmonix) Kinematic Character Motion • Expressed by rigid body kinematics – Rigid bodies connected by joints – Character pose defined by rotation of joints – Vector θ(t) represents pose at a given instant of time Issues with Canned Motion Physically Simulated Canned Mocap Issues with Canned Motion Physically Simulated Canned Mocap Issues with Canned Motion Physically Simulated Canned Mocap Motion Generation: Mocap and Keyframing • (+) path of least resistance • (+) absolute control “wyciwyg” • (-) not physically dynamic – static and partial snapshot of the dynamics occurred at the time of creation • Production animation, not interactive games God of War 2 (Sony) Motion Generation: Procedural Animation • Rules/algorithms to automatically generate motion • Three categories of approaches: – Indirectly emulate physical plausibility • [Perlin,Goldberg 94] [Popovic, Witkin 99] [Kovar et al. 02] – Simulate physics only when necessary • [Shapiro et al. 03] [Zordan et al. 05] – Simulate physics directly and persistently • [Hodgins et al. 95] [Laszlo et al. 00] Procedural Animation • Indirectly emulate physical plausibility – Scripting [Perlin,Goldberg 94] – Blending [Rose et al. 98] – Optimization [Liu et al. 05] [Arikan et al. 03] (+) creators retain control Creators define all rules for movement (-) violates the “checks and balances” of motion Motion control abuses its power over physics (-) limits emergent behavior Procedural Animation • Simulate physics directly – Ragdolls – Controllers to generate motor forces [Zordan, Hodgins 02] [Faloutsos et al. 01] [Popovic et al. 00] – (+) proper “separation of powers” • Physics, control, AI Controller • Allows for emergent, natural interactions – (-) inherit problems that plague robotics Physics Procedural Animation • Simulate physics only when necessary – Dynamic response: [Shapiro et al. 03] [Zordan et al. 2005] [Natural Motion Endorphin] – Mocap for “normal” dynamics – Simulation for disturbance dynamics (+) the best of mocap and simulation (-) limited to passive response • Falling, getting hit, etc. • No persistent interaction Fundamental Question • Can we have practical methods for physically simulated characters? • Revisit the broader picture for autonomous control – Decision making (AI): objectives, current state (x[t]) → desired motion (xd[t]) – Motion Control: desired motion (xd[t]), current state (x[t]) → motor forces (u[t]) – Physics: current state (x[t]) → next state (x[t+1]) xd[t]=AI(x[t]) objectives Decision Making u[t]=MC(xd[t]-x[t]) xd[t] Motion Control x[t+1]=P(x[t],u[t]) u[t] x[t+1] Physics The Autonomous Physical Motion Control Problem xd[t]=AI(x[t]) objectives Decision Making u[t]=MC(xd[t]-x[t]) xd[t] Motion Control x[t+1]=P(x[t],u[t]) u[t] x[t+1] Physics The Autonomous Physical Motion Control Problem xd[t]=AI(x[t]) objectives Decision Making u[t]=MC(xd[t]-x[t]) xd[t] Motion Control u[t] x[t+1] • Simulating physics – Download ODE – Buy Havoc – Implement Guendelman et al. 03 The Autonomous Motion Control Problem u[t]=MC(xd[t]-x[t]) Mocap data xd[t] Motion Control u[t] x[t+1] • AI for autonomous decision making – Someone else’s problem – Interface point for decision making – Focus on motion control • Motion capture as decision making placeholder Motion Control: Impediments u[t]=MC(xd[t]-x[t]) Mocap data xd[t] Motion Control u[t] x[t+1] • Gain tuning for motion control • Maintaining upright balance Motion Control: Impediments u[t]=MC(xd[t]-x[t]) Mocap data xd[t] Motion Control u[t] x[t+1] • Gain tuning for motion control • Maintaining upright balance Problem: parent space control? Motion Control: Impediments u[t]=MC(xd[t]-x[t]) Mocap data xd[t] Motion Control u[t] x[t+1] • Gain tuning for motion control • Maintaining upright balance Problem: parent space control? Solution: world space control! Segway Analogy • Parent space – Wheel-centric coordinates Segway Analogy • Parent space – Wheel-centric coordinates • Wheel rotation = you falling Segway Analogy • Parent space – Wheel-centric coordinates • Wheel rotation = you falling • Artifact of rotational sensing Segway Analogy • World space – Earth-centric coordinates – Sensed by MEMS accelerometers – Separate rider and wheel orientation Feedback Motion Control • Parent PD-servo – Torque u about an axis . . u[t]=kp(θd[t] - θ[t]) + kd(θd[t] - θ[t]) u • Appropriate kp and kd values need for stable control – Tedious and difficult to find critical damping D. Brogan World Space PD-Servo τ = kp (v · θ) + kd (ωd – ωa) Wd = desired world space rotation matrix θ Wa = actual world space rotation matrix Wa T = Wd * Wa-1 (transformation from Wa to Wd) v, θ = rotation axis, angle derived from T ωd = desired world space angular velocity ωa = actual world space angular velocity Wd v A Note about Axis-Angle (Source code in our Sandbox paper) • Torques determined by desired angular acceleration – i.e., Proportional to 2nd derivative of rotation • 1D Hinge [Hodgins95]: t 2q/t2 • 3D Ball joint: t 2[rotation]/t2 – …but Matrix/Quat derivatives produce denormalized results under ODE’s Euler integration and are awkward to convert to torques – Rotation axis is fixed anyway during the Euler timestep, so reduce to a 1D problem… • 3D Ball joint: 2q t v 2 ; [q , v ] axisAngle( M t 1M t10 ) t Early Results • Gain Tuning • Cartwheel with object More Recent Results • Obstacle course – Parent space Parent space – World space • User interaction • Balance comparison • In-game boxing Dynamo More Recent Results • • • • Obstacle course User interaction Balance comparison In-game boxing More Recent Results • Obstacle course • User interaction • Balance comparison – Green: world space – Orange: person space – Purple: person w/ knockout • In-game boxing More Recent Results • • • • Obstacle course User interaction Balance comparison In-game boxing Future Work • AI for goal-oriented motion generation • Experimental parent vs. world analysis • Biomechanical character constraints • Embodied perception Conclusion • Physically dynamic characters are practical • World-space control yields – Implicit character balance – Easier gain tuning • Path to emergent behavior for interactive characters Acknowledgements • • • • • • NSF Award IIS-0534858 Dan Byers Sam Howell mocap.cs.cmu.edu G3D and ODE user communities “Innovating Game Development” Guest Lecturers • A-Lab RoboCup Dynamical Soccer • cjenkins@cs.brown.edu • morgan@cs.williams.edu