Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides ›...

67
Computer Graphics MTAT.03.015 Raimond Tunnel

Transcript of Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides ›...

Page 1: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

Computer GraphicsMTAT.03.015

Raimond Tunnel

Page 2: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

2 / 67

The Road So Far...

Last week

This week

Page 3: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

3 / 67

Transformations

● Watch the Computerphile video, try to find out:

1) Why are we using matrices?

The True Power of the Matrix (Transformations in Graphics) – Computerphilehttps://www.youtube.com/watch?v=vQ60rFwh2ig

Page 4: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

4 / 67

Transformations

● Watch the Computerphile video, try to find out:

1) Why are we using matrices?

2) Where do the homogeneous coordinates come in?

The True Power of the Matrix (Transformations in Graphics) – Computerphilehttps://www.youtube.com/watch?v=vQ60rFwh2ig

Page 5: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

5 / 67

Linear Transformations

● Also called linear mapping, linear function

Page 6: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

6 / 67

Linear Transformations

● Also called linear mapping, linear function

● Transforms a vector space V into a vector

space W, while preserving addition and scalar

multiplication

Page 7: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

7 / 67

Linear Transformations

● Also called linear mapping, linear function

● Transforms a vector space V into a vector

space W, while preserving addition and scalar

multiplication

● Satisfies: f (α⋅v+β⋅u)=α⋅f (v)+β⋅f (u)

Page 8: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

8 / 67

Linear Transformations

● Also called linear mapping, linear function

● Transforms a vector space V into a vector

space W, while preserving addition and scalar

multiplication

● Satisfies:

● In 3D:

f (α⋅v+β⋅u)=α⋅f (v)+β⋅f (u)

α ,β∈ℝ u , v∈ℝ3

Page 9: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

9 / 67

Linear Transformations

● Take our vector space of points

Page 10: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

10 / 67

Linear Transformations

● Take our vector space of points

● Take for example a point p=(2, 1)

Page 11: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

11 / 67

Linear Transformations

● Take our vector space of points

● Take for example a point

● Try mappings:

1)

2)

3)

4)

p=(2, 1)

f ( p)=( px , p y)

f ( p)=(2⋅px , p y)

f ( p)=( p x , 2⋅p y)

f ( p)=(2⋅px , 2⋅p y)Test the linearity at home...

Page 12: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

12 / 67

Linear Transformations

● From Algebra you know that all linear trans-formations can be represented as matrices.

Linear transformation → Matrix

Page 13: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

13 / 67

Linear Transformations

● From Algebra you know that all linear trans-formations can be represented as matrices.

● Every matrix also gives you a linear transformation.

Linear transformation → Matrix

Linear transformation ← Matrix

Page 14: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

14 / 67

Linear Transformations

● What would be the matrices for the linear transformations we just saw?

f ( p)=(? ?? ?)⋅( pxp y)

f ( p)=( px , p y)

f ( p)=(2⋅px , p y)

f ( p)=( p x , 2⋅p y)

f ( p)=(2⋅px , 2⋅p y)

Page 15: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

15 / 67

Scale

● Stretches or shrinks the space

(a x 0 00 a y 00 0 a z)

ax – x-axis scale factor

ay – y-axis scale factor

ax – z-axis scale factor

(ax 00 a y)

ax – x-axis scale factor

ay – y-axis scale factor2D

3D

Page 16: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

16 / 67

Scale● Transformations can be easily understood, if we

see what they do with the standard basis

Page 17: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

17 / 67

Scale● Transformations can be easily understood, if we

see what they do with the standard basis

Page 18: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

18 / 67

Scale● Transformations can be easily understood, if we

see what they do with the standard basis

● Furthermore, one can read the transformed standard basis from the columns of the transformation matrix!

Page 19: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

19 / 67

Shear

● Shear-x, shear-y● Tilts one of the axes parallel to other(s)

Shear-x or shear-y?Matrix?

Page 20: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

20 / 67

Shear● Shear-y, we tilt the x basis vector

parallel to y by angle φ counter-clockwise

● Shear-x, we tilt the y basis vector parallel to x by angle φ clockwise

( 1 0tan (ϕ) 1)⋅(xy)=( x

y+ tan (ϕ)⋅x)

(1 tan(ϕ)

0 1 )⋅(xy)=(x+ tan(ϕ)⋅yy )

What about in 3D?

Page 21: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

21 / 67

Rotation

● We want to keep the basis vectors on the unit-circle.

