Maths in Motion. Danny Chapman Cumberland Lodge - February Version for distribution. Procedural animation in video games

Similar documents
CS 775: Advanced Computer Graphics. Lecture 3 : Kinematics

Homework 2 Questions? Animation, Motion Capture, & Inverse Kinematics. Velocity Interpolation. Handing Free Surface with MAC

4 Kinematic Linkages. Chapter 4. Kinematic Linkages. Department of Computer Science and Engineering 4-1

Computer Animation. Rick Parent

Overview. Animation is a big topic We will concentrate on character animation as is used in many games today. humans, animals, monsters, robots, etc.

Animation, Motion Capture, & Inverse Kinematics. Announcements: Quiz

A simple example. Assume we want to find the change in the rotation angles to get the end effector to G. Effect of changing s

Inverse Kinematics (part 1) CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2018

Articulated Characters

Applications. Human and animal motion Robotics control Hair Plants Molecular motion

Last Time? Animation, Motion Capture, & Inverse Kinematics. Today. Keyframing. Physically-Based Animation. Procedural Animation

Last Time? Animation, Motion Capture, & Inverse Kinematics. Today. Keyframing. Physically-Based Animation. Procedural Animation

Announcements: Quiz. Animation, Motion Capture, & Inverse Kinematics. Last Time? Today: How do we Animate? Keyframing. Procedural Animation

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Motion Capture & Simulation

animation projects in digital art animation 2009 fabio pellacini 1

Last Time? Inverse Kinematics. Today. Keyframing. Physically-Based Animation. Procedural Animation

Advanced Graphics and Animation

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Jacobian: Velocities and Static Forces 1/4

Character Animation 1

Animation, Motion Capture, & Inverse Kinematics

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Motion Synthesis and Editing. Yisheng Chen

Game Programming. Bing-Yu Chen National Taiwan University

Animation. CS 4620 Lecture 33. Cornell CS4620 Fall Kavita Bala

Character Animation. Presented by: Pam Chow

Kinematics. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

Rigging / Skinning. based on Taku Komura, Jehee Lee and Charles B.Own's slides

Animation. CS 465 Lecture 22

Lecture VI: Constraints and Controllers. Parts Based on Erin Catto s Box2D Tutorial

Inverse Kinematics. Given a desired position (p) & orientation (R) of the end-effector

Motion Capture. Motion Capture in Movies. Motion Capture in Games

KINEMATICS FOR ANIMATION. Rémi Ronfard, Animation, M2R MOSIG

Introduction to Computer Graphics. Animation (1) May 19, 2016 Kenshi Takayama

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

A Detailed Look into Forward and Inverse Kinematics

MTRX4700 Experimental Robotics

DYNAMICS FOR ANIMATION. Rémi Ronfard, Animation, M2R MOSIG

CS 231. Inverse Kinematics Intro to Motion Capture. 3D characters. Representation. 1) Skeleton Origin (root) Joint centers/ bones lengths

COMP 175 COMPUTER GRAPHICS. Lecture 10: Animation. COMP 175: Computer Graphics March 12, Erik Anderson 08 Animation

Robots are built to accomplish complex and difficult tasks that require highly non-linear motions.

animation computer graphics animation 2009 fabio pellacini 1 animation shape specification as a function of time

Humanoid Robotics. Inverse Kinematics and Whole-Body Motion Planning. Maren Bennewitz

Kinematical Animation.

Table of Contents. Chapter 1. Modeling and Identification of Serial Robots... 1 Wisama KHALIL and Etienne DOMBRE

animation computer graphics animation 2009 fabio pellacini 1

CS-184: Computer Graphics. Today. Forward kinematics Inverse kinematics. Wednesday, November 12, Pin joints Ball joints Prismatic joints

Animation by Adaptation Tutorial 1: Animation Basics

Jacobian: Velocities and Static Forces 1/4

autorob.github.io Inverse Kinematics UM EECS 398/598 - autorob.github.io

