Download presentation
Presentation is loading. Please wait.
Published byMeghan Ella Simmons Modified over 9 years ago
1
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0
2
Outline 2D Coordinate transformation Composite transformation 3D transformation Required readings: HB 7-8, 9-1 to 9-9 1
3
Image space Coordinate Transform: 3D Geometry Pipeline 2 Normalized project space View space World spaceObject space Aspect ratio & resolution Focal length Rotate and translate the camera
4
Coordinate Transformation: 3D Modeling/Design Coordinate transformation from one reference frame to another 3
5
Coordinate Transformation: Animation/Robotics How to model 2D movement of animated characters or robots? 4 Click herehere
6
Coordinate Transformation Coordinate transformation from one reference frame to another 5
7
Coordinate Transformation Coordinate transformation from one reference frame to another 6 Local reference frame
8
Coordinate Transformation Coordinate transformation from one reference frame to another 7 Local reference frame Global reference frame
9
Coordinate Transformation Coordinate transformation from one reference frame to another ? 8 Local reference frame Global reference frame
10
Review – Vector Operations Dot Product 9
11
Review – Vector Operations Dot Product: measuring similarity between two vectors 10
12
Review – Vector Operations Dot Product: measuring similarity between two vectors 11
13
Review – Vector Operations Dot Product: measuring similarity between two vectors Unit vector: 12
14
Review – Vector Operations Dot Product: measuring similarity between two vectors 13
15
Review – Vector Operations Dot Product: measuring similarity between two vectors 14
16
Review – Vector Operations Cross Product: measuring the area determined by two vectors 15
17
Review – Vector Operations Cross Product: measuring the area determined by two vectors 16
18
2D Coordinates 2D Cartesian coordinate system: P: (x,y) 17
19
2D Coordinate Transformation 2D Cartesian coordinate system: P: (x,y) 18
20
2D Coordinate Transformation 2D Cartesian coordinate system: P: (x,y) 19
21
2D Coordinate Transformation Transform object description from to p 20
22
2D Coordinate Transformation Transform object description from to p 21 Given the coordinates (x’,y’) in i’j’ - how to compute the coordinates (x,y) in ij?
23
2D Coordinate Transformation Transform object description from to p 22 Given the coordinates (x’,y’) in i’j’ - how to compute the coordinates (x,y) in ij?
24
2D Coordinate Transformation Transform object description from to p 23 Given the coordinates (x’,y’) in i’j’ - how to compute the coordinates (x,y) in ij?
25
2D Coordinate Transformation Transform object description from to p 24
26
2D Coordinate Transformation Transform object description from to p 25
27
2D Coordinate Transformation Transform object description from to p 26
28
2D Coordinate Transformation Transform object description from to p 27
29
2D Coordinate Transformation Transform object description from to p 28
30
2D Coordinate Transformation Transform object description from to p 29
31
2D Coordinate Transformation Transform object description from to p 30
32
2D Coordinate Transformation Transform object description from to p 31
33
2D Coordinate Transformation Transform object description from to p 32
34
2D Coordinate Transformation Transform object description from to p 33
35
2D Coordinate Transformation Transform object description from to p 34
36
2D Coordinate Transformation Transform object description from to p 35
37
2D Coordinate Transformation Transform object description from to p 36
38
2D Coordinate Transformation p 37 What does this column vector mean?
39
2D Coordinate Transformation Transform object description from to p 38 What does this column vector mean? Vector i’ in the new reference system
40
2D Coordinate Transformation Transform object description from to p 39 What does this column vector mean?
41
2D Coordinate Transformation Transform object description from to p 40 What does this column vector mean? Vector j’ in the new reference system
42
2D Coordinate Transformation Transform object description from to p 41 What does this column vector mean?
43
2D Coordinate Transformation Transform object description from to p 42 What does this column vector mean? The old origin in the new reference system
44
2D Coordinate Transformation 2D translation p 43
45
2D Coordinate Transformation 2D translation p ? ? ? ? 44
46
2D Coordinate Transformation 2D translation p 1 0 0 1 45
47
2D Coordinate Transformation 2D translation&rotation p ? 46
48
2D Coordinate Transformation 2D translation&rotation p ? 47
49
2D Coordinate Transformation 2D translation&rotation p 48
50
2D Coordinate Transformation 2D translation&rotation p ? 49
51
2D Coordinate Transformation 2D translation&rotation p 50
52
2D Coordinate Transformation 2D translation&rotation p ? 51
53
2D Coordinate Transformation 2D translation&rotation p 52
54
2D Coordinate Transformation An alternative way to look at the problem P=[x,y] 53 - set up a transformation that superimposes the x’y’ axes onto the xy axis
55
2D Coordinate Transformation An alternative way to look at the problem P=[x,y] 54 - set up a transformation that superimposes the x’y’ axes onto the xy axis
56
2D Coordinate Transformation An alternative way to look at the problem P=[x,y] 55 - set up a transformation that superimposes the x’y’ axes onto the xy axis
57
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) p 56
58
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) How to transform the point from (x’,y’) to (x,y)? p 57
59
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) How to transform the point from (x’,y’) to (x,y)? Invert the matrix! p 58
60
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) How to transform the point from (x’,y’) to (x,y)? Invert the matrix! p 59
61
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) How to transform the point from (x’,y’) to (x,y)? Invert the matrix! p 60
62
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) How to transform the point from (x’,y’) to (x,y)? Invert the matrix! p 61
63
2D Coordinate Transformation An alternative way to look at the problem This transforms the point from (x,y) to (x’,y’) How to transform the point from (x’,y’) to (x,y)? Invert the matrix! p 62
64
2D Coordinate Transformation Same results! p 63
65
2D Coordinate Transformation 2D translation&rotation p 64
66
2D Coordinate Transformation 2D translation&rotation p 65
67
2D Coordinate Transformation 2D translation&rotation p 66
68
2D Coordinate Transformation 2D translation&rotation p 67
69
2D Coordinate Transformation 2D translation&rotation p 68
70
2D Coordinate Transformation 2D translation&rotation p 69
71
Composite 2D Transformation How to model 2D movement of characters or robots? 70 Click herehere
72
Composite 2D Transformation A 2D lamp character 71
73
Composite 2D Transformation A 2D lamp character – skeleton size 72
74
Composite 2D Transformation How can we draw the character given the pose ? 73
75
Articulated Character Local reference frames with a default pose (0,0,0,0,0,0)
76
Composite 2D Transformation What’s the pose? 75
77
Composite 2D Transformation What’s the pose? 76
78
Composite 2D Transformation A 2D lamp character Given,, how to compute the global position of a point A? ? 77
79
Composite 2D Transformation What’s local coordinate ? ? 78
80
Composite 2D Transformation What’s local coordinate ? ? 79
81
Composite 2D Transformation What’s the current coordinate A ? ? 80
82
Composite 2D Transformation What’s the current coordinate A ? ? 81
83
Composite 2D Transformation What’s the current coordinate A ? ? 82
84
Composite 2D Transformation What’s the current coordinate A ? ? 83
85
Composite 2D Transformation What’s the current coordinate A ? 84
86
How to Animate the Character? A 2D lamp character 85
87
How to Animate the Character? Keyframe animation - Manually pose the character by choosing appropriate values for - Linearly interpolate the inbetween poses. - Works for any types of articulated characters! 86
88
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates We will still use column vectors to represent points Homogeneous coordinates of a 3D point (x,y,z,1) Transformation will be performed using 4x4 matrix 87
89
Right-handed Coordinate System Left hand coordinate system Not used in this class and Not in OpenGL 88/94
90
3D Transformation Very similar to 2D transformation Translation transformation Homogenous coordinates 89
91
3D Transformation Very similar to 2D transformation Scaling transformation Homogenous coordinates 90
92
3D Transformation 3D rotation is done around a rotation axis Fundamental rotations – rotate about x, y, or z axes Counter-clockwise rotation is referred to as positive rotation (when you look down negative axis) x y z + 91
93
3D Transformation Rotation about z – similar to 2D rotation x y z + 92
94
3D Transformation Rotation about y: z -> y, y -> x, x->z y z x x y z 93
95
3D Transformation Rotation about x (z -> x, y -> z, x->y) x y z z x y 94
96
Inverse of 3D Transformations Invert the transformation In general, X= AX’->x’=A -1 X T(t x,t y,t z ) T(-t x,-t y,-t z )
97
3D Rotation about Arbitrary Axes Rotate p about the by the angle 96
98
3-D Rotation General rotations in 3-D require rotating about an arbitrary axis of rotation Deriving the rotation matrix for such a rotation directly is a good exercise in linear algebra The general rotation matrix is a combination of coordinate-axis rotations and translations! 97
99
3D Rotation about Arbitrary Axes Rotate p about the by the angle 98
100
3-D Rotation General rotations in 3-D require rotating about an arbitrary axis of rotation Deriving the rotation matrix for such a rotation directly is a good exercise in linear algebra Standard approach: express general rotation as composition of canonical rotations Rotations about x, y, z 99
101
Composing Canonical Rotations Goal: rotate about arbitrary vector r by θ Idea: we know how to rotate about x,y,z Set up a transformation that superimposes rotation axis onto one coordinate axis Rotate about the coordinate axis Translate and rotate object back via inverse of the transformation matrix 100
102
Composing Canonical Rotations Goal: rotate about arbitrary vector r by θ Idea: we know how to rotate about x,y,z So, rotate about z by - until r lies in the xz plane Then rotate about y by -β until r coincides with +z Then rotate about z by θ Then reverse the rotation about y (by β ) Then reverse the rotation about z (by ) 101
103
3D Rotation about Arbitrary Axes Rotate p about the by the angle 102
104
3D Rotation about Arbitrary Axes Translate so that rotation axis passes through the origin 103
105
3D Rotation about Arbitrary Axes Rotation by about z-axis 104
106
3D Rotation about Arbitrary Axes Rotation by about y-axis 105
107
3D Rotation about Arbitrary Axes Rotation by about z-axis 106
108
3D Rotation about Arbitrary Axes Rotation by about y-axis 107
109
3D Rotation about Arbitrary Axes Rotation by about z-axis 108
110
3D Rotation about Arbitrary Axes Translate the object back to original point 109
111
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis 110
112
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis 111
113
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis
114
3D Rotation about Arbitrary Axes Final transformation matrix for rotating about an arbitrary axis A 3 by 3 Rotation matrix—orthogonal matrix
115
Rotation Matrices Orthonormal matrix: orthogonal (columns/rows linearly independent) normalized (columns/rows length of 1) 114
116
Rotation Matrices Orthonormal matrix: orthogonal (columns/rows linearly independent) normalized (columns/rows length of 1) The inverse of an orthogonal matrix is just its transpose: 115
117
Rotation Matrices Orthonormal matrix: orthogonal (columns/rows linearly independent) normalized (columns/rows length of 1) The inverse of an orthogonal matrix is just its transpose: 116
118
Rotation Matrices Orthonormal matrix: orthogonal (columns/rows linearly independent) normalized (columns/rows length of 1) The inverse of an orthogonal matrix is just its transpose: 117
119
Why? Rotation Matrices 118
120
Why? Rotation Matrices 119
121
Why? Rotation Matrices 120
122
Why? Rotation Matrices 121
123
Rotation Matrices Orthonormal matrix: orthogonal (columns/rows linearly independent) normalized (columns/rows length of 1) The inverse of an orthogonal matrix is just its transpose: e.g., 122
124
3D Coordinate Transformation Transform object description from to p 123
125
2D Coordinate Transformation Transform object description from to p 124
126
3D Coordinate Transformation Transform object description from to p 125
127
3D Coordinate Transformation Transform object description from to p 126
128
3D Coordinate Transformation Transform object description from to 127 p
129
3D Coordinate Transformation Transform object description from to 128 x y z
130
Composite 3D Transformation Similarly, we can easily extend composite transformation from 2D to 3D 129
131
Composite 3D Transformation 130
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.