computer animation and visualisation lecture 4....
TRANSCRIPT
Computer Animationand Visualisation
Lecture 4.
Skinning
Taku Komura
Overview
Skinning Background knowledge
Linear Blending
How to decide weights?
Example-based Method
Anatomical models
Skinning
• Assume the movements of the skeleton is determined
• The character’s skin must deform according to the motion of the skeleton
• This process is called skinninghttp://www.youtube.com/watch?v=dniWVu55PEc&feature=related
http://www.youtube.com/watch?v=z0QWBdk8MCA&feature=related
Background
• A homogeneous transformation matrix M (4x4) is defined per bone
• It represents the pose of the bone• It converts local coordinates to world coordinates
(xg
i
y gi
z gi )=M i (
x li
y li
zli )
(x l
i
y li
zli )
Translation matrix
M=[1 0 0 t x0 1 0 t y
0 0 1 t z0 0 0 1
]
(t xt y
t z)
global coord local coord
Rotation matrix
Rot x(φ)⋅Rot y (ϕ )⋅Rot z( ξ )
For Euler angles in the order of x, y, z, the matrix can be computed by
Translation & Rotation matrix
M=[R t0 1 ]
R : rotation part (3x3 )
t : translation vector (3x1 )
t
R
• What is the local-to-world transformation matrix?
• What is the position of point A in the world coordinate system?
[1 0 0 30 1 0 10 0 1 00 0 0 1
] [1101]=[
4201]
• So the location of the point in the world is
(4,2,0)
• What is the local-to-world transformation matrix?
• What is the position of point A in the world coordinate system?
[0 1 0 3
−1 0 0 10 0 1 00 0 0 1
] [1101]=[
4001]
• So the location of the point in the world is
(4,0,0)
A local-to-global transformation for a hand
• A body composed of three segments• A vertex v3 defined in a local coordinate system of
segment 3• Its global position vg is computed by the above equation
v g=T 0 R1T1 R2T 2 R3 vl=M 3 v l
A global-to-local transformation for a hand
• Given the global location , the local coordinate of the point can be the above equation
v l= (T 0 R1T 1 R2T2 R3)−1v g=M 3
−1v g
For robots, this is fine
Compute the local-to-global matrix for all body segments : Mi
Multiply the local coordinates vi of every body segment to this matrix to calculate its global position :
Then, the global position of all the points can be computed
v g=M iv i
What about polygon characters?
Problem 1. We are only given the polygon – no skeleton structure
Problem 2. Some points on the body do not belong to a single bone but to multiple bones close to it
https://www.youtube.com/watch?v=04d_Pp6qjsw
Solution: Skinning
Fitting the skeleton into the polygon model
(done manually)
http://www.youtube.com/watch?v=dniWVu55PEc&feature=related
Solution: Overview
1. Convert the position of vertices to the local coordinates of each bone2. Compute their global positions in the new pose using the local-to-global matrices3. Blend the results between bones
Rest Pose to Bone Coordinate
The transformation matrix (local to global) associated with bone i in the rest pose is defined by M i
Rest Pose to Bone Coordinate
The transformation matrix (local to global) associated with bone i in the rest pose is defined by M i
M i=[1 0 0 0 . 70 1 0 1. 50 0 1 00 0 0 1
]
center of elbow joint x=(0 .7, 1 . 5 ,0)
Rest Pose to Bone Coordinate
the global position of a particular vertex, v , in the rest pose is defined vg
Rest Pose to Bone Coordinate
the global position of a particular vertex, v, in the rest pose is defined vg
v g=(0 . 8,1. 45 ,0 )
Rest Pose to Bone Coordinate
• We want to know where this point is in the local coordinates
v g
Rest Pose to Bone Coordinate
The transformation matrix transforms the global coordinates to the local coordinates.
M i
M i=[1 0 0 −0 . 70 1 0 −1 . 50 0 1 00 0 0 1
]
center of elbow joint x=(0 .7,1 . 5,0)
-1
Rest Pose to Bone Coordinate • for each bone, i, the position of the vertex in the
rest pose is first transformed from model coordinates ( ) to bone coordinates ( ) by applying the inverse of the rest pose bone transformation:
v i
v i=M i−1 vg
v g
v g
Rest Pose to Bone Coordinate:Example
v g=(0 .8, 1. 45 ,0 )
M i=[1 0 0 0 . 70 1 0 1. 50 0 1 00 0 0 1
]center of elbow joint x=(0 .7, 1 . 5, 0)
v g
Rest Pose to Bone Coordinate
v i
v i=M i−1 vg=[
1 0 0 0 .70 1 0 1 .50 0 1 00 0 0 1
]−1
[0 .81 .4501
][1 0 0 −0 .70 1 0 −1.50 0 1 00 0 0 1
][0 .81 .4501
]=[0 . 1
−0 . 0501
]
Bone Coordinate to World Coordinate
• The vertex in bone coordinates, is then transformed back into world coordinates by applying the transformation of the bone in the new pose
v g=M' iv i=M' i M i−1v i
M' i : the local-to-global matrix in the new posture
v i
Problem 2: • For some points, we don’t know to which body
segment it belongs to• For the points near the elbow joint, it might
belong to the upper arm, or the forearm or maybe both
• We want both segments to affect its movements
Solution: Linear Blending • Linear Blending determines the new position of
a vertex by linearly combining the results of the vertex transformed rigidly with each bone.
• A scalar weight, wi, is given to each influencing bone and the weighted sum gives the vertex’s position, v, in the new pose, as follows:
b is the number of bones influencing the position of v
v i=∑i=1
b
w i M'i M i−1 vg ∑
i=1
b
wi=1
What is the position of point A after the elbow is bent 90 degrees?
• assuming it is a point of the upper arm
• assuming it is a point of the forearm
•Assuming the weight is 0.8 for the upper-arm and 0.2 for the forearm
(1,1)
(4,0)
(1,1)
(4,0)
• Assuming it is a point of the upper arm, the position is (3,1)
• assuming it is a point of the forearm, it is (5,1)
• Assuming the weight is 0.8 for the upper-arm and 0.2 for the forearm, the position is
0.8*(3,1)+0.2*(5,1) =(3.4, 1)
How to decide the weights?
Decide the mapping of the vertex to the bone– If vertex v is in the middle of bone i, then and for the rest
– If the vertex is near the border of bone i and i+1, wi will gradually decrease to 0 and wi+1 will gradually increase to 1
– If the vertex is affected by more than three bones, the weight can be determined according to its distance to each bone
w i=1w j≠i=0
How to decide the weights?
Example: use the Euclidean distance •Surround the bones by the inner and outer capsules
•If the vertex is inside only one inner capsule, the weight for the corresponding bone is 1, and the rest are 0
•If inside multiple inner capsules, compute the distance to each bone, and use that to decide the weights (longer distance, lower weight)
How to decide the weights?
Example: use the Euclidean distance •Surround the bones by the inner and outer capsules
•If the vertex is inside only one inner capsule, the weight for the corresponding bone is 1, and the rest are 0
•If inside multiple inner capsules, compute the distance to each bone, and set the weights inverse proportional to the distance with normalization
w1=√1d1
1d1
+1d 2
,w2=√1d 2
1d1
+1d2
How to decide the weights?
Example: use the Euclidean distance •If inside the inner capsule of one and in outer capsule of the other, use the distance again but with a fall-off with the other
i.e.
w1=√1d1
1d1
+f (d2 )1d2
,w2=√f (d2)
1d2
1d1
+f (d 2)1d2
f ( x ) : fall-off functionf ( x )=1 if x <r1
f ( x )=0 if x >r 2
f ( x )=1−x-r1
r 2−r1
Deciding the weights manually
http://www.youtube.com/watch?v=z0QWBdk8MCA&feature=related
Problems with Linear Blending • The meshes exhibit volume loss as joints are
rotated to extreme angles. • These are called “joint collapse” and “candy
wrapper” effect
• Simple linear blending in the Cartesian space causes the artefacts
Why does it happen?
Why does it happen?
One Simple Solution
• Find the closest joint from the vertex
• Use this joint position as the rotation center for both body parts
• Interpolate along the arc (can use quaternion interpolation, SLERP, see notes of lecture 1)
• Works well for 2 bones
Some advanced stuff
• Automatic computation of the weights from examples
examples
• Automatic skeleton fitting / extraction
w
Anatomical models
• Model the body by – Muscles– Fat– Skin
Method 1. When the joints are bent, the muscles
contract
2. The distance between the origin and insertion point decreases
3. The volume of the muscles are kept the same, so they pump up
4. The skin is deformed to cover the muscles
Visible Human Project Many anatomical models are based the Visible Human Project dataset
Two cadavers sliced at 1milimeter intervals from the top to the bottom and photographed by cameras
The CT scans and MRI images were also taken
http://www.nlm.nih.gov/research/visible/visible_human.html
http://www.youtube.com/watch?v=iWP2HnPSMyo
Summary• Skinning
– Linear Blending
– Example-based weight estimation– Anatomical models
Readings
Skinning• A Comparison of Linear Skinning Techniques for Character Animation
Afrigraph 2007• Multi-Weight Enveloping: Least-Squares Approximation Techniques for Skin
Animation– Wang and Phillips, SCA 02– http://portal.acm.org/citation.cfm?id=545283
• Guessing the weights from examples– Alex Mohr Michael Gleicher Building Effcient, Accurate Character Skins from
Examples. SIGGRAPH 2003• Automatic Rigging and Animation of 3D Characters Ilya Baran Jovan Popovi´c,
SIGGRAPH 2007• http://www.mit.edu/~ibaran/autorig/pinocchio.html• Geometric Skinning with Approximate Dual Quaternion Blending,
SIGGRAPH 2008