Can you derive the matrix?

Page 22: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

22 / 67

Rotation

e '0=(∣a∣,∣b∣)=(cos(α) ,sin (α))

e '1=(∣a '∣,∣b '∣)=(−sin(α) ,cos(α))cos(α)=

∣a∣∣e '0∣

=∣a∣1

=∣a∣

Page 23: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

23 / 67

Rotation

● Rotates around the z axis by the angle α

(cos(α) −sin(α)

sin(α) cos(α) )2D α – Positive angle to rotate by

Page 24: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

24 / 67

Rotation

● Rotates around the z axis by the angle α

(cos(α) −sin(α)

sin(α) cos(α) )2D

3D

α – Positive angle to rotate by

● Similar matrices that rotate around each main axis.

Page 25: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

25 / 67

Rotation

● Rotates around the z axis by the angle α

(cos(α) −sin(α)

sin(α) cos(α) )2D

3D

α – Positive angle to rotate by

● Similar matrices that rotate around each main axis.

● What about rotation around an arbitrary axis?

Page 26: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

26 / 67

Linear Transformations

Defined geometry

Page 27: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

27 / 67

Linear Transformations

Page 28: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

28 / 67

Linear Transformations

Scale

Page 29: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

29 / 67

Linear Transformations

Page 30: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

30 / 67

Linear Transformations

Rotation

Page 31: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

31 / 67

Linear Transformations

Page 32: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

32 / 67

Linear Transformations

Shear

Page 33: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

33 / 67

Linear Transformations

● Will these be enough?

Page 34: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

34 / 67

Translation

● Imagine a 1D world located at y=1 line in 2D.

Page 35: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

35 / 67

Translation

● Imagine a 1D world located at y=1 line in 2D.

Our world

Objects

Page 36: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

36 / 67

Translation

● Imagine a 1D world located at y=1 line in 2D.

Our world

Objects

● Notice that all the points are in the form: (x, 1)

Page 37: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

37 / 67

Translation

● How to transform the 2D space so that stuff in the 1D hyperplane y=1 moves an equal amount?

Page 38: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

38 / 67

Translation

● Shear-x by tan(45°) = 1

● Shear-x with tan(63.4°) = 2

Page 39: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

39 / 67

Translation● Affine transformation in the current space, linear

shear transformation in 1 dimension higher space.

(1 xt0 1 )⋅(x1)=(x+ xt1 )

(1 0 x t0 1 yt0 0 1 )⋅(

xy1)=(

x+ xty+ y t

1 )

(1 0 0 xt0 1 0 yt0 0 1 zt0 0 0 1

)⋅(xyz1)=(

x+ x ty+ y tz+ z t

1)1D

2D3D

Shear-x

Shear-xy Shear-xyz

Page 40: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

40 / 67

(a b c x td e f y tg h i z t0 0 0 1

)⋅(xyz1)=(

ax+by+cz+x tdx+ey+ fz+ y tgx+hy+iz+ z t

1)

Transformations

● This together gives us a very good toolset to transform our geometry as we wish.

Affine

trasnform

ation

Augmented matrix

Page 41: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

41 / 67

Transformations

● This together gives us a very good toolset to transform our geometry as we wish.

Linear transformations

Affine

trasnform

ation

Augmented matrix

(a b c x td e f y tg h i z t0 0 0 1

)⋅(xyz1)=(

ax+by+cz+x tdx+ey+ fz+ y tgx+hy+iz+ z t

1)

Page 42: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

42 / 67

Transformations

● This together gives us a very good toolset to transform our geometry as we wish.

Translation columnLinear transformations

Affine

trasnform

ation

Augmented matrix

(a b c x td e f y tg h i z t0 0 0 1

)⋅(xyz1)=(

ax+by+cz+x tdx+ey+ fz+ y tgx+hy+iz+ z t

1)

Page 43: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

43 / 67

Transformations

● This together gives us a very good toolset to transform our geometry as we wish.

Used for perspective projection...

Translation columnLinear transformations

Affine

trasnform

ation

Augmented matrix

(a b c x td e f y tg h i z t0 0 0 1

)⋅(xyz1)=(

ax+by+cz+x tdx+ey+ fz+ y tgx+hy+iz+ z t

1)

Page 44: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

44 / 67

Multiple Transformations

● How can we apply multiple transformations?

A⋅(B⋅(C⋅v))

● Is it the same as?

B⋅(A⋅(C⋅v))

Page 45: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

45 / 67

Transformations