Triangulation: A new algorithm for Inverse Kinematics

Humanoid Robotics. Inverse Kinematics and Whole-Body Motion Planning. Maren Bennewitz

Lecture VI: Constraints and Controllers

CSE452 Computer Graphics

Chapter 5.2 Character Animation

Motion Control Methods for Skeleton Daniel Thalmann

CS 4620 Program #2: Character Animation

Lecture «Robot Dynamics»: Kinematic Control

Robotics I. March 27, 2018

Lesson 1: Introduction to Pro/MECHANICA Motion

Animation Lecture 10 Slide Fall 2003

Inverse Kinematics II and Motion Capture

Computer Animation. Algorithms and Techniques. z< MORGAN KAUFMANN PUBLISHERS. Rick Parent Ohio State University AN IMPRINT OF ELSEVIER SCIENCE

Kinematics, Kinematics Chains CS 685

CS 231. Inverse Kinematics Intro to Motion Capture

Computer Animation II

Animation. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 4/23/07 1

Modeling Physically Simulated Characters with Motion Networks

Kinematics: Intro. Kinematics is study of motion

2. Motion Analysis - Sim-Mechanics

Human body animation. Computer Animation. Human Body Animation. Skeletal Animation

Ragdoll Physics. Abstract. 2 Background. 1 Introduction. Gabe Mulley, Matt Bittarelli. April 25th, Previous Work

Jacobians. 6.1 Linearized Kinematics. Y: = k2( e6)

COMP30019 Graphics and Interaction Kinematics

Animations. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Kavita Bala

PPGEE Robot Dynamics I

This week. CENG 732 Computer Animation. Warping an Object. Warping an Object. 2D Grid Deformation. Warping an Object.

Controlling Reactive, Motion Capture-driven Simulated Characters

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Robotics kinematics and Dynamics

Over-determinate Kinematic Analysis

Autonomous and Mobile Robotics Prof. Giuseppe Oriolo. Humanoid Robots 2: Dynamic Modeling

Lecture 18 Kinematic Chains

Kinematics. Why inverse? The study of motion without regard to the forces that cause it. Forward kinematics. Inverse kinematics

Kinematics and Orientations

Introduction to Robotics

Cecilia Laschi The BioRobotics Institute Scuola Superiore Sant Anna, Pisa

Why animate humans? Why is this hard? Aspects of the Problem. These lectures. Animation Apreciation 101

Chapter 4 Dynamics. Part Constrained Kinematics and Dynamics. Mobile Robotics - Prof Alonzo Kelly, CMU RI

ROSE-HULMAN INSTITUTE OF TECHNOLOGY

Serial Manipulator Statics. Robotics. Serial Manipulator Statics. Vladimír Smutný

NMT EE 589 & UNM ME 482/582 ROBOT ENGINEERING. Dr. Stephen Bruder NMT EE 589 & UNM ME 482/582

Simulation. x i. x i+1. degrees of freedom equations of motion. Newtonian laws gravity. ground contact forces

Lecture 2: Kinematics of medical robotics

Parallel Robots. Mechanics and Control H AMID D. TAG HI RAD. CRC Press. Taylor & Francis Group. Taylor & Francis Croup, Boca Raton London NewYoric

Kinematic Synthesis. October 6, 2015 Mark Plecnik

02/22/02. Assignment 1 on the web page: Announcements. Test login procedure NOW!

MOTION CAPTURE DATA PROCESSING - MOTION EDITING / RETARGETING - MOTION CONTROL / GRAPH - INVERSE KINEMATIC. Alexandre Meyer Master Informatique

The University of Missouri - Columbia Electrical & Computer Engineering Department EE4330 Robotic Control and Intelligence

Transcription:

Maths in Motion Procedural animation in video games Danny Chapman Cumberland Lodge - February 2017 Version for distribution

01_BipedLearning

02_SIG05_Showreel - Endorphin

