1 / 16

Honours Graphics 2008

Honours Graphics 2008. Session 3. Today’s focus. Perspective and orthogonal projection Quaternions Graphics camera. Projections. Visualizing 3D data on a 2D screen requires projection of the data onto a 2D plane Several projection models exist, with varying qualities

duke
Download Presentation

Honours Graphics 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Honours Graphics 2008 Session 3

  2. Today’s focus • Perspective and orthogonal projection • Quaternions • Graphics camera

  3. Projections • Visualizing 3D data on a 2D screen requires projection of the data onto a 2D plane • Several projection models exist, with varying qualities • We’re interested in orthogonal and perspective projection

  4. Perspective projection

  5. Perspective projection, cont. • Starting from world coordinate space:

  6. Increasing focal length and distance of the camera to infinity changes perspective into orthogonal projection

  7. Orthogonal projection • Flat, 2D projection • Used when precise profiles or measurements need to be displayed • Special case of perspective projection, when focal length approaches infinity

  8. Quaternions • Developed by Sir William Rowan Hamilton in 1843 • Generally superceded by vectors and matrices, but still very useful in applied mathematics and computer graphics • Specifically useful to compute 3D rotations • Consists of scalar and “vector” components

  9. Quaternions, cont. • Defined as an extension to the complex numbers: three components i, j and k all are squareroots of -1, hence • Furthermore

  10. Quaternions, cont. • Finally • Quaternion addition and subtraction

  11. Quaternions, cont. • Magnitude of a quaternion • Quaternion multiplication

  12. Quaternions, cont. • For graphics purposes a unit quaternion is used, which has the property that • Unit quaternions represent rotation / orientation

  13. Quaternions, cont. • Quaternion to rotation matrix conversion

  14. Graphics camera • Both DirectX and OpenGL expose camera parameters that consist of • View position • View target • Relative view-up direction

  15. Camera commands • OpenGLvoid gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ ) • DirectXD3DXMatrixLookAtLH(mat, eye, center, up);DX9Device.SetTransform(D3DTS_VIEW, mat);

  16. Homework • Write a camera library that makes use of quaternions. Allow for keyboard and mouse input to control the camera. • For next session

More Related