● In some graphics libraries you assign the position / translation, rotation and scale individually.

Page 46: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

46 / 67

Transformations

● In some graphics libraries you assign the position / translation, rotation and scale individually.

Page 47: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

47 / 67

Transformations

● In some graphics libraries you assign the position / translation, rotation and scale individually.

● To the GPU the object transformations are sent as a matrix (model matrix).

Page 48: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

48 / 67

Transformations

● In some graphics libraries you assign the position / translation, rotation and scale individually.

● To the GPU the object transformations are sent as a matrix (model matrix).

projectionMatrix⋅viewMatrix⋅modelMatrix⋅v

P⋅V⋅M⋅v

Page 49: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

49 / 67

Transformations

● In some graphics libraries you assign the position / translation, rotation and scale individually.

● To the GPU the object transformations are sent as a matrix (model matrix).

● Questions about transformations?

Page 50: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

50 / 67

Scene Graph● Dependency between (parts of) objects.

Page 51: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

51 / 67

Scene Graph

S⋅B⋅L⋅v

S⋅B⋅R⋅v

Left hand

Right hand

S⋅B⋅vBody

S⋅H⋅vHead

Page 52: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

52 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)

M0

M1

M2

push(M)pop()

peek() / top()

Page 53: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

53 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

1) M = Identity, push(M)

I

Page 54: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

54 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

1) M = Identity, push(M)

2) M *= S, push(M)

I

Move to snowman's space

I S⋅

Page 55: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

55 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

1) M = Identity, push(M)

2) M *= S, push(M)

3) M *= H, push(M)

I

I S⋅

Move to head's space

I S H⋅ ⋅

Page 56: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

56 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

1) M = Identity, push(M)

2) M *= S, push(M)

3) M *= H, push(M)

4) Draw head vertices

I

I S⋅

I S H⋅ ⋅

Page 57: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

57 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

1) M = Identity, push(M)

2) M *= S, push(M)

3) M *= H, push(M)

4) Draw head vertices

I

I S⋅

I S H⋅ ⋅

We now want to get back to the

snowman's space

Page 58: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

58 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

I

I S⋅

I S H⋅ ⋅

1) M = Identity, push(M)

2) M *= S, push(M)

3) M *= H, push(M)

4) Draw head vertices

5) pop(), M = top()

Page 59: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

59 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

2) ...

3) M *= H, push(M)

4) Draw head vertices

5) pop(), M = top()

I

I S⋅

Page 60: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

60 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

2) ...

3) M *= H, push(M)

4) Draw head vertices

5) pop(), M = top()

6) M *= B, push(M)

I

I S⋅

I S B⋅ ⋅Move to body's space

Page 61: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

61 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

2) ...

3) M *= H, push(M)

4) Draw head vertices

5) pop(), M = top()

6) M *= B, push(M)

7) Draw body verticesI

I S⋅

I S B⋅ ⋅

Page 62: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

62 / 67

Matrix Stack● Stack can be used to save and load matrices

(intermediary states)● Current state is in the top of the stack

5) ...

6) M *= B, push(M)

7) Draw body vertices

8) ... ?

I

I S⋅

I S B⋅ ⋅

Page 63: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

63 / 67

Matrix Stack

● Each (part of an) object can be modelled in its own local space.

Page 64: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

64 / 67

Matrix Stack

● Each (part of an) object can be modelled in its own local space.

● When we traverse the scene graph, important intermediary states are saved / loaded.

push()

push()

push()

pop()pop()

pop()

A

A⋅B

A⋅C

Page 65: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

65 / 67

Matrix Stack

● Each (part of an) object can be modelled in its own local space.

● When we traverse the scene graph, important intermediary states can saved / loaded.

● No need to recalculate same matrix multiplications many times or find inverse transformations.

M=A⋅B⋅D⋅D1=A⋅B

stack.pop(), M=stack.top()vs

Page 66: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

66 / 67

Matrix Stack

● Each (part of an) object can be modelled in its own local space.

● When we traverse the scene graph, important intermediary states can saved / loaded.

● No need to recalculate same matrix multiplications many times or find inverse transformations.

● Questions about the matrix stack?

Page 67: Computer Graphics - tume-maailm.pri.eetume-maailm.pri.ee › ylikool › CG › 2018 › slides › 3 › Transformations.… · 4 / 67 Transformations Watch the Computerphile video,

67 / 67

What new did you find out today?

What more would you like to know?

Next time

Frames of reference, projections