Types of animation Types of motion: Kinematic: Motion without regard to physics (mass or forces) Dynamic: Motion as a result of forces Methods: Forward: Generating motion given the starting point and controls Inverse: Generating controls given the start and end states

Kinematics Forward Inverse Dynamics Key-framed animation Motion-capture data Ocean wave emulation (using spectral synthesis) Rigid body simulation Soft body simulation Water/fluid simulation Characters: Reach a point Part of robot motion planning Biomechanics. Robotics. Goal-orientated (physical) behaviours

03_ClumsyNinjaDemo

Clumsy Ninja Forward dynamics Forward kinematics Inverse kinematics Inverse dynamics

Navigating a skeletal hierarchy F2 F3 F1 3 P P F0 0 P Each bone coordinate frame indicates where it is relative to its parent, and how to transform points/frames into its parent space: Point P can be expressed in frame 2F3 by 3P If we want it in the world frame, then 0P = 0F1 1F2 2F3 3P Where the Fs operate on their right (details depend on whether they are implemented as 4x4 matrices, quaternion plus translation etc.)

Interpolating and blending To blend between two poses (A and C), just interpolate each frame (indexed by i): Bi(t) = interp(ai, Ci, t) Position: just PB = t PA + (1 - t) PC for each frame Orientation: RB = t RA + (1 - t) RC and orthonormalise... or (better) slerp quaternions

Motion matching Three steps: 1. Record lots of motion (typically mocap) 2. Each update, tell the system what kind of motion you want. 3. System gives you a new animation frame that is consistent with: a. b. What it was doing previously What you want. Automatically select and play frames from a (long) animation clip containing all desired movement, based on a requested movement: No more blends and transitions! Motion Field for Interactive Character Animation: Yongjoon Lee, Kevin Wampler, Gilbert Bernstein, Jovan Popović, Zoran Popović - ACM Transactions on Graphics 29(5) (SIGGRAPH Asia 2010)

Motion matching - preprocessing step For every frame in your source animation (40 minutes @ 30FPS = 72k frames): Calculate the velocity of the root The trajectory out to 1 sec in the future The trajectory back to 1 sec in the past The position of a few bones relative to the root - e.g. the feet. Big animation clip - 72k frames Root motion from above: Extra data stored with each frame

Motion matching - at runtime Predicted path Current pose History Cost function measures the difference between each of the 72k candidate frames, and our current/history/predicted state. Pick the source frame that minimises the cost function. 30 times a second per character (budget is < 1ms)! Nice optimisation problem (e.g. nearest neighbours search to get candidates in an 18 dimensional space).

Ubisoft: Motion Matching

Inverse Kinematics If the chain starts at the origin, and each joint is determined by joint parameters θ1,...,θn (each 3x1) then the frame of the last joint (effector) is 0 FN(θ1,...,θN) = 0F1(θ1) 1F2(θ2)... N-1FN(θN) Let the end joint be called an effector. Effector state vector is the position and world-space orientation of 0FN s(θ1,...,θn) = [px py pz Ψ Θ Φ]T If we have a target state t we want s(θ1,...,θn) = t Need to determine [θ1,...,θn] by inverting this relationship.

Approaches to IK Methods Analytical/closed form - e.g. 2 links + pole vector Blend based - interpolate N poses Cyclic Coordinate Descent (CCD) Jacobian inverse Generic optimisation Considerations Speed & memory Style control - do animators like cost functions, or can they pass in a pose? Handling of additional constraints (joint limits) Behaviour with hard/impossible targets

Jacobian inverse solvers Forwards kinematics equation: s = f(θ) s is the position/orientation of an end effector (or multiple), Θ is the N joint angles in the chain(s). Differentiate: ds = df(θ)/dθ dθ = J dθ 6x1 = 6xN Jacobian J tells us how s will move if the joint angles are changed. Nx1

Solving Invert the FK Jacobian equation, calculate the error e = s = t - s, assume linearity: Θ J-1 e Solution method: Start from a pose Calculate J and invert it Integrate a few times (calculating J each iteration) Problems: Assumption of linearity is very poor when J is nearly singular J doesn t generally have an inverse - need something in place of J-1 Transpose can be used, but is not good...

