Presentation is loading. Please wait.

Presentation is loading. Please wait.

Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.

Similar presentations


Presentation on theme: "Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr."— Presentation transcript:

1 Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr

2 Fundamental Types of Viewing
Perspective views finite COP (center of projection) Parallel views COP at infinity DOP (direction of projection) perspective view parallel view kucg.korea.ac.kr

3 Parallel View kucg.korea.ac.kr

4 Perspective View kucg.korea.ac.kr

5 Classical Viewing Specific relationship between the objects and the viewers kucg.korea.ac.kr

6 Orthographic Projections
Projectors are perpendicular to the projection plane preserve both distances and angles temple and three multiview orthographic projections orthographic projections kucg.korea.ac.kr

7 Axonometric Projections (1/2)
Projection plane can have any orientation with respect to the object projectors are still orthogonal to the projection planes construction top view side view kucg.korea.ac.kr

8 Axonometric Projections (2/2)
Preserve parallel lines but not angles isometric – projection plane is placed symmetrically with respect to the three principal faces dimetric – two of principal faces trimetric – general case kucg.korea.ac.kr

9 Axonometric Projections (2/2)
Preserve parallel lines but not angles isometric – projection plane is placed symmetrically with respect to the three principal faces dimetric – two of principal faces trimetric – general case kucg.korea.ac.kr

10 Oblique Projections Projectors can make an arbitrary angle with the projection plane preserve angels in planes parallel to the projection plane construction top view side view kucg.korea.ac.kr

11 Perspective Projections (1/2)
Diminution of size when objects are moved father from the viewer, their images become smaller kucg.korea.ac.kr

12 Perspective Projections (2/2)
One-, two-, and three-point perspectives how many of the three principal directions in the object are parallel to the projection plane vanishing points three-point perspective two-point perspective one-point perspective kucg.korea.ac.kr

13 Perspective Projections (2/2)
One-, two-, and three-point perspectives how many of the three principal directions in the object are parallel to the projection plane vanishing points three-point perspective two-point perspective one-point perspective kucg.korea.ac.kr

14 Perspective Projections (2/2)
One-, two-, and three-point perspectives how many of the three principal directions in the object are parallel to the projection plane vanishing points three-point perspective two-point perspective one-point perspective kucg.korea.ac.kr

15 Perspective Projections (2/2)
One-, two-, and three-point perspectives how many of the three principal directions in the object are parallel to the projection plane vanishing points three-point perspective two-point perspective one-point perspective kucg.korea.ac.kr

16 Positioning of the Camera (1/3)
OpenGL places a camera at the origin of the world frame pointing in the negative z direction move the camera away from the objects glTranslatef(0.0, 0.0, -d); initial configuration after change in the model-view matrix kucg.korea.ac.kr

17 Positioning of the Camera (2/3)
Look at the same object from the positive x axis translation after rotation by 90 degrees about the y axis glMatrixMode(GL_MODELVIEW); glLoadIdentity( ); glTranslatef(0.0, 0.0, -d); glRotatef(-90.0, 0.0, 1.0, 0.0); kucg.korea.ac.kr

18 Positioning of the Camera (3/3)
Create an isometric view of the cube y y y z x x view from positive z axis view from positive z axis view from positive x axis kucg.korea.ac.kr

19 Positioning of the Camera (3/3)
Create an isometric view of the cube 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); y y y x x x view from positive z axis view from positive z axis kucg.korea.ac.kr

20 determination of the view-up vector
U-V-N System (1/2) VRP (view-reference point), VPN (view-plane normal), and VUP (view-up vector) u, v (up-direction vector), n (normal vector)  x, y, z axes respectively determination of the view-up vector camera frame kucg.korea.ac.kr

21 U-V-N System (2/2) Translation after rotation
VRP – (x, y, z)  T(-x, -y, -z) VNP – (nx, ny, nz)  n VUP – vup  v = vup – (vup• n) n  u = v  n (※ our assumption – all vectors must be normalized ) kucg.korea.ac.kr

22 gluLookAt(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz);
Look-At Function OpenGL utility function VRP: eyePoint VPN: – ( atPoint – eyePoint ) VUP: upPoint – eyePoint gluLookAt(eyex, eyey, eyez, atx, aty, atz, upx, upy, upz); look-at positioning kucg.korea.ac.kr

