330 likes | 541 Views
Viewing (Part 1). Projection types Positioning of the camera Defining the camera frame Simple perspective projection matrix Simple orthogonal projection matrix. Orthographic Projections of a Temple. Viewing. (Center of Projection). Perspective Viewing.
E N D
Viewing (Part 1) • Projection types • Positioning of the camera • Defining the camera frame • Simple perspective projection matrix • Simple orthogonal projection matrix
Viewing (Center of Projection)
Positioning of the Camera • Specify the position indirectly by applying a sequence of rotations and translations to the model-view matrix (before adding objects to the scene). • Using OpenGL viewing APIs
Movement of the Camera and World Frames Initial Configuration After change in model-view matrix glTranslate(0.0, 0.0, -d)
Example of Positioning the Camera glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, -d); glRotatef(-90.0, 0.0, 1.0, 0.0);
y x z Another example:Creating an isometric view of a cube Ry Rx
y x z Rx Cube after Rotation about X-Axis
Rx Rotation angles y M = T Rx Ry • Ry: 45 degrees • Rx: 35.26 degrees Ry x z
How to specify in OpenGL? glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, -d); glRotatef(35.26, 1.0, 0.0, 0.0); glRotatef(45.0, 0.0, 1.0, 0.0);
Movement of the Camera Frame Initial Configuration After change in Camera Frame
Defining the Camera Frame n: View-plane Normal (VPN) VUP: View-Up Vector VRP: View-Reference Point Projection plane u-v-n system Viewing coordinate system
Defining the Camera Frame in OpenGL set_view_reference_point (x, y, z); set_view_plane_normal (nx, ny, nz); set_view_up (vup_x, vup_y, vup_z);
VPN Look-at Positioning At point VPN Eye point
Look-at Positioning gluLookAt (eyex, eyey, eyez, atx, aty, atz, upx, upy, upz);
Describing camera location usingRoll, Pitch, and Yaw Center of mass
Describing camera location using Elevation and Azimuth Polar coordinate system
Simple camera General camera -z -z Lens Projection plane Perspective projection matrix in case of simple camera
Top view Side view (xp, - d) (yp, - d) z = -d z = -d Projection plane (z = -d) Perspective Projection
(x, z) (xp, - d) zp = -d Transformation equations Division by z cases further objects to become smaller (non-uniform foreshortening)
q Simple Perspective Projection Matrix