Download presentation
Presentation is loading. Please wait.
1
THREE-DIMENSIONAL VIEWING II
12 고려대학교 컴퓨터 학과 김 창 헌
2
Contents Viewing Pipeline Viewing Coordinates
Specifying the Viewing Coordinates Transformation from WC to VC View Volumes and Projection Transformations Clipping Hardware Implementations 3D Viewing Functions Summary
3
Viewing Pipeline General 3D Transformation Pipeline Clipping against
Modeling Coordinates Modeling Transformation World Coordinates Viewing Transformation Viewing Coordinates Clipping against Viewing volume Projection Transformation Projection Coordinates Workstation Transformation Device Coordinates Project onto Projection plane
4
The Human Visual System
Cornea (각막) : 렌즈를 보호하는 투명막 Iris (홍채) : 눈에 들어오는 빛의 양을 조절 Lens : 3차원의 물체를 투영하여 2차원의 이미지를 형성함 Retina (망막) : 투영된 이미지가 맺히는 곳 Rods and Cones (시신경의 간상체) : 빛을 감지하는 신경
5
The simplest camera geometric model !
The Pinhole Camera The simplest camera geometric model ! Side view Angle of view(field) The angle made by the largest object that our camera can image on its film plane
6
The Synthetic Camera Model Equivalent views of image formation
Imaging with the sythetic camera Imaging system Projection Plane Center of Projection Projection Plane Equivalent views of image formation
7
Clipping (a) with window in initial position (b) with window shifted
Clipping window Clipping (a) with window in initial position (b) with window shifted
8
The Programmer’s Interface
Position The camera location usually is given by the position of the center of the lens(the center of projection) Orientation Place a camera coordinate system with its origin at the center of projection Focal length The focal length of the lens determines the size of the image on the film plane Flim plane The back of the camera has a height andq width Camera specification
9
Viewing Coordinates Camera positioning VRP VPN VUP
Specifying the view plane ! Use A viewing API Set_view_reference_point(x,y,z); VRP Set_view_plane_normal(nx,ny,nz); VPN Set_view_up(ux,uy,uz); VUP
10
Viewing Coordinate System
1. View reference point (VRP) - The camera position in the World-coordinate system - The origin of Viewing-coordinate system VPN(n) VRP VUP(v) zw xw yw u UVN coordinate system 2. View-plane normal (VPN) - The positive direction for the viewing zv axis 3. View- up vector (VUP) - Specify what direction is up to the camera - To establish the positive direction for the yv axis, VUP is adjusted to a position perpendicular to the normal vector VPN View plane 4. Set up the u vector - Using vectors N and V, determine the right-handed viewing system
11
Camera Positioning in OpenGL
1. Using the Model View Matrices The Camera Positioning Movement of the world frames Ex) glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0,0.0,-d); glRotatef(-90.0,0.0,1.0,0.0); Movement of the world frames a) Initial camera position b) After change in the model view matrix
12
Camera Positioning in OpenGL
2. Using the Look-At Function gluLookAt(eyex,eyey,eyez,atx,aty,atz,upx,upy,upz); Look-at positioning
13
Positioning of the Camera
Other Viewing APIs Roll,pitch and yaw Elevation and azimuth
14
Transformation from WC to VC
Transformation sequences 1. Translate the view reference point to the origin of the WC system 2. Apply rotations to align the xv, yv, and zv axes with the world axes General sequence of translate-rotate transformation
15
Transformation from WC to VC (con’t)
Translation view reference point(x0, y0, z0) Rotation rotate around the world xw axis to bring zv into the xwzw plane rotate around the world yw axis to align the zw and zv axis final rotation is about the zw axis to align the yw and yv axis
16
Transformation from WC to VC (con’t)
Direct generating the rotation-transformation matrix
17
View Window and View Volume
Definition of a View Volume View window - How much of the scene is caught on film - Can be placed any where on the view plane View volume - Only those objects within it will appear in the display - The volume size depends on the view window size - While its shape depends on the type of the projection
18
View Volumes and Projection
View volume boundary Near plane(Front plane) Far plane(Back plane) View window Parallelpiped Volume View Frustum Projection reference point
19
glFrustum(left,right,bottom,top,near,far);
Projections in OpenGL 1. Perspective Projection in OpenGL glFrustum(left,right,bottom,top,near,far); View point near far left right top bottom
20
gluPerspective(fovy,aspect,zNear,zFar);
Projections in OpenGL gluPerspective(fovy,aspect,zNear,zFar); aspect = w/h w h View point fovy near far
21
glOrtho(left,right,bottom,top,near,far);
Projections in OpenGL 2. Parallel Projection in OpenGL glOrtho(left,right,bottom,top,near,far); left top Toward the view point right bottom near far
22
Viewport Transformation
Mapping the Viewing volume to the Viewport glViewport( x, y, width, height); gluPerspective(myFovy,10.0, myNear, myFar); glViewport(0,0,400,400); gluPerspective(myFovy,10.0, myNear, myFar); glViewport(0,0,400,200);
23
OpenGL Viewing Summary
Ex) A Transformed Cube void CALLBACK myReshape() { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0,1.0,-1.0,1.0,1.5,20.0); glMatrixMode(GL_MODELVIEW); glViewport(0,0,w,h); } void main() auxInitDisplayMode(AUX_SINGLE |AUX_RGBA); auxInitPosition(0,0,500,500); auxReshapeFunc(myReshape); auxMainLoop(display); #include <GL/glos.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glaux.h> void CALLBACK display () { glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,1.0,1.0); glLoadIdentity(); glTranslatef(0.0,0.0,-5.0); glScalef(1.0,2.0,1.0); auxWireCube(1.0); glFlush(); } Define the Projection Define the Viewport ( w,h : Window Size ) Initial Position of the Window Positioning/ Scaling of the Camera
24
View Volume Properties
Changing the shape of the oblique-projection view volume by moving the window Changing perspective effects by moving the projection reference point
25
View Volume Properties
Projected object size depends on the view plane position relative to the position of the PRP Simulate the Camera moving in Animation - PRP move with the VRP
26
General Parallel-Projection Transformation
General Parallel-Projection Process Eliminating Z coordinate Oblique projection vector and view volume Regular view volume after shearing
27
General Parallel-Projection Transformation
※ Relationship between Vp and L,, and
28
General Perspective-Projection Transformation
1. Shear the view voume so that the centerline of the frustum is perpendicular to the view plane 2. Scale the view volume with a scaling factor that depends on 1/z Frustum Centerline zv (x,y,z) (x’,y’,z’) (x”,y”,z”) View plane View plane (xprp, yprp, zprp) Shearing View volume Pyramid into a Box
29
General Perspective-Projection Transformation
Step 1. Step 2.
30
Clipping Clipping Identify and save all surface segments within the view volume View-volume clipping boundary : planes
31
Normalized View Volumes
Normalized View Volumes Why? View Volume
32
Normalized View Volumes (con’t)
Pipeline
33
Normalized View Volumes (con’t)
Advantages provides a standard shape for representing any sized view volume clipping procedures are simplified and standardized with unit cube depth cueing and visible-surface determination are simplified Mapping position within a rectangular view volume to a 3D rectangular viewport Translation factors Ratios of the dimensions of the viewport and view volume
34
1. Parametric line equation
Viewport Clipping 1. Parametric line equation 2. Calculation of parameter value 3. Intersection point Side view of two line segments that are to be clipped
35
Clipping in Homogeneous
Clipping in Homogeneous Coordinates
36
Hardware Implementations
37
3D Viewing Functions Multiple Views Using Difference Camera Orientations
38
3D Viewing Functions (con’t)
A Wide-Angle Perspective Display Same viewing position, but with slight shifts in the viewing direction
39
Summary Modeling Coordinates Modeling Transformation World Coordinates
Viewing Transformation Viewing Coordinates Projection Transformation Projection Coordinates Workstation Transformation Device Coordinates
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.