Today
- 3D Transformations
- Viewing (观测) transformation
- View (视图) / Camera transformation
- Projection (投影) transformation
- Orthographic (正交) projection
- Perspective (透视) projection
3D Transformations
- Scale: $\mathbf{S}(s_x, s_y, s_z) = \begin{pmatrix}s_x&0&0&0\\0&s_y&0&0\\0&0&s_z&0\\0&0&0&1\end{pmatrix}$
- Translation: $\mathbf{T}(t_x, t_y, t_z) = \begin{pmatrix}1&0&0&t_x\\0&1&0&t_y\\0&0&1&t_z\\0&0&0&1\end{pmatrix}$
- Rotate around x-, y-, or z-axis
- $\mathbf{R}_x(\alpha) = \begin{pmatrix}1&0&0&0\\0&cos\alpha&-sin\alpha&0\\0&sin\alpha&cos\alpha&0\\0&0&0&1\end{pmatrix}$
- $\mathbf{R}_y(\alpha) = \begin{pmatrix}cos\alpha&0&sin\alpha&0\\0&1&0&0\\-sin\alpha&0&cos\alpha&0\\0&0&0&1\end{pmatrix}$
- $\mathbf{R}_z(\alpha) = \begin{pmatrix}cos\alpha&-sin\alpha&0&0\\sin\alpha&cos\alpha&0&0\\0&0&1&0\\0&0&0&1\end{pmatrix}$
3D Rotations
- Compose any 3D rotation from $\mathbf{R}_x, \mathbf{R}_y, \mathbf{R}_z$?
- $\mathbf{R}_{xyz}(\alpha,\beta,\gamma) = \mathbf{R}_x(\alpha)\mathbf{R}_y(\beta)\mathbf{R}_z(\gamma)$
- So-called Euler angles
- Often used in flight simulators: roll (左右倾斜/翻滚), pitch (抬头低头/俯仰), yaw (左右转向/偏航)
Rodrigues’ Rotation Formula
- Rotation by angle $\alpha$ around axis $\mathbf{n}$
- $\mathbf{R}(\mathbf{n}, \alpha) = cos(\alpha)\mathbf{I}+(1-cos(\alpha))\mathbf{nn}^T+sin(\alpha)\begin{pmatrix}0&-n_z&n_y\\n_z&0&-n_x\\-n_y&n_x&0\end{pmatrix}$
- How to prove this magic formula?
- Checkout the supplementary material on the course website!
View / Camera Transformation
- What is view transformation?
- Think about how to take a photo
- Find a good place and arrange people (model transformation)
- Find a good “angle” to put the camera (view transformation)
- Cheese! (projection transformation)
- How to perform view transformation?
- Define the camera first
- Position $\vec{e}$
- Look-at / gaze direction $\hat{g}$
- Up direction $\hat{t}$ (assuming perp. to look-at)
- Key observation
- If the camera and all objects move together, the “photo” will be the same
- How about that we always transform the camera to
- The origin, up at Y, look at -Z
- And transform the objects along with the camera