1 / 11

Skinning

Skinning. CS418 Computer Graphics John C. Hart. Simple Inverse Kinematics. Given target point ( x , y ) in position space, what are the parameters ( q , f ) in configuration space that place the hand on the target point? Use Law of Cosines to find q d 2 = a 2 + b 2 – 2 ab cos q

jacoba
Download Presentation

Skinning

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. Skinning CS418 Computer Graphics John C. Hart

  2. Simple Inverse Kinematics • Given target point (x,y) in position space,what are the parameters (q,f) in configuration space that place the hand on the target point? • Use Law of Cosines to find q d2 = a2 + b2 – 2abcosq cosq = (a2 + b2 – d2)/2ab cosq = (a2 + b2 – x2 – y2)/2ab • And to find a cosa = (a2 + d2 – b2)/2ad cosa = (a2 + x2 + y2 – b2)/2ad • Use arctangent to find b then f b = atan2(y,x) f = a – b (0,0) (x,y) q f b a (x,y) d (0,0) a q b a (x,y) d b (0,0) f a

  3. Skinning M2R(q 2) M1R(q1) M2R(q2) R(q2) • Elbow joints don’t look realistic because geometry detaches • Transformation hierarchy: • R(q1) rotates upper-arm cylinder about its shoulder at the origin • M1 moves upper-arm cylinder from the origin to its position in world coordinates • R(q2) rotates forearm cylinder about its elbow at the origin • M2 moves forearm elbow from the origin to the end of the upper-arm cylinder when its shoulder is based at the origin • When q2  0 the elbow end of the upper-arm does not align with the elbow end of the forearm M1R(q1) M2 M1R(q1) M2R(q2) M1R(q1)

  4. Skinning M1R(q1) M2R(0) • Solution is to interpolate matrices from the undetached coordinate frame into the correctly oriented coordinate frame per-vertex • Let Mstraight = M1R(q1) M2R(0) Mbent = M1R(q1) M2R(q2) • Distribute (“paint”) weights w on vertices of forearm cylinder • w = 0 at elbow end • w = 1 after elbow • Transform vertices using M(w) = (1 – w) Mstraight + wMbent M1R(q1) M2R(q2) M1R(q1) M2R(2/3q2) w = 1 M1R(q1) M2R(1/3q2) w = 2/3 w= 1/3 M1R(q1)

  5. Build an Elbow glPushMatrix(); glColor3f(0,0,1); glTranslatef(0,-2,0); drawquadstrip(); glPopMatrix(); glPushMatrix(); glColor3f(1,1,0); glRotatef(elbow,0,0,1); glTranslate(0,0,2); drawquadstrip(); glPopMatrix();

  6. Two Coordinate Systems glPushMatrix(); glColor3f(0,0,1); glTranslatef(0,-2,0); drawquadstrip(); glColor3f(1,1,0,.5) glTranslatef(0,4,0); drawquadstrip(); glPopMatrix(); glPushMatrix(); glRotatef(elbow,0,0,1); glColor3f(1,1,0); glTranslatef(0,0,2); drawquadstrip(); glColor3f(0,0,1,.5); glTranslatef(0,0,-4); drawquadstrip(); glPopMatrix(); Yellow limb in blue limb’s coordinate system Blue limb in yellow limb’s coordinate system

  7. Interpolate the Transformations for (i = 0; i < 8; i++) { weight = i/7.0; glPushMatrix(); glRotatef(weight*elbow,0,0,1); glTranslate3f(0,0,-3.5+i); drawquad(); glPopMatrix(); }

  8. Interpolate the Vertices glBegin(GL_QUAD_STRIP); for (i = 0; i <= 8; i++) { weight = i/8.0; glColor3f(weight,weight,1-weight); glPushMatrix(); glRotatef(weight*elbow,0,0,1); glVertex2f(-1,-4.+i); glVertex2f(1,-4.+i); glPopMatrix(); } glEnd(/*GL_QUAD_STRIP*/);

  9. Interpolate the Matrices glLoadIdentity(); glGetMatrixf(A); glRotatef(elbow,0,0,1); glGetMatrixf(B); glBegin(GL_QUAD_STRIP); for (i = 0; i <= 8; i++) { weight = i/8.0; glColor3f(weight,weight,1-weight); C = (1-weight)*A + weight*B; glLoadIdentity(); glMultMatrix(C); glVertex2f(-1,-4.+i); glVertex2f(1,-4.+i); } glEnd(/*GL_QUAD_STRIP*/);

  10. Matrix Palette Skinning • Each vertex has one or more weight attributes associated with it • Each weight determines the effect of each transformation matrix • “Bones” – effect of each transformation is described by motion on bone from canonical position • Weights can be painted on a meshed model to control effect of underlying bone transformations (e.g. chests, faces)

  11. Interpolating Matrices • Skinning interpolates matrices by interpolating their elements • Identical to interpolating vertex positions after transformation • We’ve already seen problems with interpolating rotation matrices • Works well enough for rotations with small angles • Rotations with large angles needs additional processing (e.g. polar decomposition) • Quaternions provide a better way to interpolate rotations… • (aA + bB)p = a(Ap) + b(Bp) • a,b = weights • A,B = matrices • p = vertex position From: J. P. Lewis, Matt Cordner, and Nickson Fong. “Pose space deformation: a unified approach to shape interpolation and skeleton-driven deformation.”Proc. SIGGRAPH 2000

More Related