Advanced Skinning

54
Advanced Skinning CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004

description

Advanced Skinning. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004. Project 2. Load a .skin file and attach it to a skeleton using the smooth skin algorithm Render it shaded using at least 2 different colored lights - PowerPoint PPT Presentation

Transcript of Advanced Skinning

Page 1: Advanced Skinning

Advanced Skinning

CSE169: Computer AnimationInstructor: Steve Rotenberg

UCSD, Winter 2004

Page 2: Advanced Skinning

Project 2 Load a .skin file and attach it to a skeleton using

the smooth skin algorithm Render it shaded using at least 2 different

colored lights Add a simple interface for selecting a DOF and

adjusting it within its limits Take a .skin and .skel file name from the

command line Due Monday, 11:59pm, 2/2/04

Page 3: Advanced Skinning

Project 2: Extra Credit

Render the skin with a texture map. A version of a .skin file with texture information and texture coordinates will be supplied (1 point)

Load several .morph files and add vertex blending. Add additional user controlled DOFs to blend the morph targets (2 points)

Page 4: Advanced Skinning

Skin File (part 1)

positions [numverts] {[x] [y] [z]

}normals [numverts] { [x] [y] [z]}skinweights [numverts] { [numattachments] [joint0] [weight0] … [jN-1] [wN-1]}

Page 5: Advanced Skinning

Skin File (part 2)

triangles [numtriangles] { [index0] [index1] [index2]}bindings [numjoints] { matrix { [ax] [ay] [az] [bx] [by] [bz] [cx] [cy] [cz] [dx] [dy] [dz] }}

Page 6: Advanced Skinning

Skinning

*

*

1*

1

nnn

WBnn

WBvv

iii

iii

w

w

Page 7: Advanced Skinning

Morphing & Smooth Skinning

Page 8: Advanced Skinning

Weighted Blending & Averaging

Weighted sum:

Weighted average:

Convex average:

Additive blend:

10

10

0

i

ii

iii

w

w

xwx

10

1100 1

iii

ii

iii xwxwxxwxx

Page 9: Advanced Skinning

Shape Interpolation Algorithm To compute a blended vertex position:

The blended position is the base position plus a contribution from each target whose DOF value is greater than 0

To blend the normals, we use a similar equation:

We don’t need to normalize them now, as that will happen later in the skinning phase

baseiibase vvvv

baseiibase nnnn

Page 10: Advanced Skinning

Smooth Skin Algorithm The deformed vertex position is a weighted average over all of the

joints that the vertex is attached to:

W is a joint’s world matrix and B is a joint’s binding matrix that describes where it’s world matrix was when it was attached to the skin model (at skin creation time)

Each joint transforms the vertex as if it were rigidly attached, and then those results are blended based on user specified weights

All of the weights must add up to 1: Blending normals is essentially the same, except we transform them

as directions (x,y,z,0) and then renormalize the results

iiiw WBvv 1

1iw

*

*1* ,

nnnWBnn

iiiw

Page 11: Advanced Skinning

Layered Approach

We use a simple layered approach Skeleton Kinematics Shape Interpolation Smooth Skinning

Most character rigging systems are based on some sort of layered system approach combined with general purpose data flow to allow for customization

Page 12: Advanced Skinning

Equation Summary

*

*

1*

1

21 ,...,,

nnn

WBnn

WBvv

nnnn

vvvv

WLW

LL

iii

iii

baseiibase

baseiibase

parent

Njnt

w

w

Skeleton

Morphing

Skinning

Page 13: Advanced Skinning

Skeleton, Morph, & Skin Data Flow

parent

mjnt

WLW

LL

,...,, 21

*

*

1*

1

nnn

WBnn

WBvv

iii

iii

w

w

baseiibase

baseiibase

nnnn

vvvv

M ...21 NMM ...21

nv ,

Page 14: Advanced Skinning

Rig Data Flow

N ...21Φ

nv ,

RiggingSystem

Page 15: Advanced Skinning

Rigging and Animation

AnimationSystem

Pose

RiggingSystem

Triangles

Renderer

Page 16: Advanced Skinning

Pose Space Deformation

Page 17: Advanced Skinning

Pose Space Deformation

“Pose Space Deformation: A Unified Approach to Shape Interpolation and Skeleton-Driven Deformation”

J. P. Lewis, Matt Cordner, Nickson Fong

Page 18: Advanced Skinning

