Viewing in 3D

Viewing in 3D

Viewing in 3D Viewing in 3D Foley & Van Dam, Chapter 6 • Transformation Pipeline • Viewing Plane • Viewing Coordinate System • Projections • Orthographic • Perspective OpenGL Transformation Pipeline Viewing Coordinate System Homogeneous coordinates in World System zw world yw ModelViewModelView Matrix Matrix xw Tractor Viewing System Viewer Coordinates System ProjectionProjection Matrix Matrix Clip y Coordinates v Front- xv ClippingClipping Wheel System P0 zv ViewportViewport Transformation Transformation ne pla ing Window Coordinates View Specifying the Viewing Coordinates Specifying the Viewing Coordinates • Viewing Coordinates system, [xv, yv, zv], describes 3D objects with respect to a viewer zw y v P v xv •A viewing plane (projection plane) is set up N P0 zv perpendicular to zv and aligned with (xv,yv) yw xw ne pla ing • In order to specify a viewing plane we have View to specify: •P0=(x0,y0,z0) is the point where a camera is located •a vector N normal to the plane • P is a point to look-at •N=(P-P)/|P -P| is the view-plane normal vector •a viewing-up vector V 0 0 •V=zw is the view up vector, whose projection onto • a point on the viewing plane the view-plane is directed up Viewing Coordinate System Projections V u N z N ; x ; y z u x • Viewing 3D objects on a 2D display requires a v v V u N v v v mapping from 3D to 2D • The transformation M, from world-coordinate into viewing-coordinates is: • A projection is formed by the intersection of certain lines (projectors) with the view plane 1 2 3 ª x v x v x v 0 º ª 1 0 0 x 0 º « » « » y 1 y 2 y 3 0 0 1 0 y • Projectors are lines from the center of projection M « v v v » « 0 » R T 1 2 3 « z z z 0 » « 0 0 1 z 0 » « v v v » « » through each point in the object ¬« 0 0 0 1 ¼» ¬ 0 0 0 1 ¼ Center of • Defining the camera in OpenGL: Projection glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(P0x, P0y, P0z, Px, Py, Pz, Vx, Vy, Vz); Projections Projections • Center of projection at infinity results with a parallel • Parallel projections preserve relative proportions of projection objects, but do not give realistic appearance (commonly used in engineering drawing) • A finite center of projection results with a perspective projection • Perspective projections produce realistic appearance, but do not preserve relative proportions Perspective Projection Parallel Projection Orthographic Projection • Projectors are all parallel Since the viewing plane is aligned with (xv,yv), • Orthographic: Projectors are perpendicular orthographic projection is performed by: to the projection plane ª x p º ª x v º ª 1 0 0 0 º ª x v º « » « » « » « » y p y v 0 1 0 0 y v • Oblique: Projectors are not necessarily « » « » « » « » « 0 » « 0 » « 0 0 0 0 » « z v » perpendicular to the projection plane « » « » « » « » ¬ 1 ¼ ¬ 1 ¼ ¬ 0 0 0 1 ¼ ¬ 1 ¼ Orthographic Oblique (x,y,z) (x,y) yv xv P0 zv Orthographic Projection Oblique Projection • Lengths and angles of faces parallel to the • Projectors are not perpendicular to the viewing planes are preserved viewing plane • Problem: 3D nature of projected objects is • Angles and lengths are preserved for faces parallel to the plane of projection difficult to deduce Top View • Preserves 3D nature of an object w Fr ie on e V t v id yv (x ,y ) iew S p p xv (x,y,z) (x,y) Oblique Projection Oblique Projection •Two types of oblique projections are ª x p º ª 1 0 a cos I 0 º ª x v º ª x v z v a cos I º « » « » « » « » y p 0 1 a sin I 0 y v y v z v a sin I commonly used: « » « » « » « » « 0 » « 0 0 0 0 » « z v » « 0 » – Cavalier: R tan « » « » « » « » D ¬ 1 ¼ ¬ 0 0 0 1 ¼ ¬ 1 ¼ ¬ 1 ¼ – Cabinet: D tan-1 |R y yv v 1/a=tan(D) (x ,y ) (xp,yp) z/b= 1/a p p b=za D D b b x =z a cos( ) p I x a xv a v (x,y,z) I yp=zasin(I) (x,y,z) I (x,y,1) (x,y,1) (x,y) (x,y) Oblique Projection Oblique Projection • Cavalier projection : 1 1 1 1 – Preserves lengths of lines perpendicular 1 1 to the viewing plane I=45o I=30o – 3D nature can be captured but shape seems distorted Cavalier Projections of a cube – Can display a combination of front, side, for two values of angle I and top views • Cabinet projection: 0.5 1 1 0.5 – Lines perpendicular to the viewing plane project 1 1 at 1/2 of their length I=45o I=30o – A more realistic view than the Cavalier projection Cabinet Projections of a cube for two values of angle I – Can display a combination of front, side, and top views Perspective Projection Perspective Projection • In a perspective projection, the center of projection is at a finite distance from the viewing plane • The size of a projected object is inversely proportional to it distance from the viewing plane • Parallel lines that are not parallel to the viewing plane, converge to a vanishing point • A vanishing point is the projection of a point at infinite distance Z-axis y vanishing point x z Vanishing Points Vanishing Points • There are infinitely many general vanishing y points • There can be up to three principal vanishing x points (axis vanishing points) • Perspective projections are categorized by z the number of principal vanishing points, equal One point (z axis) perspective projection to the number of principal axes intersected by x axis z axis the viewing plane vanishing point vanishing point • Most commonly used: one-point and two- points perspective Two points perspective projection Perspective Projection Perspective Projection Thus, a perspective projection matrix is defined as: (x,y,z) (x ,y ,0) p p ª 1 0 0 0 º « 0 1 0 0 » y « » d M center of x per « 0 0 0 0 » « 1 » projection x (x,y,z) « 0 0 1 » ¬ d ¼ z xp d z ª 1 0 0 0 º ª x º ª x º « 0 1 0 0 » « » « y » « » y « » • Using similar triangles it follows: M P « » per « 0 0 0 0 » « z » « 0 » « 1 » « » « z d » x p x y p y « 0 0 1 » 1 « » ; ¬ d ¼ ¬ ¼ ¬ d ¼ d z d d z d d x d y d x d y x ; y ; z 0 x p ; y p ; z p 0 p p p z d z d z d z d Perspective Projection Projections What is the difference between moving the center of •M is singular (|M |=0), thus M is a many to per per per projection and moving the projection plane? one mapping (for example: M P=M 2P) per per Original • Points on the viewing plane (z=0) do not change Center of Projection z • The homogeneous coordinates of a point at infinity Projection plane Moving the Center of Projection directed to (Ux,Uy,Uz) are (Ux,Uy,Uz,0). Thus, The vanishing point of parallel lines directed to (Ux,Uy,Uz) is at [dUx/Uz, dUy/Uz] Center of Projection z Projection plane Moving the Projection Plane • When dof, Mper oMort Center of Projection z Projection plane Projections Planar geometric projections Parallel Perspective Oblique Orthographic One point Front Top Two point Cavalier Side Other Cabinet Other Three point.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us