Docsity

Skeletons - Computer Animation - Lecture Slides, Slides of Computer Graphics and Animation

Partial preview of the text

Download Skeletons - Computer Animation - Lecture Slides and more Slides Computer Graphics and Animation in PDF only on Docsity!

Skeletons

Matrix Review

3D Models

 Let’s say we have a 3D model that has an

array of position vectors describing its

shape

 We will group all of the position vectors

used to store the data in the model into a

single array: v

n

where 0 ≤ n ≤ NumVerts-

 Each vector v

n

has components v

nx

v

ny

v

nz

Translation  Let’s say that we want to move our 3D model from it’s current location to somewhere else…  In technical jargon, we call this a translation  We want to compute a new array of positions v _ n representing the new location  Let’s say that vector d represents the relative offset that we want to move our object by  We can simply use: v _ n = v n

  • d to get the new array of positions

Transformations  Always remember that this compact equation can be expanded out into  Or into a system of linear equations:

v ′ = v + d

         

          =           ′ ′ ′ z y x z y x z y x d d d v v v v v v z z z y y y x x x v v d v v d v v d ′ = + ′ = + ′ = +

Rotation

 Now, let’s rotate the object in the xy plane by an angle ___ , as if we were spinning it around the z axis  Note: a positive rotation will rotate the object counterclockwise when the rotation axis (z) is pointing towards the observer

z z y x y x x y

v v

v v v

v v v

θ θ θ θ

sin cos

cos sin

Rotation  We can represent a z-axis rotation transformation in matrix form as: or more compactly as: where           ⋅           − =           ′ ′ ′ z y x z y x v v v v v v 0 0 1 sin cos 0 cos sin 0 θ θ θ θ v ′= M ⋅ v ( )           − = = 0 0 1 sin cos 0 cos sin 0 θ θ θ θ M R z θ

Rotation  We can also define rotation matrices for the x , y , and z axes: ( )           − = 0 0 1 sin cos 0 cos sin 0 θ θ θ θ R z θ

          = − θ θ θ θ θ 0 sin cos 0 cos sin 1 0 0 R x ( )           − = θ θ θ θ θ sin 0 cos 0 1 0 cos 0 sin R y

Linear Equation  A general linear equation of 1 variable is: where a and d are constants  A general linear equation of 3 variables is:  Note: there are no nonlinear terms like v x v y , v x 2 , sin( v x

f ( v ) = av + d f ( v v v ) f ( ) av bv cv d x y z x y z , , = v = + + +

System of Linear Equations

 Now let’s look at 3 linear equations of 3 variables v x , v y , and v z  Note that all of the a n , b n , c n , and d n are constants (12 in total) 3 3 3 3 2 2 2 2 1 1 1 1

v a v b v c v d

v a v b v c v d

v a v bv c v d

z x y z y x y z x x y z

Translation  Let’s look at our translation transformation again:  If we really wanted to, we could rewrite our three translation equations as: z z z y y y x x x v v d v v d v v d ′ = + ′ = + ′ = + z x y z z y x y z y x x y z x v v v v d v v v v d v v v v d ′ = + + + ′ = + + + ′ = + + + 0 0 1 0 1 0 1 0 0

v ′ = v + d

Identity  We can see that this is equal to a transformation by the identity matrix 

3 2 1 3 2 1 0 0 1

d d d v v v v v v v v v v d v v v v d v v v v d z y x z y x z x y z y x y z x x y z

 We can apply a uniform scale to our object with the following transformation  If s >1, then the object will grow by a factor of s in each dimension  If 0< s <1, the object will shrink  If s<0, the object will be reflected across all three dimensions, leading to an object that is ‘inside out’

Uniform Scaling

          ⋅           =           ′ ′ ′ z y x z y x v v v s s s v v v 0 0 0 0 0 0

 We can also do a more general nonuniform scale , where each dimension has its own scale factor which leads to the equations:

Non-Uniform Scaling

          ⋅           =           ′ ′ ′ z y x z y x z y x v v v s s s v v v 0 0 0 0 0 0 z z z y y y x x x v s v v s v v s v ′ = ′ = ′ =