Paper Outline

1. Introduction 2. Background 3. Deformation as Scattered Interpolation 4. Pose Space Deformation 5. Applications and Discussion 6. Conclusion

Page 19: Advanced Skinning

Key Goals of a Skinning System

“The algorithm should handle the general problem of skeleton-influenced deformation rather than treating each area of anatomy as a special case. New creature topologies should be accommodated without programming or considerable setup efforts.”

Page 20: Advanced Skinning

Key Goals of a Skinning System

“It should be possible to specify arbitrary desired deformations at arbitrary points in the parameter space, with smooth interpolation of the deformation between these points.”

Page 21: Advanced Skinning

Key Goals of a Skinning System

“The system should allow direct manipulation of the desired deformations”

Page 22: Advanced Skinning

Key Goals of a Skinning System

“The locality of deformation should be controllable, both spatially and in the skeleton’s configuration space (pose space).”

Page 23: Advanced Skinning

Key Goals of a Skinning System

“In addition, we target a conventional animator-controlled work process rather than an approach based on automatic simulation. As such we require that animators be able to visualize the interaction of a reasonably high-resolution model with an environment in real time. Real time synthesis is also required for applications such as avatars and computer games”

Page 24: Advanced Skinning

Paper Outline (section 2) 2. Background

2.1 Surface Deformation Models 2.2 Multi-Layered and Physically Inspired Models 2.3 Common Practice

2.3.1 Shape Interpolation

2.3.2 Skeleton-Subspace Deformation

2.3.3 Unified Approaches 2.4 Kinematic or Physical Simulation?

iiiw WBvv 1

baseiibase vvvv

pp p

010 LLLw kkk

1 00 k kk SSwS

Page 25: Advanced Skinning

Key Technology

Scattered Data Interpolation Using Radial Basis Functions

Page 26: Advanced Skinning

Key Technology

Scattered Data Interpolation Using Radial Basis Functions

Huh?

Page 27: Advanced Skinning

Interpolation

Interpolation vs. Extrapolation Linear Interpolation vs. Higher Order Structured vs. Scattered 1-Dimensional vs. Multi-Dimensional Interpolation vs. Approximation

Page 28: Advanced Skinning

Interpolation Techniques

Splines (cubic, B-splines, NURBS…) Series (polynomial, Fourier, radial basis

functions, wavelets…) Rational functions

Exact solution, minimization, fitting, approximation

Page 29: Advanced Skinning

Radial Basis Functions

What is a radial basis function? How do we use them to interpolate data?

Page 30: Advanced Skinning

What is an RBF? A radial basis function (RBF) is simply a function

based on a scalar radius:ψ(r)

We can use it as a spherically symmetric function based on the distance from a point

In 3D space, for example, you can think of a field emanating from a point that is symmetric in every direction (like a gravitational field of a planet)

The value of that field is based entirely on the distance from the point (i.e., the radius)

Page 31: Advanced Skinning

Radial Basis Functions

If we placed a RBF at location xk in space, and we want to know the value of the field at location x, we just compute:

ψ(|x-xk|)

This works with an x of any number of dimensions

Page 32: Advanced Skinning

Radial Basis Functions

What function should we use for ψ(r) ? Well, technically, we could use any

function we want We will choose to use a Gaussian:

2

2

2exp

rr

Page 33: Advanced Skinning

Gaussian RBF Why use a Gaussian RBF?

We want a function that has a localized influence that drops off to 0 at a distance

We want to be able to adjust the range of influence (that’s what σ is for)

We want a smooth function We want a function whose value is 1 at r=0 We want the first derivative to be 0 at r=0. This causes

the function to be flat across the top and avoids spikes We want to use something that is relatively fast to

compute

Page 34: Advanced Skinning

How Do We Use RBFs? How do we use radial basis functions to interpolate

scattered data? We define the interpolated value at a point as a weighted

sum of radial basis functions:

The RBFs must be positioned and the weights adjusted so that the result best approximates the scattered data and smoothly interpolates the space between the data points

kN

kkwd xxx ˆ

Page 35: Advanced Skinning

Example in One Dimension

1331211 xxxx2 wwwd

Page 36: Advanced Skinning

Solving For Weight Values

33223113

23322112

1331211

wwwd

wwwd

wwwd

xxxx

xxxx

xxxx2

Page 37: Advanced Skinning

Solving For Weight Values

33223113

23322112

1331211

