Lecture 2 - Transformations for animation (notes)

Lecture 2 - Transformations for animation (notes) - Lecture...

Info icon This preview shows pages 1–3. Sign up to view the full content.

Lecture 2: Scene Transformation and Animation Flying Sequences We will now consider an important part of graphics processing: scene transformation . In any viewer-centered application, such as a flight simulator or a computer game, we need to view the scene from a moving position. As the viewpoint changes we transform all the coordinates of the scene - such that the viewpoint is the origin and the view direction is the z axis - before projecting and drawing it. Let us suppose that, in the coordinate system in which the scene is defined we wish to view it from the point C = ( C x , C y , C z ) , looking along the direction d = ( d x , d y , d z ) T . The first step is to move the origin to C for which we use the transformation matrix A . x y z O C d x y z d A = 1 0 0 - C x 0 1 0 - C y 0 0 1 - C z 0 0 0 1 Following this, we wish to rotate about the y -axis so that d lies in the yz plane ( x = 0 ). Define v to be the projection of d onto the newly translated xz plane with magnitude v . So v 2 = d 2 x + d 2 z (See Figure 1 left). Viewing from above, along the negative y -axis, we can derive the matrix B to carry out the required rotation. v = p d 2 x + d 2 z cos θ = d z /v sin θ = d x /v so B = cos θ 0 - sin θ 0 0 1 0 0 sin θ 0 cos θ 0 0 0 0 1 = d z /v 0 - d x /v 0 0 1 0 0 d x /v 0 d z /v 0 0 0 0 1 y z x d d z d x d y v x z v θ d x d z Figure 1: Rotating about the y axis so that d becomes aligned with the yz plane ( x = 0 ). Left: A 3D view. Right: Looking from above at the xz plane. Notice that we have avoided computing the cos and sin functions for this rotation by using the components of d and the magnitude of v . To get the direction vector lying along the z axis, a further rotation is needed. This time it is about the x axis using matrix C . This rotation is illustrated in Figure 2. v = p d 2 x + d 2 z cos φ = v/ | d | sin φ = d y / | d | so C = 1 0 0 0 0 cos φ - sin φ 0 0 sin φ cos φ 0 0 0 0 1 = 1 0 0 0 0 v/ | d | - d y / | d | 0 0 d y / | d | v/ | d | 0 0 0 0 1 Finally the transformation matrices are combined into a single transformation matrix by multiplying them together. T = CBA Interactive Computer Graphics Lecture 2 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

y z x |d| d y y z ϕ v= | v | ϕ v |d| d y Figure 2: Rotating about the x axis so that d becomes aligned with the z axis. Each point P of the scene is then transformed so that its new coordinates P t are given by: P t = CBA P = T P Problems with verticals In the above analysis on how to re-align the view di- rection, we ignored the concept of the vertical direc- tion. This needs attention since the way in which the view direction is re-aligned has an effect on the verti- cal. For example, it is easy to invert the vertical and end up viewing the scene up side down. In the exam- ple on the right, where an object whose base is on the negative z axis is being observed from the origin along d = (0 , 0 , - 1) T .
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern