Lecture 2: linear algebra, animation basics

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Homogeneous Transformations CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Transformations Ed Angel Professor Emeritus of Computer Science
Computer Graphics Lecture 4 Geometry & Transformations.
Links and Joints.
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
Advanced Programming for 3D Applications CE Bob Hobbs Staffordshire university Data Structures for Human Motion Lecture 5.
Forward Kinematics. Focus on links chains May be combined in a tree structure Degrees of Freedom Number of independent position variables (i.e. joints.
Skeletons CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
Character Animation CSE 191A: Seminar on Video Game Programming Lecture 5: Character Animation UCSD, Spring, 2003 Instructor: Steve Rotenberg.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
3D orientation.
Computer Graphics CSC 630 Lecture 2- Linear Algebra.
Skeletons CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Midterm Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Transformations. 2 Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple geometry, most of us.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics (Fall 2005) COMS 4160, Lecture 2: Review of Basic Math
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CSE 473 Dr. Charles B. Owen Fundamentals of 3D Game Development1 Skeletons and Skinning Bones and Skeletons Mesh Skinning.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
An Introduction to Robot Kinematics
ME/ECE Professor N. J. Ferrier Forward Kinematics Professor Nicola Ferrier ME Room 2246,
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 2: Review of Basic Math
Advanced Graphics (and Animation) Spring 2002
Rotations and Translations
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Chapter 4.1 Mathematical Concepts
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Skeletons and Skinning Bones and Skeletons Mesh Skinning Chapter 17 in the textbook.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Kinematics of Robot Manipulator
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
Chapter 2 Robot Kinematics: Position Analysis
CSCE 552 Spring 2011 Math By Jijun Tang. Layered.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
Multimedia System and Networking UTD Slide- 1 University of Texas at Dallas B. Prabhakaran Combining Transformations We see that we can combine a.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Robot Kinematics: Position Analysis 2.1 INTRODUCTION  Forward Kinematics: to determine where the robot ’ s hand is? (If all joint variables are known)
What is Kinematics. Kinematics studies the motion of bodies.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
FROM PARTICLE TO RIGID BODY.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Computer Graphics Lecture 11 2D Transformations I Taqdees A. Siddiqi
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry "Old Henry And His Old Aunt" Defined using right triangle  x y h.
CGDD 4003 Character Animation. The Skeletal Hierarchy (aka the “rig”) Based on the concept of bones Each bone has exactly one parent Each bone has a transform.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
CSE 167 [Win 17], Lecture 2: Review of Basic Math Ravi Ramamoorthi
Lecture 03: Linear Algebra
Skeletons and Skinning
Chapter XIII Character Animation
Computer Graphics Lecture 15.
Math review - scalars, vectors, and matrices
Combining Transformations
Presentation transcript:

Lecture 2: linear algebra, animation basics Computer Animation

Vector Arithmetic

Vector Magnitude The magnitude (length) of a vector is: Unit vector (magnitude=1.0)

Dot Product

Example: Angle Between Vectors How do you find the angle θ between vectors a and b? b θ a

Example: Angle Between Vectors θ a

Dot Products with Unit Vectors 0 < a·b < 1 a·b = 0 a·b = 1 b θ a -1 < a·b < 0 a·b a·b = -1

Dot Products with Non-Unit Vectors If a and b are arbitrary (non-unit) vectors, then the following are still true: If θ < 90º then a·b > 0 If θ = 90º then a·b = 0 If θ > 90º then a·b < 0

Dot Products with One Unit Vector If |u|=1.0 then a·u is the length of the projection of a onto u a u a·u

Cross Product

Properties of the Cross Product area of parallelogram ab if a and b are parallel is perpendicular to both a and b, in the direction defined by the right hand rule

Example: Area of a Triangle Find the area of the triangle defined by 3D points a, b, and c c b a

Example: Area of a Triangle c c-a b a b-a

Example: Alignment to Target An object is at position p with a unit length heading of h. We want to rotate it so that the heading is facing some target t. Find a unit axis a and an angle θ to rotate around. t • • p h

Example: Alignment to Target t-p t • • θ p h

Trigonometry cos2θ + sin2θ = 1 1.0 sin θ θ cos θ

Laws of Sines and Cosines Law of Sines: Law of Cosines: b α γ c a β

Matrices Computer graphics apps commonly use 4x4 homogeneous matrices A rigid 4x4 matrix transformation looks like this: Where a, b, & c are orthogonal unit length vectors representing orientation, and d is a vector representing position In mathematics, a rigid transformation or a Euclidean transformation is a transformation from a Euclidean space to itself that preserves distances between every pair of points (isometry). In particular, any object will have the same shape and size before and after a rigid transformation.

Matrices The right hand column can cause a projection, which we won’t use in character animation, so we leave it as 0,0,0,1 Some books store their matrices in a transposed form. This is fine as long as you remember that: (A·B)T = BT·AT

Orthonormality If all row vectors and all column vectors of a matrix are unit length, that matrix is said to be orthonormal This also implies that all vectors are perpendicular to each other Orthonormal matrices have some useful mathematical properties, such as: M-1 = MT

Orthonormality If a 4x4 matrix represents a rigid transformation, then the upper 3x3 portion will be orthonormal

Determinants The determinant of a 4x4 matrix with no projection is equal to the determinant of the upper 3x3 portion

Determinants The determinant is a scalar value that represents the volume change that the transformation will cause An orthonormal matrix will have a determinant of 1, but non-orthonormal volume preserving matrices will have a determinant of 1 also A flattened or degenerate matrix has a determinant of 0 A matrix that has been mirrored will have a negative determinant

Transformations To transform a vector v by matrix M: v’=v·M If we want to apply several transformations, we can just multiply by several matrices: v’=(((v·M1)·M2)·M3)·M4… Or we can concatenate the transformations into a single matrix: Mtotal=M1·M2·M3·M4… v’=v·Mtotal

Matrix Transformations We usually transform vertices from some local space where they are defined into a world space v’ = v·W Once in world space, we can perform operations that require everything to be in the same space (collision detection, high quality lighting…) Then, they are transformed into a camera’s space, and then projected into 2D v’’ = v’·C-1·P In simple situations, we can do this all in one step: v’’ = v·W·C-1·P

Inversion If M transforms v into world space, then M-1 transforms v’ back into local space

Vector Dot Vector

Vector Dot Matrix

Matrix Dot Matrix

Homogeneous Vectors Technically, homogeneous vectors are 4D vectors that get projected into the 3D w=1 space

Homogeneous Vectors Vectors representing a position in 3D space can just be written as: Vectors representing direction are written: The only time the w coordinate will be something other than 0 or 1 is in the projection phase of rendering, which is not our problem

Position Vector Dot Matrix

Position Vector Dot Matrix y v=(.5,.5,0,1) x (0,0,0) Local Space

Position Vector Dot Matrix b Matrix M y y d a v=(.5,.5,0,1) x x (0,0,0) (0,0,0) Local Space World Space

Position Vector Dot Matrix b v’ y y d a v=(.5,.5,0,1) x x (0,0,0) (0,0,0) Local Space World Space

Direction Vector Dot Matrix

Matrix Dot Matrix (4x4) The row vectors of M’ are the row vectors of M transformed by matrix N Notice that a, b, and c transform as direction vectors and d transforms as a position

Identity Take one more look at the identity matrix It’s a axis lines up with x, b lines up with y, and c lines up with z Position d is at the origin Therefore, it represents a transformation with no rotation or translation

Animation basics

Animation Process Interactive vs. Non-Interactive while (!finished) { UpdateEverything(); DrawEverything(); } Interactive vs. Non-Interactive Real Time vs. Non-Real Time

Frame Rates Film 24 fps Imax 48 fps NTSC TV 30 fps (interlaced) PAL TV 25 fps (interlaced) HDTV 50-60 fps Computer >60 fps

Animation Tools Animation tools: Game/graphics engines: Maya 3D Studio Max MotionBuilder Blender Game/graphics engines: OGRE3D Unity Unreal

Virtual Characters Applications of animated characters Health Analyzing walking styles Analyzing muscle activations Analyzing joint movement limits Ergonomics Usability of devices Measuring comfort Safety Simulated worlds for crisis management Entertainment Games, movies

Virtual Characters Different approaches: Keyframe animation Motion Capture Physics-based animation Procedural animation

Virtual Characters Different levels of character motion

Virtual Characters Representation: skeletal model A VH is represented by a polyhedral model (or mesh) An underlying skeleton deforms this mesh Joints, connected by bones A pose is defined by the rotations of the joints and the position of the root joint Several standards H-Anim

Kinematics Kinematics Forward Kinematics Inverse Kinematics The analysis of motion independent of physical forces. Kinematics deals with position, velocity, acceleration, and their rotational counterparts, orientation, angular velocity, and angular acceleration. Forward Kinematics The process of computing world space geometric data from DOFs Inverse Kinematics The process of computing a set of DOFs that causes some world space goal to be met (I.e., place the hand on the door knob…)

Skeletons Skeleton Joint A pose-able framework of joints arranged in a tree structure. Joint Allows relative movement within the skeleton. Are essentially 4x4 matrix transformations Can be rotational, translational, or other Synonym: bone

DOFs Degree of Freedom (DOF) A variable φ describing a particular axis or dimension of movement within a joint Joints typically have around 1-6 DOFs (φ1…φN) Changing the DOF values over time results in the animation of the skeleton Note: in a mathematical sense, a free rigid body has 6 DOFs: 3 for position and 3 for rotation

Example Joint Hierarchy

Joints Core Joint Data Additional Data DOFs (N floats) Local matrix: L World matrix: W Additional Data Joint offset vector: r DOF limits (min & max value per DOF) Type-specific data (rotation/translation axes, constants…) Tree data (pointers to children, siblings, parent…)

Skeleton Posing Process Specify all DOF values for the skeleton (done by higher level animation system) Recursively traverse through the hierarchy starting at the root and use forward kinematics to compute the world matrices (done by skeleton system) Use world matrices to deform skin & render (done by skin system) Note: the matrices can also be used for other things such as collision detection, FX, etc.

Forward Kinematics In the recursive tree traversal, each joint first computes its local matrix L based on the values of its DOFs and some formula representative of the joint type: Local matrix L = Ljoint(φ1,φ2,…,φN) Then, world matrix W is computed by concatenating L with the world matrix of the parent joint World matrix W = L · Wparent

Joint Offsets It is convenient to have a 3D offset vector r for every joint which represents its pivot point relative to its parent’s matrix

DOF Limits It is nice to be able to limit a DOF to some range (for example, the elbow could be limited from 0º to 150º) Usually, in a realistic character, all DOFs will be limited except the ones controlling the root

Poses One can then adjust each of the DOFs to specify the pose of the skeleton We can define a pose Φ more formally as a vector of N numbers that maps to a set of DOFs in the skeleton Φ = [φ1 φ2 … φN] A pose is a convenient unit that can be manipulated by a higher level animation system and then handed down to the skeleton Usually, each joint will have around 1-6 DOFs, but an entire character might have 100+ DOFs in the skeleton

Joint Types

Joint Types Rotational Translational Compound Non-Rigid Hinge: 1-DOF Universal: 2-DOF Ball & Socket: 3-DOF Euler Angles Quaternions Translational Prismatic: 1-DOF Translational: 3-DOF (or any number) Compound Free Screw Constraint Etc. Non-Rigid Scale Shear Design your own...

Hinge Joints (1-DOF Rotational) Rotation around the x-axis:

Hinge Joints (1-DOF Rotational) Rotation around the y-axis:

Hinge Joints (1-DOF Rotational) Rotation around the z-axis:

Hinge Joints (1-DOF Rotational) Rotation around an arbitrary axis a:

Universal Joints (2-DOF) For a 2-DOF joint that first rotates around x and then around y: Different matrices can be formed for different axis combinations

Ball & Socket (3-DOF) For a 3-DOF joint that first rotates around x, y, then z: Different matrices can be formed for different axis combinations

Quaternions

Prismatic Joints (1-DOF Translation) 1-DOF translation along an arbitrary axis a:

Translational Joints (3-DOF) For a more general 3-DOF translation: