Skeletons and Skinning Bones and Skeletons Mesh Skinning
Skeletons and Skinning • Bones and Skeletons • Mesh Skinning • The mesh is lots of triangles and vertices – The animator doesn’t want to move each one. • When a “bone” is moved, the vertices of the mesh are moved (by the computer) in a corresponding way. 1 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Skeletal Animation Victoria 2 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Skeletons Skeleton A pose-able framework of joints arranged in a tree structure. An invisible armature to manipulate the skin and other geometric data of the character. Does not actually render. 3 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Skeletons Joint Allows relative movement within the skeleton. Joints are equivalent to 4 x 4 matrix transformations. Bone What’s the difference between a joint and a bone? Nothing really, and XNA uses the term bone for a joint. Sometimes bones includes a length or actual geometry 4 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Victoria in 3 DS Max 5 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Victoria in Motionbuilder 6 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
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) Can have more (up to 9 for affine) Changing the DOF values over time results in the animation of the skeleton Rigid body transformations: 6 DOF Arbitrary rotations: 3 DOF 7 TT CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Skeleton Posing Process 1. Specify DOF values for the skeleton 2. Traverse the hierarchy using forward kinematics to compute the world matrices 3. Use world matrices to deform skin & render The matrices can also be used for other things such as collision detection, FX, props, etc. 8 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Forward Kinematics • Each joint computes a local matrix M based on the DOFs and some formula representative of the joint type: Local matrix M = Mjoint(φ1, φ2, …, φN) bone. Transforms[b] = Matrix. Create. Scale(bone. Scales[b]) * Matrix. Create. From. Quaternion(bone. Rotation) * Matrix. Create. Translation(bone. Translation); • Then, world matrix W is computed by concatenating M with the world matrix of the parent joint World matrix W = MWparent model. Copy. Bone. Transforms. From(bone. Transforms); model. Copy. Absolute. Bone. Transforms. To(bone. Absolute. Transforms); 9 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Skeleton Rigging • Skeleton Rigging – Setting up the skeleton for a figure – – 10 Bones Joints DOF’s Limits CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Poses Adjust 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] 11 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Joint Types • Rotational – Hinge: 1 -DOF – Universal: 2 -DOF • Around two axis – Ball & Socket: 3 -DOF • Euler Angles • Quaternions • Translational – Prismatic: 1 -DOF – Translational: 3 -DOF (or any number) TT 12 • Compound – – Free Screw Constraint Etc. • Non-Rigid – Scale – Shear – Etc. • Design your own. . . CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Smooth Skin Algorithm 13 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Rigid Parts are Easy This is what we did with Digger • Robots and mechanical creatures – Rigid parts, no smooth skin – Each part is transformed by its joint matrix • Every vertex of the character’s geometry is transformed by exactly one matrix where v is defined in joint’s local space 14 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
What happens with Skinned Characters? The mesh is deformed by the bones, but not “rigidly”. Instead, it is a flexible bend. 15 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
16 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
The Basic Concept 1. 0/0. 0 0. 5/0. 5 0. 0/1. 0 0. 7/0. 3 Each vertex can be moved by 1 -4 bones, with each bone having a weight. 17 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Mathematics of mesh skinning Each vertex is multiplied by several “weighted” transformation matrices and the results are added together. with Where: is the number of matrices. is the vertex position. is the weight associated. is a transformation matrix. TT 18 The transformation matrix indicates how that bone has been moved. CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Smooth Skin 1. 0/0. 0 0. 5/0. 5 0. 0/1. 0 0. 7/0. 3 • A vertex can be attached to more than one joint/bone with adjustable weights that control how much each joint affects it – Rarely more than 4 – Definitely no more than 4 in XNA • Result is a blending of the n transformations • Algorithm names – blended skin, skeletal subspace deformation (SSD), multimatrix skin, matrix palette skinning… 19 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Limitations of Smooth Skin • Smooth skin is very simple and quite fast, but its quality is limited – Joints tend to collapse as they bend more – Very difficult to get specific control – Unintuitive and difficult to edit • Still, it is common in games and commercial animation! • If nothing else, it is a good baseline upon which more complex schemes can be built 20 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Limitations of Smooth Skin TT 21 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Bone Links • Bone links are extra joints inserted in the skeleton to assist with the skinning – Instead of one joint, an elbow may be 2 -3 joints – Allows each joint to limit the bend angle! – Why does this help? 22 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Containment Binding • Volume primitives around the bones – Boxes, cylinders, etc. – Vertex weights assigned based on which primitives it is in 23 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Props Often our characters will be carrying or handling something We usually call this a prop Easiest way to handle props Prop is moved by one bone In this example the right hand bone moves the pie bazooka 24 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
How I determined the numbers Matrix baz. Mat = Matrix. Create. Rotation. X(Math. Helper. To. Radians(109. 5 f)) * Matrix. Create. Rotation. Y(Math. Helper. To. Radians(9. 7 f)) * Matrix. Create. Rotation. Z(Math. Helper. To. Radians(72. 9 f)) * Matrix. Create. Translation(-9. 6 f, 11. 85 f, 21. 1 f) * Model. Get. Bone. Absolute. Transform(hand. Bone); TT 25 X value is +90 to get from 3 DS coordinates (Z is up) to our coordinates (Y is up) CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Manual Manipulation How could I aim that bazooka? What are the options? 26 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
Manual Manipulation Bip 01 Spine 1 27 CSE 473 Dr. Charles B. Owen Fundamentals of 3 D Game Development
- Slides: 27