Week 5 -Wednesday What did we talk about last time? Transforms - - PowerPoint PPT Presentation

week 5 wednesday what did we talk about last time
SMART_READER_LITE
LIVE PREVIEW

Week 5 -Wednesday What did we talk about last time? Transforms - - PowerPoint PPT Presentation

Week 5 -Wednesday What did we talk about last time? Transforms Translation Rotation Scaling Shearing Rigid-body transforms and their inverses Normal transforms For normals and other things, we need to be able to


slide-1
SLIDE 1

Week 5 -Wednesday

slide-2
SLIDE 2

 What did we talk about last time?  Transforms

  • Translation
  • Rotation
  • Scaling
  • Shearing
  • Rigid-body transforms and their inverses

 Normal transforms

slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5
slide-6
SLIDE 6

 For normals and other things, we need to be able to compute

inverses

  • Rigid body inverses were given before
  • For a concatenation of simple transforms with known parameters,

the inverse can be done by inverting the parameters and reversing the order:

▪ If M = T(t)R(ϕ) then M-1 = R(-ϕ)T(-t)

  • For orthogonal matrices, M-1 = MT
  • If nothing is known, use the adjoint method
slide-7
SLIDE 7

 We can describe orientations from some

default orientation using the Euler transform

 The default is usually looking down the –z

axis with "up" as positive y

 The new orientation is:

  • E(h, p, r) = Rz(r)Rx(p)Ry(h)
  • h is head, like shaking your head "no"

▪ Also called yaw

  • p is pitch, like nodding your head back and

forth

  • r is roll… the third dimension
slide-8
SLIDE 8

 One trouble with Euler angles is that they

can exhibit gimbal lock

 In gimbal lock, two axes become aligned,

causing a degree of freedom to be lost

 Euler angles can describe orientations in

multiple ways, however the wrong choice

  • f rotations may cause gimbal lock
slide-9
SLIDE 9

 Sometimes you want to rotate around some arbitrary axis r  To do so, create an orthonormal basis r, s, and t as follows

  • Take the smallest component of r and set it to 0
  • Swap the two remaining components and negate the first one
  • Divide the result by its norm, making it a normal vector s
  • Let t = r x s

 This basis can be made into a matrix M  The final transform X transforms the r-axis to the x-axis, does the rotation by α and then

transforms back to r

 X = MTRx(α)M

          =

T T T

t s r M

slide-10
SLIDE 10

 Quaternions are a compact way to represent orientations  Pros:

  • Compact (only four values needed)
  • Do not suffer from gimbal lock
  • Are easy to interpolate between

 Cons:

  • Are confusing
  • Use three imaginary numbers
  • Have their own set of operations
slide-11
SLIDE 11

 A quaternion has three imaginary

parts and one real part

 We use vector notation for

quaternions but put a hat on them

 Note that the three imaginary

number dimensions do not behave the way you might expect

w v w z y x w v

q q kq jq iq q + = + + + = = q q q ) , ˆ ( ˆ

k ji ij j ik ki i kj jk k j i = − = = − = = − = − = = = 1

2 2 2

slide-12
SLIDE 12

 Multiplication  Addition  Conjugate  Norm  Identity

) , ( ˆ ˆ

v v w w v w v w v v

r q q r r q r q r q r q ⋅ − + + × = ) , ( ˆ ˆ

w w v v

r q + + = + r q r q ) , ( ˆ *

w v q

q q − =

2 2 2 2

) ˆ (

w z y x

q q q q n + + + = q ) 1 , ( ˆ i =

slide-13
SLIDE 13

 Inverse:  One (useful) conjugate rule:  Note that scalar multiplication is just like scalar vector

multiplication for any vector

 Quaternion quaternion multiplication is associative but not

commutative

 For any unit vector u, note that the following is a unit

quaternion:

* 2 1

ˆ ) ˆ ( 1 ˆ q q q n =

) cos , (sin ˆ φ φu q=

* * *

ˆ ˆ ) ˆ ˆ ( q r r q =

slide-14
SLIDE 14

 Take a vector or point p and pretend its four coordinates make

a quaternion

 If you have a unit quaternion

the result of is p rotated around the u axis by 2ϕ

 Note that, because it's a unit quaternion,  There are ways to convert between rotation matrices and

quaternions

 The details are in the book

p ˆ

) cos , (sin ˆ φ φu q=

1

ˆ ˆ ˆ

q p q

* 1

ˆ ˆ q q =

slide-15
SLIDE 15

 Short for spherical linear interpolation  Using unit quaternions that represent orientations, we can

slerp between them to find a new orientation at time t = [0,1], tracing the path on a unit sphere between the orientations

 To find the angle ϕ between the quaternions, you can use the

fact that cosϕ = qxrx + qyry + qzrz + qwrw r q r q s ˆ sin ) sin( ˆ sin )) 1 ( sin( ) , ˆ , ˆ ( ˆ φ t φ φ t φ t + − =

slide-16
SLIDE 16
slide-17
SLIDE 17

 If we animate by moving rigid bodies around each other, joints

won't look natural

 To do so, we define bones and skin and have the rigid bone

changes dictate blended changes in the skin

slide-18
SLIDE 18

 The following equation shows the effect that each bone i (and

its corresponding animation transform matrix Bi(t) and bone to world transform matrix Mi ) have on the p, the original location of a vertex

 Vertex blending is popular in part because it can be computed

in hardware with the vertex shader

∑ ∑

− = − = −

= =

1 1 1

1 where ) ( ) (

n i i n i i i i

w t w t p M B u

slide-19
SLIDE 19
slide-20
SLIDE 20

 Finish vertex blending and morphing  Projections  Work day to finish Project 1

slide-21
SLIDE 21

 Finish Project 1 due this Friday!  Keep working on Assignment 2