Viewing (Projections)

Slides:



Advertisements
Similar presentations
Computer Graphics - Viewing -
Advertisements

1 View Shandong University Software College Instructor: Zhou Yuanfeng
Three-Dimensional Viewing Sang Il Park Sejong University Lots of slides are stolen from Jehee Lee’s.
Classical Viewing CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Chapter 5 Viewing. 2 Perspective Projection 3 Parallel Projection.
Projection Projection - the transformation of points from a coordinate system in n dimensions to a coordinate system in m dimensions where m
Introduction to 3D viewing 3D is just like taking a photograph!
Computer Graphics (fall 2009)
Transformation & Projection Feng Yu Proseminar Computer Graphics :
Computer Graphics I, Fall 2010 Classical Viewing.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
1 E. Angel and D. Shreiner : Interactive Computer Graphics 6E © Addison-Wesley 2012 Classical Viewing Sai-Keung Wong ( 黃世強 ) Computer Science National.
1 Classical Viewing. 2 Objectives Introduce the classical views Compare and contrast image formation by computer with how images have been formed by architects,
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 67 Computer Graphics Three-Dimensional Graphics III.
Computer Graphics Bing-Yu Chen National Taiwan University.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 5.
Demetriou/Loizidou – ACSC330 – Chapter 5 Viewing Dr. Giorgos A. Demetriou Computer Science Frederick Institute of Technology.
CS5500 Computer Graphics March 12, 2007.
University of North Carolina at Greensboro
2003CS Hons RW778 Graphics1 Chapter 7: Three-Dimensional Viewing Chapter 5: Camera with parallel projection Chapter 5: Camera with parallel projection.
Graphics Graphics Korea University kucg.korea.ac.kr Viewing 고려대학교 컴퓨터 그래픽스 연구실.
Three-Dimensional Viewing
Three-Dimensional Viewing Hearn & Baker Chapter 7
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Part One - Parallel Projection textbook
1 PTT 105/3: Engineering Graphics. TAXONOMY OF PLANAR GEOMETRIC PROJECTIONS PTT 105/3: Engineering Graphics 2 Planar Geometric Projections Parallel Multiview.
Classical Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Viewing Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
CS5500 Computer Graphics March 20, Computer Viewing Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Computer Viewing Isaac Gang University of Mary Hardin-Baylor.
Viewing. Classical Viewing Viewing requires three basic elements - One or more objects - A viewer with a projection surface - Projectors that go from.
A Photograph of two papers The Model: 2 papers – 8cm x 8cm and 5cm x 5cm The Camera – Simple pinhole – No focusing capability The Scene – Arrangements.
Viewing 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Three Dimensional Viewing
Perspective projection
Rendering Pipeline Fall, 2015.
Viewing.
University of North Carolina at Greensboro
Computer Viewing.
Projection Our 3-D scenes are all specified in 3-D world coordinates
Isaac Gang University of Mary Hardin-Baylor
CSCE 441 Computer Graphics 3-D Viewing
CSC461: Lecture 18 Classical Viewing
CSC461: Lecture 20 Parallel Projections in OpenGL
CENG 477 Introduction to Computer Graphics
CSC461: Lecture 19 Computer Viewing
Viewing/Projections I Week 3, Fri Jan 25
Classical Viewing Ed Angel
A Photograph of two papers
Isaac Gang University of Mary Hardin-Baylor
Fundamentals of Computer Graphics Part 5 Viewing
Introduction to Computer Graphics with WebGL
Three Dimensional Viewing
OpenGL 2D Viewing Pipeline
Planar Geometric Projection Classes
Introduction to Computer Graphics with WebGL
Viewing (Projections)
University of New Mexico
Interactive Computer Graphics Viewing
Computer Graphics Computer Viewing
Computer Viewing Ed Angel Professor Emeritus of Computer Science
PROJECTIONS KOYEL DATTA GUPTA.
University of New Mexico
Isaac Gang University of Mary Hardin-Baylor
Presentation transcript:

Viewing (Projections) COM337 Computer Graphics Viewing (Projections)

Classical and Computer Viewing Viewing was an issue that existed before computers Photography, animation, architectural drawings, mechanical designs, cartography In perspective projection, all projection rays meet at a point called center of projection (COP) This is the center of the lens in human eye or in a real camera In computer viewing, this is the origin of our camera/viewing coordinate system The projection surface is a plane and projection happens with straight lines

Classical and Computer Viewing Viewer can be moved to an infinite distance away to produce another useful projection type Projection lines become parallel to each other Instead of a COP, we have a direction of projection (DOP) This is called parallel projection Used in technical drawings Lengths and distances remain same even if objects’ distance to projection plane changes The origin of the camera/viewing coordinate system is often the center of the projection plane

Classical Projections

Projection Classification planar geometric projections parallel perspective symmetric oblique multiview orthographic axonometric oblique isometric dimetric trimetric

Orthographic (Orthogonal) Projections A type of parallel projection in which direction of projection is perpendicular to the projection plane Elevations (front, side), plan view (top) This type of view preserves distances and angles (for planes parallel to view plane)

Orthogonal Projection Coordinates If projection direction is parallel to zview xp=x, yp=y z coordinate is kept for visibility detection procedures

