1 / 67

Skeletons

Skeletons. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004. Linear Algebra Review. Coordinate Systems. Right handed coordinate system. Vector Arithmetic. Vector Magnitude. The magnitude (length) of a vector is: Unit vector (magnitude=1.0). Dot Product.

monifa
Télécharger la présentation

Skeletons

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Skeletons CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004

  2. Linear Algebra Review

  3. Coordinate Systems • Right handed coordinate system

  4. Vector Arithmetic

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

  6. Dot Product

  7. Example: Angle Between Vectors • How do you find the angle θ between vectors A and B? b θ=? a

  8. Example: Angle Between Vectors b θ a

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

  10. 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

  11. 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

  12. *Example: Distance to Plane

  13. Cross Product

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

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

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

  17. 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

  18. Example: Alignment to Target a t t-p • θ • p h

  19. 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

  20. 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 = BT·AT

  21. 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

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

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

  24. Skeletons

  25. Kinematics • 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…) • Note: Kinematics is an entire branch of mathematics and there are several other aspects of kinematics that don’t fall into the ‘forward’ or ‘inverse’ description

  26. Skeletons • Skeleton: A pose-able framework of joints arranged in a tree structure. The skeleton is used as an invisible armature to manipulate the skin and other geometric data of the character • Joint: A joint allows relative movement within the skeleton. Joints are essentially 4x4 matrix transformations. Joints can be rotational, translational, or some non-realistic types as well • Bone: Bone is really just a synonym for joint for the most part. For example, one might refer to the shoulder joint or upper arm bone (humerus) and mean the same thing

  27. 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 • In later weeks, we will extend the concept of a DOF to be any animatable parameter within the character rig • Note: in a mathematical sense, a free rigid body has 6 DOFs: 3 for position and 3 for rotation

  28. Example Joint Hierarchy

  29. Joints • Core Joint 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…)

  30. 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.

  31. 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

  32. 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

  33. 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

  34. Skeleton Rigging • Setting up the skeleton is an important and early part of the rigging process • Sometimes, character skeletons are built before the skin, while other times, it is the opposite • To set up a skeleton, an artist uses an interactive tool to: • Construct the tree • Place joint offsets • Configure joint types • Specify joint limits • Possibly more…

  35. Poses • Once the skeleton is set up, 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 • Keep in mind that DOFs can be also used for things other than joints, as we will learn later…

  36. Joint Types

  37. Rotational 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 Etc. Design your own... Joint Types

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

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

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

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

  42. 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

  43. 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

  44. Quaternions

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

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

  47. Other Joints • Compound • Free • Screw • Constraint • Etc. • Non-Rigid • Scale (1 axis, 3 axis, volume preserving…) • Shear • Etc.

  48. Programming Project #1: Skeleton

  49. Software Architecture • Object oriented • Make objects for things that should be objects • Avoid global data & functions • Encapsulate information • Provide useful interfaces • Put different objects in different files

  50. Sample Code • Some sample code is provided on the course web page listed as ‘project0’ • It is an object oriented demo of a spinning cube • Classes: • Vector3 • Matrix34 • Tokenizer • Camera • SpinningCube • Tester

More Related