1 / 57

Midterm Review

Midterm Review. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004. Project 3. Load an .anim file and play back a keyframed animation on a skinned character Extra Credit: Display the channel curve (1 point) Simple channel editor (2 points). Anim File. animation {

shad-roach
Download Presentation

Midterm Review

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. Midterm Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004

  2. Project 3 • Load an .anim file and play back a keyframed animation on a skinned character • Extra Credit: • Display the channel curve (1 point) • Simple channel editor (2 points)

  3. Anim File animation { range [time_start] [time_end] numchannels [num] channel { extrapolate [extrap_in] [extrap_out] keys [numkeys] { [time] [value] [tangent_in] [tangent_out] … } } channel … }

  4. Project 3 • The first 3 channels will be the root translation (x,y,z) • After that, there will be 3 rotational channels for every joint (x,y,z) in the same order that the joints are listed in the .skel file

  5. Project 3 • Suggested classes: • Keyframe: stores time, value, tangents, cubics… • Channel: stores an array (or list) of Keyframes • Animation: stores an array of Channels • Player: stores pointer to an animation & pointer to skeleton. Keeps track of time, accesses animation data & poses the skeleton. • Optional: • Rig: simple container for a skeleton, skin, and morphs • Pose: array of floats (or just use stl vector) • ChannelEditor: it’s always nice to separate editor classes from the data that they edit

  6. Linear Algebra Review

  7. Key Math Concepts • Vectors (dot & cross products…) • Matrices (& systems of equations) • Homogeneous vectors & matrices • Transformations, inverse transformations • Viewing, cameras • Euler angles • Quaternions • Summation (weighted sum, average, convex) • Cubic equations • Interpolation, splines, radial basis functions

  8. Vector Arithmetic

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

  10. Dot Product

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

  12. Example: Angle Between Vectors b θ a

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

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

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

  16. • x n p • Example: Distance to Plane • A plane is described by a point p on the plane and a unit normal n. Find the distance from point x to the plane

  17. • x n p • Example: Distance to Plane • The distance is the length of the projection of x-p onto n: x-p

  18. Cross Product

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

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

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

  22. Matrices

  23. N a b M b d c c d a Example: Alignment to Target • A spaceship with a matrix M must target another ship with matrix N. Find a unit rotation axis u and an angle θ that will rotate M to be facing N

  24. N a b M b d c c d a Example: Alignment to Target • As objects are defined looking down the -z axis in their local space, the -c axis of their world matrix will represent the object’s heading heading

  25. N a b M b d c c d a Example: Alignment to Target • Therefore, we want to rotate matrix M so that it’s c axis lines up with the vector going from N to M, or (M.d - N.d) (M.d-N.d)

  26. N a b M b d c c d a Example: Alignment to Target • We will rotate around the axis perpendicular to both M.c and (M.d - N.d) u (M.d-N.d)

  27. N a b M b d c c d a Example: Alignment to Target • The rotation angle θ is just the angle between M.c and (M.d - N.d) u θ (M.d-N.d)

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

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

  30. Matrix Dot Matrix

  31. Camera Matrix • Think of the camera just like any other object. Just as a chair model has a matrix W that transforms it into world space, the camera matrix C would transform a camera model into world space. • We don’t want to transform the camera into world space. Instead, we want to transform the world into the camera’s space, so we use the inverse of C.

  32. Example: Camera ‘Look At’ • Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M.

  33. Example: Camera ‘Look At’ • Our eye is located at position e and we want to look at a target at position t. Generate an appropriate camera matrix M. • Two possible approaches include: • Measure angles and rotate matrix into place • Construct a,b,c, & d vectors of M directly

  34. Example: Camera ‘Look At’ Matrix • The d vector is just the position of the camera, which is e: • The c vector is a unit length vector that points directly behind the viewer:

  35. Example: Camera ‘Look At’ Matrix • The a vector is a unit length vector that points to the right of the viewer. It is perpendicular to the c axis. To keep the camera from rolling, we also want the a vector to lay flat in the xz-plane, perpendicular to the y-axis. • Note that a cross product with the y-axis can be optimized as follows:

  36. Example: Camera ‘Look At’ Matrix • The b vector is a unit length vector that points up relative to the viewer. It is perpendicular to the both the c and a axes • Note that b does not need to be normalized because it is already unit length. This is because a and c are unit length vectors 90 degrees apart.

  37. Example: Camera ‘Look At’ Matrix • Summary:

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

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

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

  41. Position Vector Dot Matrix

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

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

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

  45. Direction Vector Dot Matrix

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

  47. Quaternions • In computer animation, quaternions are used as an alternative way to store orientations (other than matrices & Euler angles) • One of their biggest advantages is their ability to interpolate between arbitrary orientations nicely • They are also a compact, fast way to store & manipulate orientations • As we generally require matrices at some point, the ability to convert a quaternion to/from a matrix is very important • Once in quaternion format, we can interpolate smoothly using ‘slerp’ (spherical linear interpolation), or construct quaternion curves through several orientations

  48. Weighted Blending & Averaging • Weighted sum: • Weighted average: • Convex average: • Additive blend:

  49. Rigging & Animation Review

  50. Rigging DOF Joint Skeleton Skin Morphing, PSD FFD, SOFFD Rig Animation Pose Keyframe Channel Animation Clip Player Blender State Machine Rigging & Animation Concepts

More Related