Viewing in 3D 1. Projections Types: perspective parallel / orthographic 2. Viewing Parameters: position of the viewer’s eye location of the viewing plane 2-coordinate systems o the scene (object) o viewing eye coordinate system 3. Clipping: against 3D-view volume 4. Projection and displaying on viewport Consider Projection Transformation : Projection: It is a process that transform points in a coordinate system of dimension n into points in a coordinate system of dimension less than n. Projection from 3D to 2D tools: projectors: straight projection rays center of projection (COP) projection plane ==> (not curved surface). This type is called Planar Geometric Projection. Types of Projections: 1. Perspective Projection projectors meet at center of projection (eye, camera) approximation of human visual system distortion close to COP 2. Parallel Projection Projectors are parallel COP is at infinity 1. Perspective Projection: The size of perspective projection of an object varies inversely with the distance of that object from the center of projection o not realistic o distances cannot be taken from the projection o angles are preserved on only those faces of the objects parallel to the projection plane Vanishing point: o The perspective projection of any set of parallel lines that are not parallel to projection plane converges to a vanishing point. ==> (parallel lines meet at infinity ==> VP ) Axis vanishing point: o When the set of lines is parallel to one of the 3 axes(, x, y and z). What is the maximum number of vanishing points? One-point perspective projection of cube onto plane cutting the z-axis. The projection plane normal is parallel to the z-axis. 2. Parallel Projections: Depending on the relation between the direction of projection and the normal to the projection plane: a - orthographic : both directions are the same (or the reverse of each other) b - oblique: direction of projection is not normal to the projection plane. Examples: (1) Orthographic Projection (2) Oblique Projection (projectors are not normal to projection plane) (3) Isometric Projection: It is the kind of projection generated when the projection plane normal makes equal angles with each principle axis. (4) Axonometric Orthographic Projection: The type of projection that uses planes that are not normal to a principal axis and therefore show several faces of the object at once. Remarks on Parallel Projection: less realistic view can be used for exact measurements parallel lines remain parallel angles are preserved only on faces of the object parallel to the projection plane. Projection of 3D scene onto 2D screen has two major components: 1 specification of a camera 2 specification of a viewing transformation The viewing transformation: specification of the parameters: - A field-of-view angle, - Near and far bounding planes perpendicular to z. - A 3D view of the camera and its viewing space as in the figure below: Camera Viewing Space Consider a side view of such a space: Viewing Pyramid note: u-axis coming out of the paper: note: forms a viewing volume in the shape of a pyramid with the camera at the apex of the pyramid and the negative-w axis of the pyramid The Viewing Transformation Matrix Given the specs of parameters , n, f , we define the transformation of 3D scene elements to the cube 1 u , v, w 1 is: A ,n , f 0 0 0 cot( 2 ) 0 cot( ) 0 0 2 f n 0 0 1 f n 2 fn 0 0 0 f n viewing transformation matrix Development of the matrix: - consider camera at origin - use similar triangles: d v' v w d u' u w The transformation that projects du dv du dv dw (u , v, w) ( , ,d) ( , , ) w w w w w This can be expressed in H-D homogeneous coordinate: (u, v, w,1) (du, dv, dw, w) In a Matrix form: d 0 0 0 d 0 Pd 0 0 d 0 0 0 0 0 1 0 Consider: Need to transfer the viewing pyramid defined by , n and f into the cube 1 u , v, w 1 . To transform the truncated viewing pyramid to the cube, P-matrix can be used: d 0 0 0 0 d 0 0 P (*) 0 0 da 1 0 0 b 0 where a and b are chosen constants which will cause the w values of the transformed truncated viewing pyramid to lie in the range 1 w 1. So we get: (0,0,n) P (0,0,1) and (0,0, f ) P (0,0,1) We have: d 0 0 0 0 d 0 0 0 0 dan b n 0 0 n 1 0 0 da 1 0 0 b 0 and d 0 0 0 0 d 0 0 0 0 daf b f 0 0 f 1 0 0 da 1 0 0 b 0 Projecting back to the 3D we get: dan b (0,0,n) P (0,0, ) n and daf b (0,0, f ) P (0,0, ) f In order that the values on the left map to (0,0,1) and (0,0,-1) respectively we must have: -dan+b = n and -daf+b = -f subtract these equations and solve for (a) daf dan f n 2 f n by substitution: 2 fn b f n Inserting these values in our transformation matrix P indicated by * above a d 0 0 d P 0 0 0 0 0 0 f n f n 2 fn f n 0 0 1 0