Pseudo-inverse J dθ = ds J dθ = ( J JT) (J JT)-1 ds = J JT (J JT)-1 ds dθ = JT (J JT)-1 ds dθ = J ds with J = JT (J JT)-1 J is 6xN but J JT is 6x6 The pseudo-inverse is a true solution Can improve behaviour near singularities using a damped least squares term: J = JT (J JT + λi)-1 Add additional terms to apply other constraints (centre of gravity), bias away from limits, null-space projection for redundancy control.

Ikinema - Recreate complete characters based on tracking a few body parts

Simulation of rigid bodies Constant: Surface properties Mass and moments of inertia Collision geometry (shape) - may or may not be the same as what is drawn. Varying: Position P = [Px Py Pz]T Orientation R - 3x3 matrix or a quaternion Velocity V = [Vx Vy Vz]T Angular velocity w = (wx wy wz)t

Forwards dynamics Newton-Euler equations for a rigid body: dr/dt = v dq/dt = 1/2 ω q m a = m dv/dt = F I dω/dt = - ω x I ω Update in steps of t: Integrate v and ω to give new r and q Accumulate forces F and torques Integrate to give new v and ω

Calculating forces and impulses Impulse J = F t Inelastic collision so want v = -v Mass = m v Impulse J = m v = -m v Immovable object

Calculating impulses Two movable rigid bodies, single contact point: If frictionless then any impulse is normal to the contact Apply impulse jc along N on body A (-jc on body B) Desired change in relative velocity at contact: vc = N vc jc = me vc if vc > 0 A N B jc = 0 otherwise Where me is an effective mass - depends only on the geometry, mass and inertia properties.

Featherstone s articulated body method Maximal coordinates: Reduced coordinates: 12 links 6 DoF for each Root link provides 6 DoF Simulate 72 DoF in total 11 revolute joints provide 33 DoF Apply 11 revolute joint constraints to remove 33 DoF Simulate 39 DoF. Featherstone s method: Solves the unconstrained motion of the articulation as a single entity. Response of the whole articulation to localised forces/impulses (like me). Internal joint constraints cannot be violated. Hard to understand and implement!

Multiple constraints Multiple bodies and constraints: Each impulse ijc affects not just ivc but all connected contacts. Can solve as a (mixed) linear complementarity problem with (big) arrays representing the effective mass matrix etc. Exact solvers (Pivoting): They re exact, but no way to trade speed for accuracy. An exact solve of a unrealistic system is sometimes very bad (e.g. conflicting constraints), or doesn t exist. Iterative (Projected Gauss-Seidel): Well behaved. Can terminate early - speed/accuracy trade-off. Don t even need to form the matrix representation.

GPU based simulation Nvidia - PhysX

Control of physical characters Realistic Modeling of Bird Flight Animations - Wu, J and Popović, Z

Learning bicycle stunts - Tan, Gu, Liu & Turk

Complete list of games using optimal control techniques on characters:

Inverse Dynamics: Making things happen Forwards Dynamics: Calculate motion given control inputs. Inverse Dynamics: Calculate control inputs given observed/desired motion. For biomechanics and robotics: Observed/desired motion may be known exactly. Research in trajectory optimisation, underactuated robotics etc. For games: Create a virtual stuntman

08_Euphoria

Dynamic control in games Is this the future? Emergent gameplay Unique game moments Links with robotics, UAVs etc We can cheat! The challenges: Hard problem Computationally expensive Game designers lose control Multiplayer and determinacy

Summary Thanks to NaturalMotion - http://www.naturalmotion.com and Clumsy Ninja (ios and Android)

Internships and opportunities @ NaturalMotion: http://www.naturalmotion.com/ http://www.eurogamer.net/articles/2017-02-12-one-thing-about-gta4-has-never-been-bettered