Clipping Window and Orthogonal Projection View Volume Edges of the clipping window specify the x and y limits These are used to form the top, bottom, and two sides of a clipping region called the orthogonal-projection view volume Limit the volume in zview direction by near-far (or front-back) clipping planes

Axonometric Projections When an orthogonal projection shows more than one face (i.e., when image plane is not parallel with one of the faces), we have an axonometric projection classify by how many angles of a corner of a projected cube are the same none: trimetric two: dimetric three: isometric q 1 q 2 q 3

Axonometric Projections Lines are scaled (foreshortened) but can find scaling factors Lines preserved but angles are not Projection of a circle in a plane not parallel to the projection plane is an ellipse Can see three principal faces of a box-like object Some optical illusions possible Parallel lines appear to diverge Does not look real because far objects are scaled the same as near objects Used in CAD applications

Oblique Projections Projection lines are still parallel with each other but they are not perpendicular to the image plane

Oblique Projections Angles in faces parallel to the image plane are preserved The effect is same as z-axis shearing

Perspective Projections Projection lines converge at a point (center of projection) Parallel lines on the object (not parallel to the projection plane) converge at a single point in the projection (the vanishing point) Drawing simple perspectives by hand uses these vanishing point(s)

Perspective Projections

Perspective Projections Objects further from viewer are projected smaller than the same sized objects closer to the viewer (diminution) Looks realistic Equal distances along a line are not projected into equal distances (nonuniform foreshortening) Angles preserved only in planes parallel to the projection plane More difficult to construct by hand than parallel projections (but not more difficult by computer)

Perspective Projection View Volume An infinite pyramid of vision is chopped off by near and far clipping planes and we get a truncated pyramid (or frustum)

Symmetric Perspective Projection Frustum If the line from perspective reference point through clipping window center (centerline) is perpendicular to view plane, we have a symmetric frustum Clipping window can be specified by width and height, or field-of-view angle and aspect ratio With a symmetric frustum, perspective transformation is a mapping to orthogonal coordinates (figure on next slide)

Oblique Perspective-Projection Frustum Centerline not perpendicular to view plane First, transform this into a symmetric frustum (z-axis shearing) Then proceed as before

Arranging the Camera By default, camera is at the origin, pointing towards negative z direction We generally move the camera away from the origin (or equivalently, move the world coordinate system away from the camera) These changes are done through the model-view (MV) matrix which is initially the identity matrix Changes to the MV matrix affect the relative positions of camera and objects defined after the change Be careful about where in your program primitives are defined w.r.t. the changes to the MV matrix

Arranging the Camera One way is to use transformations just as we applied them to any other object E.g., to get a side view from positive x direction Rotate camera Move away from origin modelViewMatrix = mult(translate(0, 0, -d), rotateY(-90));

Arranging the Camera Another way is to specify the position and orientation of the camera m = lookAt(eye, at, up) A transformation matrix can be calculated from this information. eye vector will be used for translation 𝑛=𝑎𝑡−𝑒𝑦𝑒 is a vector in the direction that camera is looking at (z direction for the camera system) Normalize 𝑛 𝑢= 𝑢𝑝×𝑛 𝑢𝑝×𝑛 𝑣= 𝑛×𝑢 𝑛×𝑢 These u, v, and n vectors are the x, y, and z directions for the camera and can be used to create the rotation matrix Most APIs have a lookAt function

Arranging the Camera Other viewing methods Roll, pitch, yaw Elevation, azimuth, twist Direction angles

Orthogonal Projection in WebGL The default projection is an orthogonal projection defined with the cube centered at origin that has a side length of 2 var N = ortho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); We can set a different view volume with var N = ortho(left, right, bottom, top, near, far); WebGL actually creates the transformation matrix that transforms this volume to the default cube (the canonical view volume)

Orthogonal Projection in WebGL We can calculate the required transformation matrix easily First, we need to translate so that the center of our volume is at the center of the cube (origin) Then, we need to scale the box to get the cube with side length 2

Orthogonal Projection in WebGL Translation 𝑇=𝑇 − right+left 2 ,− top+bottom 2 , far+near 2 Scale 𝑆=𝑆 2 right−left , 2 top−bottom , 2 near−far Together 𝑆𝑇= 2 right−left 0 0 − left+right right−left 0 2 top−bottom 0 − top+bottom top−bottom 0 0 − 2 far−near − far+near far−near 0 0 0 1

Perspective Projection in WebGL Camera placement can be done with lookAt same as before Assume it is at origin And the projection plane is at 𝑧=𝑑 where 𝑑<0 Projection coordinates of point (x,y,z) will be xp = yp = zp = d

Perspective Projection in WebGL Again, we can view this as a transformation (not an affine one like those before) We will have 4x4 matrices but last row will be used, so the w value of the homogeneous coordinate can be different than 1 We can always normalize w.r.t. w to get the actual coordinates Consider 𝑀= 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1/𝑑 0 This will transform a point (x,y,z,1) to (x,y,z,z/d) When we divide all coordinates with the value of w, we get (x/z/d, y/z/d, d, 1) which is the projection point

Perspective Projection in WebGL We haven’t considered all variables Our camera can see a wider or more narrow area Not everything will be projected frustum(left,right, bottom,top,near,far) or perpective(fovy, aspect, near, far)