wwwd

wwwd

wwwd

xxxx

xxxx

xxxx2

3

2

1

313

321

311

3

2

1

11

1

www

ddd

2

2

2

Page 38: Advanced Skinning

Solving For Weight Values

33223113

23322112

1331211

wwwd

wwwd

wwwd

xxxx

xxxx

xxxx2

3

2

1

313

321

311

3

2

1

11

1

www

ddd

2

2

2

wΨd

Page 39: Advanced Skinning

Solving For Weight Values

33223113

23322112

1331211

wwwd

wwwd

wwwd

xxxx

xxxx

xxxx2

3

2

1

313

321

311

3

2

1

11

1

www

ddd

2

2

2

dΨwwΨd

1

Page 40: Advanced Skinning

Note on SDI in PSD Paper I use:

Where the paper uses:

The two are equivalent, and I don’t know why they do it the other way. It looks slower and more prone to numerical error, but I’ll look into it.

Besides, the matrix is symmetric, so:

dΨw 1

dΨΨΨw TT 1

TΨΨ

Page 41: Advanced Skinning

SDI, RBFs, and PSD

PSD uses SDI as an improved technique for shape interpolation

As RBFs drop to 0 away from the data points, it’s nice if you use them to interpolate functions that are close to 0. Therefore, they subtract off the default pose and treat all other poses as deviations from the default pose.

They describe several other details of the implementation in sections 4 & 5

Page 42: Advanced Skinning

Performance of PSD

At runtime, to compute a deformed vertex position, one must evaluate:

for each component of the vertex. We can expand this to:

kN

kkwd xxx ˆ

N

i

ii 2

2

2exp

ΦΦ

wv

Page 43: Advanced Skinning

Performance of PSD

Compare to simple morphing:

PSD:

N

i

ii

12

2

2exp

ΦΦ

wv

M

ibaseiibase

1

vvvv

Page 44: Advanced Skinning

Memory Usage of PSD

With morphing, every vertex must store Mx3 floats, where M is the number of targets that affect that vertex

With PSD, every vertex must store Nx3+NxR floats, where N is the number of poses for the vertex and R is the number of DOFs affecting the vertex

Page 45: Advanced Skinning

Surface Oriented Free Form Deformations

Page 46: Advanced Skinning

Surface Oriented Free Form Deformation

“Skinning Characters using Surface-Oriented Free-Form Deformations”

Karan Singh Evangelos Kokkevis

Page 47: Advanced Skinning

Paper Outline 1. Introduction 2. Free-Form Deformation Techniques 3. Surface-Oriented Deformations

3.1 Overview of the Algorithm 3.2 Registration 3.3 Deformation

4. Algorithm Analysis 5. Skinning Workflow 6. Results and Conclusion

Page 48: Advanced Skinning

Registration Phase When the model is set up, every vertex in the high detail mesh

must be attached to nearby triangles in the low detail mesh The attachment weights are based on a distance function

And then normalized (so they sum up to 1) A vertex will generally only attach to a small number of

triangles For every attachment, we find the coordinates in the triangle’s

space

localdlocaldf

11),(

Page 49: Advanced Skinning

Registration To find the vertex position relative to the control triangle i, we

build a registration matrix Ri that defines the triangle’s space

Note: I use different notation than the paper

1

13

12

tdbabac

ttbtta

R i

t1 t2

t3

a

bc

Page 50: Advanced Skinning

Registration

Both the high detail skin and the low detail control mesh are constructed in the skin local space

If a vertex on the high detail skin is v, then its position v* in triangle i’s space is:

1* iRvv

Page 51: Advanced Skinning

Deformation

When the triangles of the control mesh get positioned into world space, we compute a new deformation matrix D using the same technique as we used to compute R

Then, we transform the triangle-local vertex by this matrix

This is done for all triangles affecting a vertex, and then we take a weighted sum

iiiw DRvv 1

Page 52: Advanced Skinning

Deformation

This looks familiar…

iiiw DRvv 1

Page 53: Advanced Skinning

Deformation This looks familiar…

When compared to:

We see that SOFFD’s do the exact same math as smooth skinning!

Instead of using matrices from skeletal joints they use matrices based on triangles

iiiw DRvv 1

iiiw WBvv 1

Page 54: Advanced Skinning

Layered Approach

Skeleton Posing Pose Space Deformation Surface Oriented Free Form Deformation High Order Surface Tessellation