23 Others Roll, pitch, and yaw Elevation and azimuth
ex. flight simulation Elevation and azimuth ex. star in the sky kucg.korea.ac.kr

24 Simple Perspective Projections (1/2)
Simple camera projection plane is orthogonal to z axis projection plane in front of COP three-dimensional view top view side view kucg.korea.ac.kr

25 Simple Perspective Projections (2/2)
Homogeneous coordinates Perspective projection matrix projection pipeline Model-view Projection Perspective division kucg.korea.ac.kr

26 Simple Orthogonal Projections
Projectors are perpendicular to the view plane Orthographic projection matrix kucg.korea.ac.kr

27 Projections in OpenGL Angle of view View volume
only objects that fit within the angle of view of the camera appear in the image View volume be clipped out of scene frustum – truncated pyramid kucg.korea.ac.kr

28 Perspective in OpenGL (1/2)
Specification of a frustum near, far: positive number !!  zmax = – far  zmin = – near glMatrixMode(GL_PROJECTION); glLoadIdentity( ); glFrustum(xmin, xmax, ymin, ymax, near, far); kucg.korea.ac.kr

29 Perspective in OpenGL (2/2)
Specification using the field of view fov: angle between top and bottom planes fovy: the angle of view in the up (y) direction aspect ratio: width divided by height glMatrixMode(GL_PROJECTION); glLoadIdentity( ); gluPerspective(fovy, aspect, near, far); kucg.korea.ac.kr

30 Parallel in OpenGL Orthographic viewing function
OpenGL provides only this parallel-viewing function near < far !!  no restriction on the sign  zmax = – far  zmin = – near glMatrixMode(GL_PROJECTION); glLoadIdentity( ); glOrtho(xmin, xmax, ymin, ymax, near, far); kucg.korea.ac.kr

31 Walking Though a Scene (1/2)
void keys(unsigned char key, int x, int y) { if(key == ‘x’) viewer[0] -= 1.0; if(key == ‘X’) viewer[0] += 1.0; if(key == ‘y’) viewer[1] -= 1.0; if(key == ‘Y’) viewer[1] += 1.0; if(key == ‘z’) viewer[2] -= 1.0; if(key == ‘Z’) viewer[2] += 1.0; } void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(viewer[0], viewer[1], viewer[2], 0,0,0, 0,1,0); glRotatef(theta[0], 1.0, 0.0, 0.0); glRotatef(theta[1], 0.0, 1.0, 0.0); glRotatef(theta[2], 0.0, 0.0, 1.0); colorcube( ); glFlush( ); glutSwapBuffers( ); } kucg.korea.ac.kr

32 Walking Though a Scene (2/2)
void myReshape(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity( ); if( w <= h ) glFrustum(-2.0, 2.0, -2.0*(GLfloat)h/(GLfloat)w, 2.0*(GLfloat)h/(GLfloat)w, 2.0, 20.0); else glFrustum(-2.0 *(GLfloat)w/(GLfloat)h, 2.0 *(GLfloat)w/(GLfloat)h, -2.0, 2.0, 2.0, 20.0); glMatrixMode(GL_MODELVIEW); } kucg.korea.ac.kr

33 Projections & Shadows (1/2)
Shadow polygon Steps light source at (xl, yl, zl) translation (-xl, -yl, -zl) perspective projection through the origin translation (xl, yl, zl) kucg.korea.ac.kr

34 Projections & Shadows (2/2)
GLfloat m[16]; /* shadow projection matrix */ for(i=0; i<16; i++) m[i] = 0.0; m[0] = m[5] = m[10] = 1.0; m[7] = -1.0/yl; glColor3fv(polygon_color); glBegin(GL_POLYGON); . . /* draw the polygon normally */ glEnd( ); glMatrixMode(GL_MODELVIEW); glPushMatrix( ); /* save state */ glTranslatef(xl, yl, zl); /* translate back */ glMultMatrixf(m); /* project */ glTranslatef(-xl, -yl, -zl); /* move light to origin */ glColorfv(shadow_color); . /* draw the polygon again */ glPopMatrix( ); /* restore state */ kucg.korea.ac.kr

35 Shadows from a Cube onto Ground
kucg.korea.ac.kr


Download ppt "Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr."

Similar presentations


Ads by Google